From 8cc5b5c28edb2c860933797bac1183b92a878912 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 8 Mar 2018 22:51:12 -0500 Subject: [PATCH 1/3] Fix new resolver code to uniqueify markers - Fixes #1617, #1622 --- pipenv/patched/piptools/resolver.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pipenv/patched/piptools/resolver.py b/pipenv/patched/piptools/resolver.py index d0aaa6e1..4e278018 100755 --- a/pipenv/patched/piptools/resolver.py +++ b/pipenv/patched/piptools/resolver.py @@ -307,6 +307,21 @@ class Resolver(object): ', '.join(sorted(dependency_strings, key=lambda s: s.lower())) or '-')) from pip._vendor.packaging.markers import InvalidMarker for dependency_string in dependency_strings: + individual_dependencies = [dep.strip() for dep in dependency_string.split(', ')] + cleaned_deps = [] + for dep in individual_dependencies: + tokens = [token.strip() for token in dep.split(';')] + cleaned_tokens = [] + markers = [] + if len(tokens) == 1: + cleaned_deps.append(tokens[0]) + continue + markers = list(set(tokens[1:])) + cleaned_tokens.append(tokens[0]) + if markers: + cleaned_tokens.extend(markers) + cleaned_deps.append('; '.join(cleaned_tokens)) + dependency_string = ', '.join(set(cleaned_deps)) yield InstallRequirement.from_line(dependency_string, constraint=ireq.constraint) From c229b785ada691bfa07ab74056b698452855e61d Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Fri, 9 Mar 2018 13:47:28 +0800 Subject: [PATCH 2/3] Display version warning only when python exists When there is no "python" command available, there's nothing to warn about. Fix #1619. --- pipenv/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipenv/core.py b/pipenv/core.py index f9405448..9c5a4c29 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -627,7 +627,7 @@ def ensure_project(three=None, python=None, validate=True, system=False, warn=Tr path_to_python = which('python') - if project.required_python_version not in (python_version(path_to_python) or ''): + if path_to_python and project.required_python_version not in (python_version(path_to_python) or ''): click.echo( '{0}: Your Pipfile requires {1} {2}, ' 'but you are using {3} ({4}).'.format( @@ -1767,7 +1767,7 @@ def do_install( except IOError: click.echo( crayons.red( - u'Unable to find requirements file at {0}.'.format(crayons.normal(requirements)) + u'Unable to find requirements file at {0}.'.format(crayons.normal(requirements)) ), err=True ) From 1ff79911a021fdf5b81f9343f414a18367e6b78b Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Fri, 9 Mar 2018 13:52:07 +0800 Subject: [PATCH 3/3] Consider py.exe when detecting wrong versions Related to #1620, I feel this is a nice addition. --- pipenv/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipenv/core.py b/pipenv/core.py index 9c5a4c29..7971b338 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -625,7 +625,7 @@ def ensure_project(three=None, python=None, validate=True, system=False, warn=Tr # Warn users if they are using the wrong version of Python. if project.required_python_version: - path_to_python = which('python') + path_to_python = which('python') or which('py') if path_to_python and project.required_python_version not in (python_version(path_to_python) or ''): click.echo(