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

Fix Pip-18 Incompatibilities #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 11 additions & 4 deletions important/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@

import pip

from pip.commands.show import search_packages_info
from pip.req import parse_requirements as pip_parse_requirements
try:
from pip.commands.show import search_packages_info
from pip.req import parse_requirements as pip_parse_requirements
except ImportError:
from pip._internal.commands.show import search_packages_info
from pip._internal.req import parse_requirements as pip_parse_requirements


RE_SHEBANG = re.compile('^#![^\n]*python[0-9]?$')
Expand Down Expand Up @@ -117,8 +121,11 @@ def parse_dir_imports(current_directory, exclusions=None):


def parse_requirements(filename):
requirements = pip_parse_requirements(filename,
session=pip.download.PipSession())
try:
pip_session = pip.download.PipSession()
except AttributeError:
pip_session = pip._internal.download.PipSession()
requirements = pip_parse_requirements(filename, session=pip_session)
for requirement in requirements:
if not requirement.name:
raise ValueError(
Expand Down