aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jussi.pakkanen@mailbox.org>2025-07-21 18:05:13 +0300
committerJussi Pakkanen <jussi.pakkanen@mailbox.org>2025-07-21 18:09:39 +0300
commitb9d2846ea50381d1216a98ecce9462a697e7e918 (patch)
tree10081fdd4b39fb4203299facbec260b3bed02752
parent774b835edc116c7b77c831dc5501d1c00e7282c3 (diff)
downloadmeson-deshellify.zip
meson-deshellify.tar.gz
meson-deshellify.tar.bz2
Convert builddist to a Python script.deshellify
-rwxr-xr-xpackaging/builddist.py32
-rwxr-xr-xpackaging/builddist.sh19
2 files changed, 32 insertions, 19 deletions
diff --git a/packaging/builddist.py b/packaging/builddist.py
new file mode 100755
index 0000000..5cf3b02
--- /dev/null
+++ b/packaging/builddist.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+# SPDX-License-Identifier: Apache-2.0
+# Copyright 2025 The Meson development team
+
+# This script must be run from the source root.
+
+import pathlib, shutil, subprocess
+
+gendir = pathlib.Path('distgendir')
+distdir = pathlib.Path('dist')
+gitdir = pathlib.Path('.git')
+
+if distdir.is_dir():
+ shutil.rmtree(distdir)
+distdir.mkdir()
+
+if gendir.is_dir():
+ shutil.rmtree(gendir)
+gendir.mkdir()
+
+shutil.copytree(gitdir, gendir / '.git')
+
+subprocess.check_call(['git', 'reset', '--hard'],
+ cwd=gendir)
+subprocess.check_call(['python3', 'setup.py', 'sdist', 'bdist_wheel'],
+ cwd=gendir)
+for f in (gendir / 'dist').glob('*'):
+ shutil.copy(f, distdir)
+
+shutil.rmtree(gendir)
+
diff --git a/packaging/builddist.sh b/packaging/builddist.sh
deleted file mode 100755
index edcf3ec..0000000
--- a/packaging/builddist.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/zsh
-
-# This script must be run from the source root.
-
-set -e
-
-GENDIR=distgendir
-
-rm -rf dist
-rm -rf $GENDIR
-mkdir dist
-mkdir $GENDIR
-cp -r .git $GENDIR
-cd $GENDIR
-git reset --hard
-python3 setup.py sdist bdist_wheel
-cp dist/* ../dist
-cd ..
-rm -rf $GENDIR