From c384c319f6c9db9c75d5a8975173f5b275f8ad00 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sun, 14 Aug 2022 11:08:15 +0300 Subject: [PATCH] Add support for musl wheels --- CONTRIBUTING.rst | 2 +- bin/build-linux-wheels | 43 ++++++++++++++++++++++++++++++++++++++ bin/build-manylinux-wheels | 42 ------------------------------------- 3 files changed, 44 insertions(+), 43 deletions(-) create mode 100755 bin/build-linux-wheels delete mode 100755 bin/build-manylinux-wheels diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 101beec7..bb7c2059 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -54,7 +54,7 @@ Here's a brief check list for releasing a new version: CI build takes a while. These wheels are not automatically uploaded, but there's ``./bin/download-windows-wheels`` script that downloads built wheels. Then upload them with ``twine``. -- Run ``./bin/build-manylinux-wheels`` to build linux wheels and upload them to +- Run ``./bin/build-linux-wheels`` to build linux wheels and upload them to PyPI (takes ~5 minutes). - The `docs website`__ also has to be updated. It's currently a static website deployed on GitHub Pages. diff --git a/bin/build-linux-wheels b/bin/build-linux-wheels new file mode 100755 index 00000000..e6944ce8 --- /dev/null +++ b/bin/build-linux-wheels @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +"""Script for building 'manylinux' & 'musllinux' 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-linux-wheels>> ' + + ' '.join(pipes.quote(part) for part in cmd), + ) + subprocess.check_call(cmd) + + +def main(): + os.makedirs('dist', exist_ok=True) + for platform in ('manylinux1', 'musllinux_1_1'): + with tempfile.TemporaryDirectory() as work: + pip = '/opt/python/cp37-cp37m/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')), + f'quay.io/pypa/{platform}_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()) diff --git a/bin/build-manylinux-wheels b/bin/build-manylinux-wheels deleted file mode 100755 index 65e05355..00000000 --- a/bin/build-manylinux-wheels +++ /dev/null @@ -1,42 +0,0 @@ -#!/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/cp37-cp37m/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())