forked from sass/libsass-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_manylinux_wheels.py
More file actions
executable file
·49 lines (41 loc) · 1.48 KB
/
build_manylinux_wheels.py
File metadata and controls
executable file
·49 lines (41 loc) · 1.48 KB
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
43
44
45
46
47
48
49
#!/usr/bin/env python3.5
"""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
from twine.commands import upload
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)
for python in (
'cp27-cp27mu',
'cp34-cp34m',
'cp35-cp35m',
):
with tempfile.TemporaryDirectory() as work:
pip = '/opt/python/{}/bin/pip'.format(python)
check_call(
'docker', 'run', '-ti',
# Use this so the files are not owned by root
'--user', '{}:{}'.format(os.getuid(), os.getgid()),
# We'll do building in /work and copy results to /dist
'-v', '{}:/work:rw'.format(work),
'-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)
)
dists = tuple(os.path.join('dist', p) for p in os.listdir('dist'))
return upload.main(('-r', 'pypi') + dists)
if __name__ == '__main__':
exit(main())