Skip to content

Commit 4b76a38

Browse files
authored
Merge pull request #39 from frostming/bugfix/38
Fix a bug about python_version parsing
2 parents f56b493 + b236d5f commit 4b76a38

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Release v0.2.1 (2020-02-18)
2+
---------------------------
3+
4+
### Bug Fixes
5+
6+
- Fix a bug that short python_version markers can't be parsed correctly. [#38](https://github.com/frostming/pdm/issues/38)
7+
- Make `_editable_intall.py` compatible with Py2.
8+
9+
110
Release v0.2.0 (2020-02-14)
211
---------------------------
312

pdm/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.0"
1+
__version__ = "0.2.1"

pdm/models/markers.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,12 @@ def split_version(version):
144144
if key == "python_version":
145145
if op == ">":
146146
int_versions = [int(ver) for ver in version.split(".")]
147-
int_versions += 1
147+
int_versions[-1] += 1
148148
version = ".".join(str(v) for v in int_versions)
149149
op = ">="
150150
elif op in ("==", "!="):
151-
version += ".*"
151+
if len(version.split(".")) < 3:
152+
version += ".*"
152153
elif op in ("in", "not in"):
153154
version = " ".join(v + ".*" for v in split_version(version))
154155
if op == "in":

pdm/models/specifiers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def bump_version(
3838
def _complete_version(
3939
version: Tuple[int, ...], complete_with: int = 0
4040
) -> Tuple[int, ...]:
41-
assert len(version) <= 3
41+
assert len(version) <= 3, version
4242
return version + (3 - len(version)) * (complete_with,)
4343

4444

tests/models/test_requirements.py

+5
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@
7272
),
7373
f"demo[security] @ {FILE_PREFIX}" + (FIXTURES / "projects/demo").as_posix(),
7474
),
75+
(
76+
'requests; python_version=="3.7.*"',
77+
("requests", {"version": "*", "marker": 'python_version == "3.7.*"'}),
78+
'requests; python_version == "3.7.*"',
79+
),
7580
]
7681

7782

0 commit comments

Comments
 (0)