Skip to content

Commit 043a331

Browse files
committed
ci: Add GitHub Actions workflow for build and release
1 parent 3250331 commit 043a331

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

python_src/build_license_plate_runtime.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,36 @@ def copy_python_sources(target_dir: Path) -> None:
114114

115115

116116
def strip_unneeded_files(venv_path: Path) -> None:
117-
if platform.system().lower().startswith("win"):
118-
for pattern in ("*.pdb", "*.a", "*.lib"):
117+
system = platform.system().lower()
118+
119+
if system.startswith("win"):
120+
patterns = ("*.pdb", "*.a", "*.lib")
121+
for pattern in patterns:
122+
for file in venv_path.glob(f"**/{pattern}"):
123+
try:
124+
file.unlink()
125+
except OSError:
126+
pass
127+
return
128+
129+
if system.startswith("linux"):
130+
for pattern in ("*.a", "*.la", "*.o"):
119131
for file in venv_path.glob(f"**/{pattern}"):
120132
try:
121133
file.unlink()
122134
except OSError:
123135
pass
124136

137+
strip_bin = shutil.which("strip")
138+
if strip_bin:
139+
shared_objects = list(venv_path.rglob("*.so")) + list(venv_path.rglob("*.so.*"))
140+
for so_path in shared_objects:
141+
try:
142+
print(f"[strip] Stripping {so_path}")
143+
subprocess.run([strip_bin, "--strip-unneeded", str(so_path)], check=True)
144+
except subprocess.CalledProcessError:
145+
print(f"[strip] Warning: failed to strip {so_path}")
146+
125147

126148
def make_archive(staging_dir: Path, archive_dir: Path, archive_name: str, fmt: str) -> Path:
127149
archive_dir.mkdir(parents=True, exist_ok=True)

0 commit comments

Comments
 (0)