Skip to content

Commit

Permalink
Merge pull request #39 from frostming/bugfix/38
Browse files Browse the repository at this point in the history
Fix a bug about python_version parsing
  • Loading branch information
frostming authored Feb 18, 2020
2 parents f56b493 + b236d5f commit 4b76a38
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
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

0 comments on commit 4b76a38

Please sign in to comment.