Skip to content

Commit 70a6b15

Browse files
committed
Fix pipenv install to successfully use pip9
Signed-off-by: Dan Ryan <[email protected]>
1 parent 3c675bd commit 70a6b15

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

pipenv/core.py

+21-18
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ def do_lock(
10581058
# TODO: be smarter about this.
10591059
vcs_deps = convert_deps_to_pip(project.vcs_dev_packages, project, r=False)
10601060
pip_freeze = delegator.run(
1061-
'{0} -m pipenv.vendor.pip9 freeze'.format(escape_grouped_arguments(which('python', allow_global=system)))
1061+
'{0} -m pip freeze'.format(escape_grouped_arguments(which('python', allow_global=system)))
10621062
).out
10631063
if vcs_deps:
10641064
for line in pip_freeze.strip().split('\n'):
@@ -1123,7 +1123,7 @@ def do_lock(
11231123
# Add refs for VCS installs.
11241124
# TODO: be smarter about this.
11251125
vcs_deps = convert_deps_to_pip(project.vcs_packages, project, r=False)
1126-
pip_freeze = delegator.run('{0} -m pipenv.vendor.pip9 freeze'.format(which('python', allow_global=system))).out
1126+
pip_freeze = delegator.run('{0} -m pip freeze'.format(which('python', allow_global=system))).out
11271127
for dep in vcs_deps:
11281128
for line in pip_freeze.strip().split('\n'):
11291129
try:
@@ -1226,7 +1226,7 @@ def do_purge(bare=False, downloads=False, allow_global=False, verbose=False):
12261226
return
12271227

12281228
freeze = delegator.run(
1229-
'{0} -m pipenv.vendor.pip9 freeze'.format(
1229+
'{0} -m pip freeze'.format(
12301230
escape_grouped_arguments(which('python', allow_global=allow_global))
12311231
)
12321232
).out
@@ -1258,7 +1258,7 @@ def do_purge(bare=False, downloads=False, allow_global=False, verbose=False):
12581258
len(actually_installed)
12591259
)
12601260
)
1261-
command = '{0} -m pipenv.vendor.pip9 uninstall {1} -y'.format(
1261+
command = '{0} -m pip uninstall {1} -y'.format(
12621262
escape_grouped_arguments(which('python', allow_global=allow_global)),
12631263
' '.join(actually_installed),
12641264
)
@@ -1459,19 +1459,22 @@ def pip_install(
14591459
quoted_python = which('python', allow_global=allow_global)
14601460
quoted_python = escape_grouped_arguments(quoted_python)
14611461
upgrade_strategy = '--upgrade --upgrade-strategy=only-if-needed' if selective_upgrade else ''
1462-
pip_command = '{0} -m pipenv.vendor.pip9 install {4} {5} {6} {7} {3} {1} {2} --exists-action w'.format(
1463-
quoted_python,
1464-
install_reqs,
1465-
' '.join(prepare_pip_source_args(sources)),
1466-
no_deps,
1467-
pre,
1468-
src,
1469-
verbose_flag,
1470-
upgrade_strategy,
1471-
)
1472-
if verbose:
1473-
click.echo('$ {0}'.format(pip_command), err=True)
1474-
c = delegator.run(pip_command, block=block)
1462+
with temp_environ():
1463+
from . import PIPENV_VENDOR, PIPENV_PATCHED
1464+
os.environ['PYTHONPATH'] = os.pathsep.join([PIPENV_VENDOR, PIPENV_PATCHED])
1465+
pip_command = '{0} -m pip9 install {4} {5} {6} {7} {3} {1} {2} --exists-action w'.format(
1466+
quoted_python,
1467+
install_reqs,
1468+
' '.join(prepare_pip_source_args(sources)),
1469+
no_deps,
1470+
pre,
1471+
src,
1472+
verbose_flag,
1473+
upgrade_strategy,
1474+
)
1475+
if verbose:
1476+
click.echo('$ {0}'.format(pip_command), err=True)
1477+
c = delegator.run(pip_command, block=block)
14751478
return c
14761479

14771480

@@ -2074,7 +2077,7 @@ def do_uninstall(
20742077
sys.exit(1)
20752078
for package_name in package_names:
20762079
click.echo(u'Un-installing {0}…'.format(crayons.green(package_name)))
2077-
cmd = '"{0}" -m pipenv.vendor.pip9 uninstall {1} -y'.format(
2080+
cmd = '"{0}" -m pip uninstall {1} -y'.format(
20782081
which('python', allow_global=system), package_name
20792082
)
20802083
if verbose:

0 commit comments

Comments
 (0)