From caf0b550386deb6cac81c3e5a4574aeb7c84fdc3 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Thu, 20 Aug 2026 20:13:24 +0800 Subject: [PATCH] fix(ci): unblock install and wire INTERSCRIPT_MAPS_PATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - setup.py: drop the legacy build gate that required ./build.sh compiled maps — the runtime parses .imp directly and never ships src/interscript/maps - interscript.py: seed _load_paths from INTERSCRIPT_MAPS_PATH so the public API finds maps without an explicit add_load_path - test_engine: reset paths via the implementation module --- setup.py | 21 ++------------------- src/interscript/interscript.py | 7 ++++++- tests/test_engine.py | 2 +- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/setup.py b/setup.py index f4154ca..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,3 @@ -from setuptools import setup, find_packages -from setuptools.command.build_py import build_py as _build_py -import os +from setuptools import setup -class CustomBuildCommand(_build_py): - """Ensure the maps are built""" - - def run(self): - if not os.path.exists("src/interscript/maps"): - print("Maps have not been built. Please issue ./build.sh before trying to build a package.") - exit(1) - - # Call the superclass method to perform the standard build - super().run() - -setup( - cmdclass={ - 'build_py': CustomBuildCommand, - }, -) +setup() diff --git a/src/interscript/interscript.py b/src/interscript/interscript.py index 4fc0113..72cfbbb 100644 --- a/src/interscript/interscript.py +++ b/src/interscript/interscript.py @@ -5,6 +5,7 @@ """ from __future__ import annotations +import os from pathlib import Path from .engine import Engine, ExecutionError @@ -15,7 +16,11 @@ "Engine", "ExecutionError", "parse_file", ] -_load_paths: list[Path] = [] +_load_paths: list[Path] = ( + [Path(os.environ["INTERSCRIPT_MAPS_PATH"])] + if os.environ.get("INTERSCRIPT_MAPS_PATH") + else [] +) _cache: dict[str, Engine] = {} diff --git a/tests/test_engine.py b/tests/test_engine.py index 34f333a..7aa6485 100644 --- a/tests/test_engine.py +++ b/tests/test_engine.py @@ -31,7 +31,7 @@ def _load(name: str) -> Engine: - interscript._load_paths.clear() + interscript.interscript._load_paths.clear() interscript.add_load_path(MAPS) return interscript.load_map(name)