From 66a604e12aa7d6f37c7c985d7d9ba035ccadba6a Mon Sep 17 00:00:00 2001 From: Pengyu Chen Date: Fri, 25 Oct 2019 00:41:15 +0100 Subject: [PATCH 1/4] Fixed build error due to recent homebrew update --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e8941654..457b48c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,8 @@ branches: before_install: | if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then # From https://pythonhosted.org/CodeChat/.travis.yml.html - brew install pyenv-virtualenv + # Homebrew currently fails after updating. See also: https://discuss.circleci.com/t/brew-install-fails-while-updating/32992/4 + HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv-virtualenv eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)" # See https://github.com/travis-ci/travis-ci/issues/4834, but From e7116eb2a6026e137d6cd07666c46090007027bf Mon Sep 17 00:00:00 2001 From: Pengyu Chen Date: Fri, 25 Oct 2019 00:56:34 +0100 Subject: [PATCH 2/4] Specifying "2.7.9" (relatively newer) instead of "2.7" in travis config since pyenv may seriously install Python 2.7.0 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 457b48c8..ca82befa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ matrix: language: generic env: - TOX_ENV=py27 - - PYTHON_VERSION='2.7' + - PYTHON_VERSION='2.7.9' - os: osx language: generic env: From 7935ad5c8ad595de1d751cece67c6bfea9f67dbb Mon Sep 17 00:00:00 2001 From: Pengyu Chen Date: Fri, 25 Oct 2019 18:10:15 +0100 Subject: [PATCH 3/4] Requesting pip<19.3 for now due to incompatibility (pip._internal.main no longer callable) --- requirements.in | 6 ++++-- requirements.txt | 3 +++ setup.py | 2 +- shub/utils.py | 2 ++ tests/test_utils.py | 4 ++++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index 3ac4583b..22932550 100644 --- a/requirements.in +++ b/requirements.in @@ -1,13 +1,15 @@ click docker-py -PyYAML -requests +#PyYAML +#requests retrying six tqdm scrapinghub>=2.0.3 +pip<19.3 + # address known vulnerabilities requests>=2.20.0 # CVE-2018-18074 pyyaml>=4.2b1 # CVE-2017-18342 diff --git a/requirements.txt b/requirements.txt index a2bba22e..68744217 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,3 +20,6 @@ six==1.10.0 tqdm==4.11.2 urllib3==1.25.3 # via requests websocket-client==0.37.0 # via docker-py + +# The following packages are considered to be unsafe in a requirements file: +# pip==19.2.3 diff --git a/setup.py b/setup.py index 01abbe29..b11d9fff 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ install_requires=[ 'click', 'docker-py', - 'pip', + 'pip<19.3', 'PyYAML', 'retrying', 'requests', diff --git a/shub/utils.py b/shub/utils.py index 6a988ed1..f7e9b7ef 100644 --- a/shub/utils.py +++ b/shub/utils.py @@ -637,6 +637,8 @@ def download_from_pypi(dest, pkg=None, reqfile=None, extra_args=None): no_wheel = ['--no-binary=:all:'] if pip_version >= LooseVersion('8'): cmd = 'download' + if pip_version >= LooseVersion('19.3'): + raise NotImplementedError('Expecting pip<19.3') with patch_sys_executable(): pip_main([cmd, '-d', dest, '--no-deps'] + no_wheel + extra_args + target) diff --git a/tests/test_utils.py b/tests/test_utils.py index cbdc3f49..72b88f63 100755 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -371,6 +371,10 @@ def _call(*args, **kwargs): pipargs = _call('tmpdir', reqfile='req.txt') self.assertEqual(pipargs.index('-r') + 1, pipargs.index('req.txt')) + # pip>=19.3 shall be unsupported for now + mock_pip.__version__ = '19.3' + self.assertRaises(NotImplementedError, _call, ['tmpdir'], {'pkg': 'shub'}) + # Replace deprecated commands in newer versions mock_pip.__version__ = '7.1.2.dev0' pipargs = _call('tmpdir', pkg='shub') From 97acf9f549922acc8f5c98956fd59e7326cc3581 Mon Sep 17 00:00:00 2001 From: Pengyu Chen Date: Mon, 18 Nov 2019 15:10:31 +0800 Subject: [PATCH 4/4] Removed the pip<19.3 constraint --- shub/utils.py | 8 +++++--- tests/test_utils.py | 4 ---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/shub/utils.py b/shub/utils.py index f7e9b7ef..70d305e6 100644 --- a/shub/utils.py +++ b/shub/utils.py @@ -28,7 +28,11 @@ try: from pip import main as pip_main except: - from pip._internal import main as pip_main + try: + # pip>=19.3 + from pip._internal.main import main as pip_main + except ImportError: + from pip._internal import main as pip_main from scrapinghub import ScrapinghubClient, ScrapinghubAPIError, HubstorageClient @@ -637,8 +641,6 @@ def download_from_pypi(dest, pkg=None, reqfile=None, extra_args=None): no_wheel = ['--no-binary=:all:'] if pip_version >= LooseVersion('8'): cmd = 'download' - if pip_version >= LooseVersion('19.3'): - raise NotImplementedError('Expecting pip<19.3') with patch_sys_executable(): pip_main([cmd, '-d', dest, '--no-deps'] + no_wheel + extra_args + target) diff --git a/tests/test_utils.py b/tests/test_utils.py index 72b88f63..cbdc3f49 100755 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -371,10 +371,6 @@ def _call(*args, **kwargs): pipargs = _call('tmpdir', reqfile='req.txt') self.assertEqual(pipargs.index('-r') + 1, pipargs.index('req.txt')) - # pip>=19.3 shall be unsupported for now - mock_pip.__version__ = '19.3' - self.assertRaises(NotImplementedError, _call, ['tmpdir'], {'pkg': 'shub'}) - # Replace deprecated commands in newer versions mock_pip.__version__ = '7.1.2.dev0' pipargs = _call('tmpdir', pkg='shub')