dev_environment.py: add --skip-binaries flag

This commit is contained in:
Andrej730
2026-07-22 18:04:59 +05:00
parent 1e4b4b5557
commit 037908f08e
+26 -11
View File
@@ -14,6 +14,7 @@ Example usage:
""" """
import argparse
import shutil import shutil
import subprocess import subprocess
import sys import sys
@@ -26,6 +27,17 @@ if sys.platform not in available_platforms:
print(f"Currently only available on {', '.join(available_platforms)}. Not available on {sys.platform}.") print(f"Currently only available on {', '.join(available_platforms)}. Not available on {sys.platform}.")
exit(1) exit(1)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--skip-binaries",
action="store_true",
help=(
"Skip copying compiled dependencies (e.g. ifcopenshell_wrapper) to the repo. "
"Useful if you already have the latest binaries in the repo and don't want them to be overridden."
),
)
args = parser.parse_args()
# --------------------------- # ---------------------------
# SETTINGS. # SETTINGS.
# --------------------------- # ---------------------------
@@ -124,17 +136,20 @@ def main() -> None:
path.unlink() path.unlink()
subprocess.check_call(("git", "checkout", "--", symlinks_glob), cwd=REPO_PATH) subprocess.check_call(("git", "checkout", "--", symlinks_glob), cwd=REPO_PATH)
print("Copying compiled dependencies to the repo...") if args.skip_binaries:
dest = REPO_PATH / "src" / "ifcopenshell-python" / "ifcopenshell" print("Skipping copying compiled dependencies to the repo...")
for path in PACKAGE_PATH.glob("ifcopenshell/*_wrapper*"): else:
if path.suffix.lower() == ".pyi": print("Copying compiled dependencies to the repo...")
continue dest = REPO_PATH / "src" / "ifcopenshell-python" / "ifcopenshell"
dest_ = dest / path.name for path in PACKAGE_PATH.glob("ifcopenshell/*_wrapper*"):
print(f"Copying {path} -> {dest_}") if path.suffix.lower() == ".pyi":
try: continue
shutil.copy(path, dest_) dest_ = dest / path.name
except shutil.SameFileError: print(f"Copying {path} -> {dest_}")
pass try:
shutil.copy(path, dest_)
except shutil.SameFileError:
pass
print("Symlinking extension to the git repo...") print("Symlinking extension to the git repo...")
# fmt: off # fmt: off