Debian Codegraph @

packaging/builddist.py

raw
1 #!/usr/bin/env python3
2
3 # SPDX-License-Identifier: Apache-2.0
4 # Copyright 2025 The Meson development team
5
6 # This script must be run from the source root.
7
8 import pathlib, shutil, subprocess
9
10 gendir = pathlib.Path('distgendir')
11 distdir = pathlib.Path('dist')
12 gitdir = pathlib.Path('.git')
13
14 if distdir.is_dir():
15 shutil.rmtree(distdir)
16 distdir.mkdir()
17
18 if gendir.is_dir():
19 shutil.rmtree(gendir)
20 gendir.mkdir()
21
22 shutil.copytree(gitdir, gendir / '.git')
23
24 subprocess.check_call(['git', 'reset', '--hard'],
25 cwd=gendir)
26 subprocess.check_call(['python3', 'setup.py', 'sdist', 'bdist_wheel'],
27 cwd=gendir)
28 for f in (gendir / 'dist').glob('*'):
29 shutil.copy(f, distdir)
30
31 shutil.rmtree(gendir)
32