Debian Codegraph @

bin/build-manylinux-wheels

raw
1 #!/usr/bin/env python3
2 """Script for building 'manylinux' wheels for libsass.
3
4 Run me after putting the source distribution on pypi.
5
6 See: https://www.python.org/dev/peps/pep-0513/
7 """
8 import os
9 import pipes
10 import subprocess
11 import tempfile
12
13
14 def check_call(*cmd):
15 print(
16 'build-manylinux-wheels>> ' +
17 ' '.join(pipes.quote(part) for part in cmd),
18 )
19 subprocess.check_call(cmd)
20
21
22 def main():
23 os.makedirs('dist', exist_ok=True)
24 with tempfile.TemporaryDirectory() as work:
25 pip = '/opt/python/cp37-cp37m/bin/pip'
26 check_call(
27 'docker', 'run', '-ti',
28 # Use this so the files are not owned by root
29 '--user', f'{os.getuid()}:{os.getgid()}',
30 # We'll do building in /work and copy results to /dist
31 '-v', f'{work}:/work:rw',
32 '-v', '{}:/dist:rw'.format(os.path.abspath('dist')),
33 'quay.io/pypa/manylinux1_x86_64:latest',
34 'bash', '-exc',
35 '{} wheel --verbose --wheel-dir /work --no-deps libsass && '
36 'auditwheel repair --wheel-dir /dist /work/*.whl'.format(pip),
37 )
38 return 0
39
40
41 if __name__ == '__main__':
42 raise SystemExit(main())