From ac6aaa3f0b065c7aea03c6f60371806c267f7d7a Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Mon, 14 May 2018 10:25:03 -0700 Subject: Install futures package only on Python 2 --- requirements.txt | 1 - src/python/grpcio_tests/setup.py | 5 ++++- tools/run_tests/artifacts/build_artifact_python.sh | 6 ++++++ tools/run_tests/helper_scripts/build_python.sh | 8 +++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 53768c6822..0a7f2e8601 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ coverage>=4.0 cython>=0.27 enum34>=1.0.4 -futures>=2.2.0 protobuf>=3.5.0.post1 six>=1.10 wheel>=0.29 diff --git a/src/python/grpcio_tests/setup.py b/src/python/grpcio_tests/setup.py index 98ac19d188..1262e48571 100644 --- a/src/python/grpcio_tests/setup.py +++ b/src/python/grpcio_tests/setup.py @@ -37,13 +37,16 @@ PACKAGE_DIRECTORIES = { } INSTALL_REQUIRES = ( - 'coverage>=4.0', 'enum34>=1.0.4', 'futures>=2.2.0', + 'coverage>=4.0', 'enum34>=1.0.4', 'grpcio>={version}'.format(version=grpc_version.VERSION), 'grpcio-tools>={version}'.format(version=grpc_version.VERSION), 'grpcio-health-checking>={version}'.format(version=grpc_version.VERSION), 'oauth2client>=1.4.7', 'protobuf>=3.5.2.post1', 'six>=1.10', 'google-auth>=1.0.0', 'requests>=2.14.2') +if not PY3: + INSTALL_REQUIRES += ('futures>=2.2.0',) + COMMAND_CLASS = { # Run `preprocess` *before* doing any packaging! 'preprocess': commands.GatherProto, diff --git a/tools/run_tests/artifacts/build_artifact_python.sh b/tools/run_tests/artifacts/build_artifact_python.sh index cd794a1391..846a415396 100755 --- a/tools/run_tests/artifacts/build_artifact_python.sh +++ b/tools/run_tests/artifacts/build_artifact_python.sh @@ -90,6 +90,12 @@ fi if [ "$GRPC_BUILD_GRPCIO_TOOLS_DEPENDENTS" != "" ] then "${PIP}" install -rrequirements.txt + + if [ "$("$PYTHON" -c "import sys; print(sys.version_info[0])")" == "2" ] + then + "${PIP}" install futures>=2.2.0 + fi + "${PIP}" install grpcio --no-index --find-links "file://$ARTIFACT_DIR/" "${PIP}" install grpcio-tools --no-index --find-links "file://$ARTIFACT_DIR/" diff --git a/tools/run_tests/helper_scripts/build_python.sh b/tools/run_tests/helper_scripts/build_python.sh index cdcb2aa116..c2a506afd8 100755 --- a/tools/run_tests/helper_scripts/build_python.sh +++ b/tools/run_tests/helper_scripts/build_python.sh @@ -157,7 +157,13 @@ esac $VENV_PYTHON -m pip install --upgrade pip==10.0.1 $VENV_PYTHON -m pip install setuptools $VENV_PYTHON -m pip install cython -$VENV_PYTHON -m pip install six enum34 protobuf futures +$VENV_PYTHON -m pip install six enum34 protobuf + +if [ "$("$VENV_PYTHON" -c "import sys; print(sys.version_info[0])")" == "2" ] +then + $VENV_PYTHON -m pip install futures +fi + pip_install_dir "$ROOT" $VENV_PYTHON "$ROOT/tools/distrib/python/make_grpcio_tools.py" -- cgit v1.2.3