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