From 6c66f96cacf542f1ff0f73a81375876429f60633 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Fri, 8 Dec 2017 18:54:08 -0500 Subject: [PATCH 1/3] Add failing windows test --- tests/test_pipenv.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_pipenv.py b/tests/test_pipenv.py index bd716c71..b05c7bf4 100644 --- a/tests/test_pipenv.py +++ b/tests/test_pipenv.py @@ -424,6 +424,22 @@ setup( assert 'urllib3' in p.lockfile['default'] assert 'certifi' in p.lockfile['default'] + @pytest.mark.install + @pytest.mark.pin + def test_windows_pinned_pipfile(self): + with PipenvInstance() as p: + with open(p.pipfile_path, 'w') as f: + contents = """ +[packages] +tablib = "<0.12" + """.strip() + f.write(contents) + c = p.pipenv(install) + assert c.return_code == 0 + assert 'tablib' in p.pipfile['packages'] + assert 'tablib' in p.lockfile['default'] + + @pytest.mark.run @pytest.mark.install def test_multiprocess_bug_and_install(self): From ef144482ba24d806eb4661cc5807153e2dc872dc Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Fri, 8 Dec 2017 20:14:52 -0500 Subject: [PATCH 2/3] Add a check to see if entries are valid specifiers - Should fix windows parsing of pipfiles - I had this fix implemented somewhere before but I think I 'cleaned' it out for some reason --- pipenv/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pipenv/utils.py b/pipenv/utils.py index 50ba449e..f433287b 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -869,6 +869,16 @@ def is_installable_file(path): path = urlparse(path['file']).path if 'file' in path else path['path'] if not isinstance(path, six.string_types) or path == '*': return False + # If the string starts with a valid specifier operator, test if it is a valid + # specifier set before making a path object (to avoid breakng windows) + if any(path.startswith(spec) for spec in '!=<>'): + try: + pip.utils.packaging.specifiers.SpecifierSet(path) + # If this is not a valid specifier, just move on and try it as a path + except pip.utils.packaging.specifiers.InvalidSpecifier: + pass + else: + return False lookup_path = Path(path) return lookup_path.is_file() or (lookup_path.is_dir() and pip.utils.is_installable_dir(lookup_path.resolve().as_posix())) From aac675235e2c8623bbb76f22cfa8c53d1b218786 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Fri, 8 Dec 2017 20:30:24 -0500 Subject: [PATCH 3/3] Fix test typo --- tests/test_pipenv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_pipenv.py b/tests/test_pipenv.py index b05c7bf4..78692429 100644 --- a/tests/test_pipenv.py +++ b/tests/test_pipenv.py @@ -434,7 +434,7 @@ setup( tablib = "<0.12" """.strip() f.write(contents) - c = p.pipenv(install) + c = p.pipenv('install') assert c.return_code == 0 assert 'tablib' in p.pipfile['packages'] assert 'tablib' in p.lockfile['default']