summaryrefslogtreecommitdiff
path: root/packaging/builddist.py
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-31 12:29:35 +0300
commitdd7cf67f00f1b08fc15885d9bade23f8e76845c0 (patch)
tree3b3e116ac951cc8330643bb9cd62104b991dd18a /packaging/builddist.py
parentfb1046d9e9a8f09c43ed390830b93ffe83817dd0 (diff)
downloadmeson-dd7cf67f00f1b08fc15885d9bade23f8e76845c0.tar.gz
Convert builddist to a Python script.
Diffstat (limited to 'packaging/builddist.py')
-rwxr-xr-xpackaging/builddist.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/packaging/builddist.py b/packaging/builddist.py
new file mode 100755
index 000000000..5cf3b02a7
--- /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)
+