Files
nsis-plugin-ns7zip/tools/linux/setup_26_00_bundle_symlinks.py
T
Simone eec05089cf feat(26.00): add bundle wrapper directory with NSIS sources and vendor symlinks
Mirror the 26.01-bundle approach for 26.00:

- versions/26.00-bundle/CPP/7zip/Bundles/Nsis7z/: project-owned NSIS plugin
  wrapper sources (api.h, nsis7z.cpp, pluginapi.*, resource.*, StdAfx*,
  Nsis7z.sln, Nsis7z.vcxproj, Nsis7z.vcxproj.filters, Nsis7z_vs2026.vcxproj).
- versions/26.00-bundle/CPP/7zip/UI/NSIS/: NSIS UI sources (Main.cpp,
  ExtractCallbackConsole.*, NSISBreak.*, UserInputUtils2.*, StdAfx.h).
- versions/26.00-bundle/CPP/7zip/LzmaDec_gcc.mak: forwarding stub so that
  the CWD-relative `include ../../LzmaDec_gcc.mak` in Arc_gcc.mak resolves
  correctly when make runs from the Nsis7z bundle dir.
- versions/26.00-bundle/{C,Asm} and CPP sub-trees: symlinks into versions/26.00/
  so the vendor headers and sources are visible without modifying the submodule.
- tools/linux/setup_26_00_bundle_symlinks.py: idempotent script to recreate
  all symlinks after a fresh clone + submodule initialisation.
2026-05-03 01:31:19 +02:00

49 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""Creates symlinks in versions/26.00-bundle to mirror vendor directory structure."""
import os
from pathlib import Path
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")