refactor: keep root install as the sole installer source
This commit is contained in:
1 parent
6491a766f4
commit
a46bd6e132
14 files changed
+95
-385
No files matched your search
@@ -0,0 +1,32 @@
|
||||
"""Read the real installer for focused tests; no installation logic is copied."""
|
||||
|
||||
from pathlib import Path
|
||||
from types import ModuleType
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
ENTRY = ROOT / "install"
|
||||
|
||||
|
||||
def entry_parts():
|
||||
entry = ENTRY.read_text()
|
||||
opening = "<<'DEVER_INSTALL_PYTHON'\n"
|
||||
closing = "\nDEVER_INSTALL_PYTHON\n"
|
||||
if entry.count(opening) != 1 or entry.count(closing) != 1:
|
||||
raise ValueError("root install must contain exactly one Python heredoc")
|
||||
before, remainder = entry.split(opening)
|
||||
source, after = remainder.split(closing)
|
||||
return before + opening, source, closing + after
|
||||
|
||||
|
||||
def load_installer():
|
||||
_, source, _ = entry_parts()
|
||||
module = ModuleType("dever_installer")
|
||||
exec(compile(source, str(ENTRY) + "::python", "exec"), module.__dict__)
|
||||
return module
|
||||
|
||||
|
||||
def entry_with_python(probe):
|
||||
"""Keep the actual shell wrapper while a harmless probe observes its contract."""
|
||||
before, _, after = entry_parts()
|
||||
return before + probe.rstrip("\n") + after
|
||||
Reference in new issue
Block a user