Skip to content

Commit 05daebf

Browse files
committed
Added script file to strip unwanted files from dist tarball
1 parent 3dc1663 commit 05daebf

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,5 @@ else
227227
endif
228228

229229
endif
230+
# dist - script to reduce the *tar.gz
231+
meson.add_dist_script('scripts/strip-sdist.py')

scripts/strip-sdist.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Script file to strip unwanted files from dist tarball
4+
5+
"""
6+
7+
import os
8+
import shutil
9+
10+
dist_root = os.environ.get("MESON_DIST_ROOT")
11+
12+
# Files/Folders to strip from the *.tar.gz
13+
exclude = [
14+
".github",
15+
"docs",
16+
"tests",
17+
"changelog",
18+
"stubs",
19+
"scripts",
20+
".pre-commit-config.yaml",
21+
".gitignore",
22+
".readthedocs.yaml",
23+
"Makefile",
24+
"environment-docs-conda-base.yml",
25+
"mkdocs.yml",
26+
"uv.lock",
27+
"requirements-docs-locked.txt",
28+
"requirements-incl-optional-locked.txt",
29+
"requirements-locked.txt",
30+
"requirements-only-tests-locked.txt",
31+
"requirements-only-tests-min-locked.txt",
32+
"requirements-upstream-dev.txt",
33+
".copier-answers.yml",
34+
".fprettify.rc",
35+
]
36+
37+
# Stripping
38+
for path in exclude:
39+
abs_path = os.path.join(dist_root, path)
40+
if not os.path.exists(abs_path):
41+
print(f"File not found: {abs_path}")
42+
if os.path.isdir(abs_path):
43+
shutil.rmtree(abs_path)
44+
elif os.path.isfile(abs_path):
45+
os.remove(abs_path)

0 commit comments

Comments
 (0)