Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug about python_version parsing #39

Merged
merged 3 commits into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
---------------------------

Expand Down
2 changes: 1 addition & 1 deletion pdm/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.0"
__version__ = "0.2.1"
5 changes: 3 additions & 2 deletions pdm/models/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
2 changes: 1 addition & 1 deletion pdm/models/specifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,)


Expand Down
5 changes: 5 additions & 0 deletions tests/models/test_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.*"',
),
]


Expand Down