From 074f7a805e64998829b7d3ef94890f9c68743c03 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Sun, 26 Feb 2017 10:01:23 +0000 Subject: [PATCH] Build a universal Python wheel instead of per-python-version ones. Fixes #2210 --- pkg/pip/build.sh | 2 +- pkg/pip/setup_pip.py | 12 +++++++++++- requirements.txt | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pkg/pip/build.sh b/pkg/pip/build.sh index 4c524c92a..3ceaec4f7 100755 --- a/pkg/pip/build.sh +++ b/pkg/pip/build.sh @@ -93,7 +93,7 @@ echo recursive-include pgadmin4 \* > pip-build/MANIFEST.in # Run the build echo Building wheel... cd pip-build -python ../pkg/pip/setup_pip.py bdist_wheel +python ../pkg/pip/setup_pip.py bdist_wheel --universal cd ../ # Get the build diff --git a/pkg/pip/setup_pip.py b/pkg/pip/setup_pip.py index 8b396fe06..740d6552b 100644 --- a/pkg/pip/setup_pip.py +++ b/pkg/pip/setup_pip.py @@ -24,6 +24,12 @@ with open(req_file) as reqf: else: required = reqf.read().decode("utf-8").splitlines() +# Remove any requirements with environment specifiers. These +# must be explicitly listed in extras_require below. +for req in required: + if ";" in req: + required.remove(req) + # Get the app version modl = imp.load_source('APP_VERSION', '../web/config.py') @@ -70,7 +76,11 @@ setup( install_requires=required, - ##extras_require=, + extras_require={ + # ... + ":python_version<'2.7'": ["ordereddict"], + ":python_version<='2.7'": ["importlib"], + }, # Specify date files to be included. For Python 2.6 need to include them in MANIFEST.in ##package_data="", diff --git a/requirements.txt b/requirements.txt index 67f01c846..d470e1ef3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ +# NOTE: Any requirements with environment specifiers must be explicitly added +# to pkg/pip/setup_pip.py (in extras_require), otherwise they will be +# ignored when building a PIP Wheel. Babel==1.3 beautifulsoup4==4.4.1 blinker==1.3