Skip to content

Commit 63933eb

Browse files
committed
Merge pull request #151 from asottile/manylinux
Add a script to build manylinux wheels
2 parents a3748d8 + 2e44223 commit 63933eb

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ omit =
88
/usr/*
99
*/tmp*
1010
*/setup.py
11+
*/build_manylinux_wheels.py
1112
*/upload_appveyor_builds.py
1213

1314
[report]

CONTRIBUTING.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Here's a brief check list for releasing a new version:
5656
takes longer than an hour. These wheels are not automatically uploaded,
5757
but there's upload_appveyor_builds.py script that downloads built wheels and
5858
uploads them to PyPI.
59+
- Run build_manylinux_wheels.py to build linux wheels and upload them to
60+
PyPI (takes ~10 minutes).
5961
- The `docs website`__ also has to be updated.
6062
It's currently a static website deployed on GitHub Pages.
6163
Use ``python setup.py upload_doc`` command.

build_manylinux_wheels.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python3.5
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+
from twine.commands import upload
14+
15+
16+
def check_call(*cmd):
17+
print(
18+
'build-manylinux-wheels>> ' +
19+
' '.join(pipes.quote(part) for part in cmd),
20+
)
21+
subprocess.check_call(cmd)
22+
23+
24+
def main():
25+
os.makedirs('dist', exist_ok=True)
26+
for python in (
27+
'cp26-cp26mu',
28+
'cp27-cp27mu',
29+
'cp34-cp34m',
30+
'cp35-cp35m',
31+
):
32+
with tempfile.TemporaryDirectory() as work:
33+
pip = '/opt/python/{}/bin/pip'.format(python)
34+
check_call(
35+
'docker', 'run', '-ti',
36+
# Use this so the files are not owned by root
37+
'--user', '{}:{}'.format(os.getuid(), os.getgid()),
38+
# We'll do building in /work and copy results to /dist
39+
'-v', '{}:/work:rw'.format(work),
40+
'-v', '{}:/dist:rw'.format(os.path.abspath('dist')),
41+
'quay.io/pypa/manylinux1_x86_64:latest',
42+
'bash', '-exc',
43+
'{} wheel --verbose --wheel-dir /work --no-deps libsass && '
44+
'auditwheel repair --wheel-dir /dist /work/*.whl'.format(pip)
45+
)
46+
dists = tuple(os.path.join('dist', p) for p in os.listdir('dist'))
47+
return upload.main(('-r', 'pypi') + dists)
48+
49+
if __name__ == '__main__':
50+
exit(main())

0 commit comments

Comments
 (0)