From 939a6c13bfa52056cbd96d363ea3096dc4c72ff6 Mon Sep 17 00:00:00 2001 From: frostming Date: Tue, 18 Feb 2020 16:34:14 +0800 Subject: [PATCH 1/3] Fix a bug about python_version parsing --- news/38.bugfix | 1 + pdm/models/markers.py | 5 +++-- pdm/models/specifiers.py | 2 +- tests/models/test_requirements.py | 5 +++++ 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 news/38.bugfix diff --git a/news/38.bugfix b/news/38.bugfix new file mode 100644 index 0000000000..5874276cfc --- /dev/null +++ b/news/38.bugfix @@ -0,0 +1 @@ +Fix a bug that short python_version markers can't be parsed correctly. diff --git a/pdm/models/markers.py b/pdm/models/markers.py index 2ea4d65fdc..1aa61f14c7 100644 --- a/pdm/models/markers.py +++ b/pdm/models/markers.py @@ -144,11 +144,12 @@ def split_version(version): if key == "python_version": if op == ">": int_versions = [int(ver) for ver in version.split(".")] - int_versions += 1 + int_versions[-1] += 1 version = ".".join(str(v) for v in int_versions) op = ">=" elif op in ("==", "!="): - version += ".*" + if len(version.split(".")) < 3: + version += ".*" elif op in ("in", "not in"): version = " ".join(v + ".*" for v in split_version(version)) if op == "in": diff --git a/pdm/models/specifiers.py b/pdm/models/specifiers.py index ed527127df..0cf5b2f4f1 100644 --- a/pdm/models/specifiers.py +++ b/pdm/models/specifiers.py @@ -38,7 +38,7 @@ def bump_version( def _complete_version( version: Tuple[int, ...], complete_with: int = 0 ) -> Tuple[int, ...]: - assert len(version) <= 3 + assert len(version) <= 3, version return version + (3 - len(version)) * (complete_with,) diff --git a/tests/models/test_requirements.py b/tests/models/test_requirements.py index 7bd5e60e02..67cc813fd2 100644 --- a/tests/models/test_requirements.py +++ b/tests/models/test_requirements.py @@ -72,6 +72,11 @@ ), f"demo[security] @ {FILE_PREFIX}" + (FIXTURES / "projects/demo").as_posix(), ), + ( + 'requests; python_version=="3.7.*"', + ("requests", {"version": "*", "marker": 'python_version == "3.7.*"'}), + 'requests; python_version == "3.7.*"' + ) ] From d6c63fa64c71920d8b126e08d95825d26dbd4496 Mon Sep 17 00:00:00 2001 From: frostming Date: Tue, 18 Feb 2020 16:52:19 +0800 Subject: [PATCH 2/3] blackened --- pdm/__init__.py | 2 +- tests/models/test_requirements.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pdm/__init__.py b/pdm/__init__.py index d3ec452c31..3ced3581bb 100644 --- a/pdm/__init__.py +++ b/pdm/__init__.py @@ -1 +1 @@ -__version__ = "0.2.0" +__version__ = "0.2.1" diff --git a/tests/models/test_requirements.py b/tests/models/test_requirements.py index 67cc813fd2..cfc36b9244 100644 --- a/tests/models/test_requirements.py +++ b/tests/models/test_requirements.py @@ -75,8 +75,8 @@ ( 'requests; python_version=="3.7.*"', ("requests", {"version": "*", "marker": 'python_version == "3.7.*"'}), - 'requests; python_version == "3.7.*"' - ) + 'requests; python_version == "3.7.*"', + ), ] From b236d5feb94c41e8e71a91ade0843b5d9fbc0ad1 Mon Sep 17 00:00:00 2001 From: frostming Date: Tue, 18 Feb 2020 16:55:58 +0800 Subject: [PATCH 3/3] update CHANGELOG.md --- CHANGELOG.md | 9 +++++++++ news/38.bugfix | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) delete mode 100644 news/38.bugfix diff --git a/CHANGELOG.md b/CHANGELOG.md index 05bd7da577..fd865db5cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +Release v0.2.1 (2020-02-18) +--------------------------- + +### Bug Fixes + +- Fix a bug that short python_version markers can't be parsed correctly. [#38](https://github.com/frostming/pdm/issues/38) +- Make `_editable_intall.py` compatible with Py2. + + Release v0.2.0 (2020-02-14) --------------------------- diff --git a/news/38.bugfix b/news/38.bugfix deleted file mode 100644 index 5874276cfc..0000000000 --- a/news/38.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix a bug that short python_version markers can't be parsed correctly.