Browse Source

enable universal wheels

Signed-off-by: Thomas Grainger <[email protected]>
Thomas Grainger 9 years ago
parent
commit
340a3fc09c
5 changed files with 30 additions and 7 deletions
  1. 1 1
      Dockerfile.run
  2. 2 2
      script/build/image
  3. 3 3
      script/release/push-release
  4. 2 0
      setup.cfg
  5. 22 1
      setup.py

+ 1 - 1
Dockerfile.run

@@ -7,7 +7,7 @@ RUN     apk -U add \
 COPY    requirements.txt /code/requirements.txt
 RUN     pip install -r /code/requirements.txt
 
-ADD     dist/docker-compose-release.tar.gz /code/docker-compose
+ADD     dist/docker-compose-release-py2.py3-none-any.whl /code/docker-compose
 RUN     pip install --no-deps /code/docker-compose/docker-compose-*
 
 ENTRYPOINT ["/usr/bin/docker-compose"]

+ 2 - 2
script/build/image

@@ -11,6 +11,6 @@ TAG=$1
 VERSION="$(python setup.py --version)"
 
 ./script/build/write-git-sha
-python setup.py sdist
-cp dist/docker-compose-$VERSION.tar.gz dist/docker-compose-release.tar.gz
+python setup.py sdist bdist_wheel
+cp dist/docker-compose-$VERSION-py2.py3-none-any.whl dist/docker-compose-release-py2.py3-none-any.whl
 docker build -t docker/compose:$TAG -f Dockerfile.run .

+ 3 - 3
script/release/push-release

@@ -54,13 +54,13 @@ git push $GITHUB_REPO $VERSION
 echo "Uploading the docker image"
 docker push docker/compose:$VERSION
 
-echo "Uploading sdist to PyPI"
+echo "Uploading package to PyPI"
 pandoc -f markdown -t rst README.md -o README.rst
 sed -i -e 's/logo.png?raw=true/https:\/\/github.com\/docker\/compose\/raw\/master\/logo.png?raw=true/' README.rst
 ./script/build/write-git-sha
-python setup.py sdist
+python setup.py sdist bdist_wheel
 if [ "$(command -v twine 2> /dev/null)" ]; then
-    twine upload ./dist/docker-compose-${VERSION/-/}.tar.gz
+    twine upload ./dist/docker-compose-${VERSION/-/}.tar.gz ./dist/docker-compose-${VERSION/-/}-py2.py3-none-any.whl
 else
     python setup.py upload
 fi

+ 2 - 0
setup.cfg

@@ -0,0 +1,2 @@
+[bdist_wheel]
+universal=1

+ 22 - 1
setup.py

@@ -4,10 +4,12 @@ from __future__ import absolute_import
 from __future__ import unicode_literals
 
 import codecs
+import logging
 import os
 import re
 import sys
 
+import pkg_resources
 from setuptools import find_packages
 from setuptools import setup
 
@@ -49,7 +51,25 @@ tests_require = [
 
 if sys.version_info[:2] < (3, 4):
     tests_require.append('mock >= 1.0.1')
-    install_requires.append('enum34 >= 1.0.4, < 2')
+
+extras_require = {
+    ':python_version < "3.4"': ['enum34 >= 1.0.4, < 2']
+}
+
+
+try:
+    if 'bdist_wheel' not in sys.argv:
+        for key, value in extras_require.items():
+            if key.startswith(':') and pkg_resources.evaluate_marker(key[1:]):
+                install_requires.extend(value)
+except Exception:
+    logging.getLogger(__name__).exception(
+        'Something went wrong calculating platform specific dependencies, so '
+        "you're getting them all!"
+    )
+    for key, value in extras_require.items():
+        if key.startswith(':'):
+            install_requires.extend(value)
 
 
 setup(
@@ -63,6 +83,7 @@ setup(
     include_package_data=True,
     test_suite='nose.collector',
     install_requires=install_requires,
+    extras_require=extras_require,
     tests_require=tests_require,
     entry_points="""
     [console_scripts]