Skip to content

Commit

Permalink
Merge pull request #2255 from pypa/drop-pip9
Browse files Browse the repository at this point in the history
Drop pip9/Vendor and patch pip 10
  • Loading branch information
techalchemy authored May 24, 2018
2 parents a250ff7 + 4f8ef26 commit 594757f
Show file tree
Hide file tree
Showing 515 changed files with 10,422 additions and 117,360 deletions.
3 changes: 2 additions & 1 deletion pipenv/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
pass_context,
Option,
version_option,
BadParameter,
)
from click_completion import init as init_completion
from click_completion import get_code
Expand Down Expand Up @@ -75,7 +76,7 @@ def validate_python_path(ctx, param, value):
# we'll report absolute paths which do not exist:
if isinstance(value, (str, bytes)):
if os.path.isabs(value) and not os.path.isfile(value):
raise click.BadParameter('Expected Python at path %s does not exist' % value)
raise BadParameter('Expected Python at path %s does not exist' % value)
return value


Expand Down
28 changes: 15 additions & 13 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ def cleanup_virtualenv(bare=True):


def import_requirements(r=None, dev=False):
import pip9
from .vendor.pip9.req.req_file import parse_requirements
from .patched.notpip._vendor import requests as pip_requests
from .patched.notpip._internal.req.req_file import parse_requirements

# Parse requirements.txt file with Pip's parser.
# Pip requires a `PipSession` which is a subclass of requests.Session.
Expand All @@ -209,7 +209,7 @@ def import_requirements(r=None, dev=False):
for line in contents.split('\n'):
if line.startswith(('-i ', '--index ', '--index-url ')):
indexes.append(line.split()[1])
reqs = [f for f in parse_requirements(r, session=pip9._vendor.requests)]
reqs = [f for f in parse_requirements(r, session=pip_requests)]
for package in reqs:
if package.name not in BAD_PACKAGES:
if package.link is not None:
Expand Down Expand Up @@ -410,7 +410,8 @@ def abort():
sys.exit(1)

def activate_pyenv():
import pip9
import notpip
from notpip._vendor.packaging.version import parse as parse_version

"""Adds all pyenv installations to the PATH."""
if PYENV_INSTALLED:
Expand All @@ -423,7 +424,7 @@ def activate_pyenv():
found, os.sep
)
for version_str, pyenv_path in pyenv_paths.items():
version = pip9._vendor.packaging.version.parse(version_str)
version = parse_version(version_str)
if version.is_prerelease and pyenv_paths.get(
version.base_version
):
Expand Down Expand Up @@ -1001,9 +1002,9 @@ def do_lock(
write=True,
):
"""Executes the freeze functionality."""
from notpip._vendor.distlib.markers import Evaluator
from .utils import get_vcs_deps
allowed_marker_keys = ['markers'] + [k for k in Evaluator.allowed_values.keys()]
from notpip._vendor.distlib.markers import DEFAULT_CONTEXT as marker_context
allowed_marker_keys = ['markers'] + [k for k in marker_context.keys()]
cached_lockfile = {}
if not pre:
pre = project.settings.get('allow_prereleases')
Expand Down Expand Up @@ -1393,14 +1394,15 @@ def pip_install(
requirements_dir=None,
extra_indexes=None,
):
import pip9
from notpip._internal import logger as piplogger
from notpip._vendor.pyparsing import ParseException

if verbose:
click.echo(
crayons.normal('Installing {0!r}'.format(package_name), bold=True),
err=True,
)
pip9.logger.setLevel(logging.INFO)
piplogger.setLevel(logging.INFO)
# Create files for hash mode.
if not package_name.startswith('-e ') and (not ignore_hashes) and (
r is None
Expand All @@ -1415,7 +1417,7 @@ def pip_install(
req = get_requirement(
package_name.split('--hash')[0].split('--trusted-host')[0]
).vcs
except (pip9._vendor.pyparsing.ParseException, ValueError) as e:
except (ParseException, ValueError) as e:
click.echo('{0}: {1}'.format(crayons.red('WARNING'), e), err=True)
click.echo(
'{0}... You will have to reinstall any packages that failed to install.'.format(
Expand Down Expand Up @@ -1516,7 +1518,7 @@ def pip_download(package_name):


def which_pip(allow_global=False):
"""Returns the location of virtualenv-installed pip9."""
"""Returns the location of virtualenv-installed pip."""
if allow_global:
if 'VIRTUAL_ENV' in os.environ:
return which('pip', location=os.environ['VIRTUAL_ENV'])
Expand Down Expand Up @@ -1756,7 +1758,7 @@ def do_install(
keep_outdated=False,
selective_upgrade=False,
):
import pip9
from notpip._internal.exceptions import PipError

requirements_directory = TemporaryDirectory(
suffix='-requirements', prefix='pipenv-'
Expand Down Expand Up @@ -1839,7 +1841,7 @@ def do_install(
)
try:
import_requirements(r=project.path_to(requirements), dev=dev)
except (UnicodeDecodeError, pip9.exceptions.PipError) as e:
except (UnicodeDecodeError, PipError) as e:
# Don't print the temp file path if remote since it will be deleted.
req_path = requirements_url if remote else project.path_to(
requirements
Expand Down
40 changes: 20 additions & 20 deletions pipenv/patched/notpip/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Copyright (c) 2008-2016 The pip developers (see AUTHORS.txt file)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2008-2016 The pip developers (see AUTHORS.txt file)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 594757f

Please sign in to comment.