Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions setup.py
Original file line numberDiff line numberDiff line change
@@ -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()
7 changes: 6 additions & 1 deletion src/interscript/interscript.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@
"""
from __future__ import annotations

import os
from pathlib import Path

from .engine import Engine, ExecutionError
Expand All@@ -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] = {}


Expand Down
2 changes: 1 addition & 1 deletion tests/test_engine.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -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)

Expand Down
Loading