aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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