-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.py
More file actions
22 lines (18 loc) · 752 Bytes
/
Copy pathsetup.py
File metadata and controls
22 lines (18 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Setuptools hook: bundle JS modules before building."""
import os
import subprocess
from setuptools import setup
from setuptools.command.build_py import build_py
class BuildWithBundle(build_py):
def run(self):
try:
subprocess.check_call(["python3", "scripts/bundle_js.py"])
except Exception as e:
if os.environ.get("SALMALM_RELEASE") == "1":
raise RuntimeError(f"JS bundle failed in release mode: {e}") from e
print(f"⚠️ JS bundle skipped: {e}")
# MED-14: pop custom args before setuptools sees them
import sys
sys.argv = [a for a in sys.argv if not a.startswith("--salmalm-")]
super().run()
setup(cmdclass={"build_py": BuildWithBundle})