GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — inky-example-python/bootstrap.py at main · foundation/inky-example-python Expand file tree/ Copy pathbootstrap.pyMore file actions 50 lines (40 loc) · 1.9 KB / Copy pathbootstrap.pyFile metadata and controls50 lines (40 loc) · 1.9 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 """ Shared bootstrap for every example's run.py. Adds the `inky` Python binding to sys.path — mirroring how inky/bindings/python/test.py loads it in development: a direct sys.path.insert() at bindings/python/src, not a pip install. This suite assumes inky-example-python is checked out as a SIBLING of inky/ (same assumption the PHP suite makes about its Composer path repository — see SUITE.md "Runtime requirements" §1 and the "Porting notes for Stage C" §2(a) sanity check). Runtime note (this suite's own Task-1-equivalent sanity check): unlike Composer's symlinked path repository, this sys.path insertion points directly at bindings/python/src — there is no package-manager symlink anywhere in the loop, so there's nothing for __file__ resolution inside inky/__init__.py to get fooled by. Its own dylib lookup (_find_library(), resolved relative to its own __file__, four directories up to target/release/) works completely unmodified. No special wiring was needed; unlike PHP's `minimum-stability`/`prefer-stable` composer fix, there is no equivalent dependency-resolver quirk here either, since this suite never asks pip to resolve inky itself — only Jinja2 (a normal, stable PyPI release) is installed via requirements.txt. Every example's run.py starts with: import os, sys sys.path.insert(0, os.path.normpath(os.path.join(os.path.dirname(__file__), "..", ".."))) import bootstrap import inky dist = bootstrap.inky_example("01-quickstart") """ import os import sys _ROOT = os.path.dirname(os.path.abspath(__file__)) _INKY_SRC = os.path.normpath( os.path.join(_ROOT, "..", "inky", "bindings", "python", "src") ) if _INKY_SRC not in sys.path: sys.path.insert(0, _INKY_SRC) def inky_example(name: str) -> str: """Return the dist output directory for an example, creating it if needed.""" path = os.path.join(_ROOT, "dist", name) os.makedirs(path, exist_ok=True) return path |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |