Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed build errors due to recent changes (homebrew/pip) #376

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
# See https://github.com/travis-ci/travis-ci/issues/4834, but
Expand Down
6 changes: 4 additions & 2 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
click
docker-py
PyYAML
requests
#PyYAML
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess these should be uncommented?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same file has requests>=2.20.0 and pyyaml>=4.2b1 below which may lead to double requirements issues. 🤔

#requests
retrying
six
tqdm

scrapinghub>=2.0.3

pip<19.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that in the recent pip, the main function was moved from pip._internal.init to pip._internal.main. It's not the best idea to rely on such internal functions, but I'd say there's a simpler way to fix this without restrictions on pip version

try:
    from pip import main as pip_main
except:
    try:
        from pip._internal.main import main as pip_main
    except:
        from pip._internal import main as pip_main

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is good observation! I should have looked into this. Though I'm not sure for now how to write tests for this. 😅


# address known vulnerabilities
requests>=2.20.0 # CVE-2018-18074
pyyaml>=4.2b1 # CVE-2017-18342
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
install_requires=[
'click',
'docker-py',
'pip',
'pip<19.3',
'PyYAML',
'retrying',
'requests',
Expand Down
6 changes: 5 additions & 1 deletion shub/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down