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

Drop pip9/Vendor and patch pip 10 #2255

Merged
merged 25 commits into from
May 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ec2a5c5
Update patches
techalchemy May 18, 2018
46a0e79
Delete vendored pip9
techalchemy May 18, 2018
e89072b
Update imports and vendor requirements
techalchemy May 18, 2018
5fe1389
Finalize tasks for pip10 upgrade
techalchemy May 18, 2018
9b5236e
Update tasks
techalchemy May 18, 2018
3231ec8
Vendor the right things
techalchemy May 18, 2018
d51938c
Ignore whitespace when patching
techalchemy May 18, 2018
01149ce
Use vendor scripts for import rewrites
techalchemy May 18, 2018
81ae262
Update to pip 10.0.1 and update imports
techalchemy May 18, 2018
028145f
Update pip vendoring requirements for licenses
techalchemy May 18, 2018
4047a1c
Update licenses
techalchemy May 18, 2018
406dce3
Drop vendored pip, update patched pip to pip 10
techalchemy May 18, 2018
50055f7
Bugfixes to set comparisons etc
techalchemy May 19, 2018
714c685
Update vendored pip
techalchemy May 19, 2018
3be5e82
Update vendored piptools
techalchemy May 19, 2018
db778f5
Update vendored libraries
techalchemy May 19, 2018
3807168
Update vendoring tasks and patches
techalchemy May 19, 2018
054f961
Patch packaging
techalchemy May 19, 2018
9cde62e
Fix patched libraries to use proper pip references
techalchemy May 20, 2018
effeb17
Add travis file and update patches for requests
techalchemy May 20, 2018
0437fff
Update piptools patch
techalchemy May 23, 2018
c8a5c24
Fix extras parsing for pip10
techalchemy May 23, 2018
708a057
Fix test import
techalchemy May 23, 2018
609bc8a
Fix pip vendoring patch
techalchemy May 24, 2018
4f8ef26
Remove travis file
techalchemy May 24, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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