diff --git a/Makefile b/Makefile index 8edaf7bd969a1b9e1018a7b92ded39af27fd6955..ebc9d9d7e4c52e718855d3ce2857b0c7f054dfd6 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,8 @@ COVER_PACKAGES=hbp_nrp_virtual_coach DOC_MODULES=hbp_nrp_virtual_coach/doc DOC_REPO=--doc-repo ssh://bbpcode.epfl.ch/infra/jekylltest +PYTHON_PIP_VERSION?=pip==9.0.3 + ##### DO NOT MODIFY BELOW ##################### ifeq ($(NRP_INSTALL_MODE),user) diff --git a/hbp_nrp_virtual_coach/setup.py b/hbp_nrp_virtual_coach/setup.py index ad2d499354ffdd43084e15bd437676809763f818..1bab64006a93d94deda77718f2ef5e8dc5ce28bb 100644 --- a/hbp_nrp_virtual_coach/setup.py +++ b/hbp_nrp_virtual_coach/setup.py @@ -10,25 +10,33 @@ except ImportError: import hbp_nrp_virtual_coach import pip -from pip.req import parse_requirements from optparse import Option options = Option('--workaround') options.skip_requirements_regex = None reqs_file = './requirements.txt' # Hack for old pip versions -# Versions greater than 1.x have a required parameter "session" in -# parse_requirements -if pip.__version__.startswith('1.'): +if pip.__version__.startswith('10.'): + # Versions greater or equal to 10.x don't rely on pip.req.parse_requirements + install_reqs = list(val.strip() for val in open(reqs_file)) + reqs = install_reqs +elif pip.__version__.startswith('1.'): + # Versions 1.x rely on pip.req.parse_requirements + # but don't require a "session" parameter + from pip.req import parse_requirements # pylint:disable=no-name-in-module, import-error install_reqs = parse_requirements(reqs_file, options=options) + reqs = [str(ir.req) for ir in install_reqs] else: - from pip.download import PipSession # pylint:disable=no-name-in-module + # Versions greater than 1.x but smaller than 10.x rely on pip.req.parse_requirements + # and requires a "session" parameter + from pip.req import parse_requirements # pylint:disable=no-name-in-module, import-error + from pip.download import PipSession # pylint:disable=no-name-in-module, import-error options.isolated_mode = False install_reqs = parse_requirements( # pylint:disable=unexpected-keyword-arg reqs_file, session=PipSession, options=options ) -reqs = [str(ir.req) for ir in install_reqs] + reqs = [str(ir.req) for ir in install_reqs] config = { 'description': 'Virtual Coach command-line Neurorobotics Platform interface for HBP SP10',