Skip to content

Commit 1d7cc25

Browse files
committed
Adds supports for building wheels
1 parent e3c45ad commit 1d7cc25

File tree

5 files changed

+48
-1
lines changed

5 files changed

+48
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ nosetests.xml
2626
benchmark.py
2727
results.json
2828
profile.html
29+
/wheelhouse

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,29 @@ setup: setup-python
2121
test:
2222
@py.test --cov=pendulum --cov-config .coveragerc tests/ -sq
2323

24+
wheels: clean-wheels wheels_x64 wheels_i686
25+
26+
wheels_x64:
27+
docker pull quay.io/pypa/manylinux1_x86_64
28+
docker run --rm -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /io/build-wheels.sh
29+
30+
wheels_i686:
31+
docker pull quay.io/pypa/manylinux1_i686
32+
docker run --rm -v `pwd`:/io quay.io/pypa/manylinux1_i686 /io/build-wheels.sh
33+
34+
clean-wheels:
35+
rm -rf wheelhouse/
36+
37+
upload-wheels:
38+
@for f in wheelhouse/*manylinux1_x86_64.whl ; do \
39+
echo "Upload $$f" ; \
40+
python -m twine upload $$f ; \
41+
done
42+
@for f in wheelhouse/*manylinux1_i686.whl ; do \
43+
echo "Upload $$f" ; \
44+
python -m twine upload $$f ; \
45+
done
46+
2447
# run tests against all supported python versions
2548
tox:
2649
@tox

build-wheels.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
PYTHON_VERSIONS="cp27-cp27m cp35-cp35m"
3+
4+
echo "Compile wheels"
5+
for PYTHON in ${PYTHON_VERSIONS}; do
6+
/opt/python/${PYTHON}/bin/pip install -r /io/wheels-requirements.txt
7+
/opt/python/${PYTHON}/bin/pip wheel /io/ -w /io/wheelhouse/
8+
done
9+
10+
echo "Bundle external shared libraries into the wheels"
11+
for whl in /io/wheelhouse/*.whl; do
12+
auditwheel repair $whl -w /io/wheelhouse/
13+
done
14+
15+
echo "Install packages and test"
16+
for PYTHON in ${PYTHON_VERSIONS}; do
17+
/opt/python/${PYTHON}/bin/pip install pendulum --no-index -f /io/wheelhouse
18+
find ./io/tests | grep -E "(__pycache__|\.pyc$)" | xargs rm -rf
19+
/opt/python/${PYTHON}/bin/py.test /io/tests
20+
find ./io/tests | grep -E "(__pycache__|\.pyc$)" | xargs rm -rf
21+
done

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def build_extension(self, ext):
8484
author_email='[email protected]',
8585
url='https://github.com/sdispater/pendulum',
8686
download_url='https://github.com/sdispater/pendulum/archive/%s.tar.gz' % __version__,
87-
packages=find_packages(exclude=['tests']),
87+
packages=['pendulum'],
8888
install_requires=[
8989
'tzlocal',
9090
'pytz',

wheels-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cython
2+
pytest

0 commit comments

Comments
 (0)