refactor: unify bundle-symlink scripts into setup_bundle_symlinks.py
The three per-version setup_*_bundle_symlinks.py scripts were logically identical, differing only in the version string. Replace the duplicated logic with a single parameterised script: tools/linux/setup_bundle_symlinks.py <version> The three named scripts are kept as one-liner thin wrappers that forward to the unified script, preserving backwards compatibility.
This commit is contained in:
@@ -1,48 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Creates symlinks in versions/25.01-bundle to mirror vendor directory structure."""
|
"""Thin wrapper — delegates to setup_bundle_symlinks.py for version 25.01."""
|
||||||
import os
|
import subprocess, sys, pathlib
|
||||||
from pathlib import Path
|
script = pathlib.Path(__file__).parent / "setup_bundle_symlinks.py"
|
||||||
|
sys.exit(subprocess.call([sys.executable, str(script), "25.01"]))
|
||||||
ROOT = Path(__file__).resolve().parents[2]
|
|
||||||
bundle_root = ROOT / "versions/25.01-bundle"
|
|
||||||
vendor_root = ROOT / "versions/25.01"
|
|
||||||
bundle_7zip = bundle_root / "CPP/7zip"
|
|
||||||
vendor_7zip = vendor_root / "CPP/7zip"
|
|
||||||
bundle_cpp = bundle_root / "CPP"
|
|
||||||
vendor_cpp = vendor_root / "CPP"
|
|
||||||
|
|
||||||
# Root-level symlinks: C and Asm
|
|
||||||
for name in ("C", "Asm"):
|
|
||||||
target = bundle_root / name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(vendor_root / name, bundle_root)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
for item in vendor_7zip.iterdir():
|
|
||||||
target = bundle_7zip / item.name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(item, bundle_7zip)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
bundle_ui = bundle_7zip / "UI"
|
|
||||||
vendor_ui = vendor_7zip / "UI"
|
|
||||||
bundle_ui.mkdir(exist_ok=True)
|
|
||||||
for item in vendor_ui.iterdir():
|
|
||||||
target = bundle_ui / item.name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(item, bundle_ui)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
for item in vendor_cpp.iterdir():
|
|
||||||
if item.name == "7zip":
|
|
||||||
continue
|
|
||||||
target = bundle_cpp / item.name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(item, bundle_cpp)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
print("Done")
|
|
||||||
|
|||||||
@@ -1,48 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Creates symlinks in versions/26.00-bundle to mirror vendor directory structure."""
|
"""Thin wrapper — delegates to setup_bundle_symlinks.py for version 26.00."""
|
||||||
import os
|
import subprocess, sys, pathlib
|
||||||
from pathlib import Path
|
script = pathlib.Path(__file__).parent / "setup_bundle_symlinks.py"
|
||||||
|
sys.exit(subprocess.call([sys.executable, str(script), "26.00"]))
|
||||||
ROOT = Path(__file__).resolve().parents[2]
|
|
||||||
bundle_root = ROOT / "versions/26.00-bundle"
|
|
||||||
vendor_root = ROOT / "versions/26.00"
|
|
||||||
bundle_7zip = bundle_root / "CPP/7zip"
|
|
||||||
vendor_7zip = vendor_root / "CPP/7zip"
|
|
||||||
bundle_cpp = bundle_root / "CPP"
|
|
||||||
vendor_cpp = vendor_root / "CPP"
|
|
||||||
|
|
||||||
# Root-level symlinks: C and Asm
|
|
||||||
for name in ("C", "Asm"):
|
|
||||||
target = bundle_root / name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(vendor_root / name, bundle_root)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
for item in vendor_7zip.iterdir():
|
|
||||||
target = bundle_7zip / item.name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(item, bundle_7zip)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
bundle_ui = bundle_7zip / "UI"
|
|
||||||
vendor_ui = vendor_7zip / "UI"
|
|
||||||
bundle_ui.mkdir(exist_ok=True)
|
|
||||||
for item in vendor_ui.iterdir():
|
|
||||||
target = bundle_ui / item.name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(item, bundle_ui)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
for item in vendor_cpp.iterdir():
|
|
||||||
if item.name == "7zip":
|
|
||||||
continue
|
|
||||||
target = bundle_cpp / item.name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(item, bundle_cpp)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
print("Done")
|
|
||||||
|
|||||||
@@ -1,48 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Creates symlinks in versions/26.01-bundle to mirror vendor directory structure."""
|
"""Thin wrapper — delegates to setup_bundle_symlinks.py for version 26.01."""
|
||||||
import os
|
import subprocess, sys, pathlib
|
||||||
from pathlib import Path
|
script = pathlib.Path(__file__).parent / "setup_bundle_symlinks.py"
|
||||||
|
sys.exit(subprocess.call([sys.executable, str(script), "26.01"]))
|
||||||
ROOT = Path(__file__).resolve().parents[2]
|
|
||||||
bundle_root = ROOT / "versions/26.01-bundle"
|
|
||||||
vendor_root = ROOT / "versions/26.01"
|
|
||||||
bundle_7zip = bundle_root / "CPP/7zip"
|
|
||||||
vendor_7zip = vendor_root / "CPP/7zip"
|
|
||||||
bundle_cpp = bundle_root / "CPP"
|
|
||||||
vendor_cpp = vendor_root / "CPP"
|
|
||||||
|
|
||||||
# Root-level symlinks: C and Asm
|
|
||||||
for name in ("C", "Asm"):
|
|
||||||
target = bundle_root / name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(vendor_root / name, bundle_root)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
for item in vendor_7zip.iterdir():
|
|
||||||
target = bundle_7zip / item.name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(item, bundle_7zip)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
bundle_ui = bundle_7zip / "UI"
|
|
||||||
vendor_ui = vendor_7zip / "UI"
|
|
||||||
bundle_ui.mkdir(exist_ok=True)
|
|
||||||
for item in vendor_ui.iterdir():
|
|
||||||
target = bundle_ui / item.name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(item, bundle_ui)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
for item in vendor_cpp.iterdir():
|
|
||||||
if item.name == "7zip":
|
|
||||||
continue
|
|
||||||
target = bundle_cpp / item.name
|
|
||||||
if not target.exists() and not target.is_symlink():
|
|
||||||
rel = os.path.relpath(item, bundle_cpp)
|
|
||||||
os.symlink(rel, target)
|
|
||||||
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
|
||||||
|
|
||||||
print("Done")
|
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Creates symlinks in versions/<VERSION>-bundle to mirror vendor directory structure.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
python3 setup_bundle_symlinks.py <version>
|
||||||
|
|
||||||
|
Example:
|
||||||
|
python3 setup_bundle_symlinks.py 25.01
|
||||||
|
python3 setup_bundle_symlinks.py 26.00
|
||||||
|
python3 setup_bundle_symlinks.py 26.01
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print(f"Usage: {sys.argv[0]} <version>", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
version = sys.argv[1]
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
bundle_root = ROOT / f"versions/{version}-bundle"
|
||||||
|
vendor_root = ROOT / f"versions/{version}"
|
||||||
|
|
||||||
|
if not vendor_root.exists():
|
||||||
|
print(f"Error: vendor directory not found: {vendor_root}", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
if not bundle_root.exists():
|
||||||
|
print(f"Error: bundle directory not found: {bundle_root}", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
bundle_7zip = bundle_root / "CPP/7zip"
|
||||||
|
vendor_7zip = vendor_root / "CPP/7zip"
|
||||||
|
bundle_cpp = bundle_root / "CPP"
|
||||||
|
vendor_cpp = vendor_root / "CPP"
|
||||||
|
|
||||||
|
# Root-level symlinks: C and Asm
|
||||||
|
for name in ("C", "Asm"):
|
||||||
|
target = bundle_root / name
|
||||||
|
if not target.exists() and not target.is_symlink():
|
||||||
|
rel = os.path.relpath(vendor_root / name, bundle_root)
|
||||||
|
os.symlink(rel, target)
|
||||||
|
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
||||||
|
|
||||||
|
for item in vendor_7zip.iterdir():
|
||||||
|
target = bundle_7zip / item.name
|
||||||
|
if not target.exists() and not target.is_symlink():
|
||||||
|
rel = os.path.relpath(item, bundle_7zip)
|
||||||
|
os.symlink(rel, target)
|
||||||
|
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
||||||
|
|
||||||
|
bundle_ui = bundle_7zip / "UI"
|
||||||
|
vendor_ui = vendor_7zip / "UI"
|
||||||
|
bundle_ui.mkdir(exist_ok=True)
|
||||||
|
for item in vendor_ui.iterdir():
|
||||||
|
target = bundle_ui / item.name
|
||||||
|
if not target.exists() and not target.is_symlink():
|
||||||
|
rel = os.path.relpath(item, bundle_ui)
|
||||||
|
os.symlink(rel, target)
|
||||||
|
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
||||||
|
|
||||||
|
for item in vendor_cpp.iterdir():
|
||||||
|
if item.name == "7zip":
|
||||||
|
continue
|
||||||
|
target = bundle_cpp / item.name
|
||||||
|
if not target.exists() and not target.is_symlink():
|
||||||
|
rel = os.path.relpath(item, bundle_cpp)
|
||||||
|
os.symlink(rel, target)
|
||||||
|
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
|
||||||
|
|
||||||
|
print("Done")
|
||||||
Reference in New Issue
Block a user