From 54dd40473c1f07ab6ba275c4c472a3087d46665c Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Tue, 5 Jun 2018 01:05:44 -0400 Subject: [PATCH 1/3] Disable json resolver and tweak vcs resolution Signed-off-by: Dan Ryan --- pipenv/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pipenv/utils.py b/pipenv/utils.py index 7aff3d3d09..242b9928bd 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -275,7 +275,7 @@ class PipCommand(basecommand.Command): pip_options, _ = pip_command.parse_args(pip_args) session = pip_command._build_session(pip_options) pypi = PyPIRepository( - pip_options=pip_options, use_json=True, session=session + pip_options=pip_options, use_json=False, session=session ) if verbose: logging.log.verbose = True @@ -1131,7 +1131,8 @@ def install_or_update_vcs(vcs_obj, src_dir, name, rev=None): target_rev = vcs_obj.make_rev_options(rev) if not os.path.exists(target_dir): vcs_obj.obtain(target_dir) - vcs_obj.update(target_dir, target_rev) + if not vcs_obj.is_commit_id_equal(target_dir, rev) and not vcs_obj.is_commit_id_equal(target_dir, target_rev): + vcs_obj.update(target_dir, target_rev) return vcs_obj.get_revision(target_dir) From c8f422853336e438debe322e12bf849d0d539621 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Tue, 5 Jun 2018 18:40:42 -0400 Subject: [PATCH 2/3] Fix resolver bug Signed-off-by: Dan Ryan --- pipenv/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipenv/core.py b/pipenv/core.py index 504ce47e0d..91e4771da5 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1484,7 +1484,7 @@ def pip_install( pre = '--pre' if pre else '' quoted_pip = which_pip(allow_global=allow_global) quoted_pip = escape_grouped_arguments(quoted_pip) - upgrade_strategy = '--upgrade --upgrade-strategy=to-satisfy-only' if selective_upgrade else '' + upgrade_strategy = '--upgrade --upgrade-strategy=only-if-needed' if selective_upgrade else '' pip_command = '{0} install {4} {5} {6} {7} {3} {1} {2} --exists-action w'.format( quoted_pip, install_reqs, From 157ebb1a6071f76d09ccfd488a442abd0cb43725 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Tue, 5 Jun 2018 23:54:38 -0400 Subject: [PATCH 3/3] Create temp src dir if not using environment Signed-off-by: Dan Ryan --- pipenv/utils.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pipenv/utils.py b/pipenv/utils.py index 242b9928bd..569feef314 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -1147,6 +1147,7 @@ def get_vcs_deps( dev=False, ): from .patched.notpip._internal.vcs import VcsSupport + from ._compat import TemporaryDirectory section = "vcs_dev_packages" if dev else "vcs_packages" lines = [] @@ -1155,10 +1156,14 @@ def get_vcs_deps( packages = getattr(project, section) except AttributeError: return [], [] - src_dir = Path( - os.environ.get("PIP_SRC", os.path.join(project.virtualenv_location, "src")) - ) - src_dir.mkdir(mode=0o775, exist_ok=True) + if not os.environ.get("PIP_SRC") and not project.virtualenv_location: + _src_dir = TemporaryDirectory(prefix='pipenv-', suffix='-src') + src_dir = Path(_src_dir.name) + else: + src_dir = Path( + os.environ.get("PIP_SRC", os.path.join(project.virtualenv_location, "src")) + ) + src_dir.mkdir(mode=0o775, exist_ok=True) vcs_registry = VcsSupport vcs_uri_map = { extract_uri_from_vcs_dep(v): {"name": k, "ref": v.get("ref")}