diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 48175a72..46b2e799 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,4 +1,5 @@ steps: - label: ":python:" commands: + # - make - ./run-tests.sh \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index af7ab55b..d7fa45c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,8 +3,8 @@ Before opening any issues or proposing any pull requests, please do the following: -1. Read our [Contributor's Guide](http://docs.pipenv.org/en/latest/dev/contributing/). -2. Understand our [development philosophy](http://docs.pipenv.org/en/latest/dev/philosophy/). +1. Read our [Contributor's Guide](https://docs.pipenv.org/dev/contributing/). +2. Understand our [development philosophy](https://docs.pipenv.org/dev/philosophy/). To get the greatest chance of helpful responses, please also observe the following additional notes. diff --git a/Dockerfile b/Dockerfile index 4bab57e2..ccf35a6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,7 @@ -FROM ubuntu:17.10 +FROM ubuntu:18.04 # -- Install Pipenv: -RUN apt-get update \ - && apt-get install software-properties-common python-software-properties -y \ - && add-apt-repository ppa:pypa/ppa -y \ - && apt-get update \ - && apt-get install git pipenv -y +RUN apt update && apt install python3-pip -y && pip3 install pipenv ENV LC_ALL C.UTF-8 ENV LANG C.UTF-8 diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..51b267c5 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +test: + docker-compose up \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..1fede25a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: '3' +services: + pipenv-tests: + image: kennethreitz/pipenv-tests + command: bash /pipenv/run-tests.sh + volumes: + - .:/pipenv diff --git a/pipenv/patched/piptools/utils.py b/pipenv/patched/piptools/utils.py index db8bb9b3..f3de3dd3 100644 --- a/pipenv/patched/piptools/utils.py +++ b/pipenv/patched/piptools/utils.py @@ -58,6 +58,36 @@ def make_install_requirement(name, version, extras, markers, constraint=False): constraint=constraint) +def _requirement_to_str_lowercase_name(requirement): + """ + Formats a packaging.requirements.Requirement with a lowercase name. + + This is simply a copy of + https://github.com/pypa/packaging/blob/16.8/packaging/requirements.py#L109-L124 + modified to lowercase the dependency name. + + Previously, we were invoking the original Requirement.__str__ method and + lowercasing the entire result, which would lowercase the name, *and* other, + important stuff that should not be lowercased (such as the marker). See + this issue for more information: https://github.com/pypa/pipenv/issues/2113. + """ + parts = [requirement.name.lower()] + + if requirement.extras: + parts.append("[{0}]".format(",".join(sorted(requirement.extras)))) + + if requirement.specifier: + parts.append(str(requirement.specifier)) + + if requirement.url: + parts.append("@ {0}".format(requirement.url)) + + if requirement.marker: + parts.append("; {0}".format(requirement.marker)) + + return "".join(parts) + + def format_requirement(ireq, marker=None): """ Generic formatter for pretty printing InstallRequirements to the terminal @@ -66,7 +96,7 @@ def format_requirement(ireq, marker=None): if ireq.editable: line = '-e {}'.format(ireq.link) else: - line = str(ireq.req).lower() + line = _requirement_to_str_lowercase_name(ireq.req) if marker: line = '{}; {}'.format(line, marker) diff --git a/tests/integration/test_install_markers.py b/tests/integration/test_install_markers.py index 87235d4a..9e3fa1d2 100644 --- a/tests/integration/test_install_markers.py +++ b/tests/integration/test_install_markers.py @@ -33,6 +33,26 @@ tablib = {version = "*", markers="os_name=='splashwear'"} c = p.pipenv('run python -c "import tablib;"') assert c.return_code == 1 +@pytest.mark.markers +@flaky +def test_platform_python_implementation_marker(PipenvInstance, pypi): + """Markers should be converted during locking to help users who input this incorrectly + """ + with PipenvInstance(pypi=pypi) as p: + with open(p.pipfile_path, 'w') as f: + contents = """ +[packages] +depends-on-marked-package = "*" + """.strip() + f.write(contents) + + c = p.pipenv('install') + assert c.return_code == 0 + + # depends-on-marked-package has an install_requires of 'pytz; platform_python_implementation=="CPython"' + # Verify that that marker shows up in our lockfile unaltered. + assert p.lockfile['default']['pytz']['markers'] == "platform_python_implementation == 'CPython'" + @pytest.mark.run @pytest.mark.alt diff --git a/tests/pypi/depends-on-marked-package/depends_on_marked_package-0.0.1-py2.py3-none-any.whl b/tests/pypi/depends-on-marked-package/depends_on_marked_package-0.0.1-py2.py3-none-any.whl new file mode 100644 index 00000000..d320deb3 Binary files /dev/null and b/tests/pypi/depends-on-marked-package/depends_on_marked_package-0.0.1-py2.py3-none-any.whl differ