Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Pdm
提交
46098800
P
Pdm
项目概览
后端镜像
/
Pdm
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Pdm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
46098800
编写于
2月 09, 2021
作者:
F
Frost Ming
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix the version parsing and validation
上级
63f6cab5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
4 deletion
+30
-4
news/130.bugfix.md
news/130.bugfix.md
+1
-0
news/254.bugfix.md
news/254.bugfix.md
+1
-0
pdm/models/candidates.py
pdm/models/candidates.py
+9
-4
pdm/models/specifiers.py
pdm/models/specifiers.py
+15
-0
tests/models/test_specifiers.py
tests/models/test_specifiers.py
+4
-0
未找到文件。
news/130.bugfix.md
0 → 100644
浏览文件 @
46098800
Fix the version validator of wheel metadata to align with the implementation of
`packaging`
.
news/254.bugfix.md
0 → 100644
浏览文件 @
46098800
Fix the version parsing of Python requires to allow
`>`
,
`>=`
,
`<`
,
`<=`
to combine with star versions.
pdm/models/candidates.py
浏览文件 @
46098800
...
...
@@ -33,12 +33,17 @@ def _patch_version_parsing():
list.
"""
from
distlib.version
import
VersionScheme
from
packaging.requirements
import
InvalidRequirement
from
packaging.requirements
import
Requirement
as
PRequirement
def
is_valid_constraint_list
(
self
,
s
):
s
=
","
.
join
(
v
for
v
in
s
.
strip
().
split
(
","
)
if
v
)
return
self
.
is_valid_matcher
(
"dummy_name (%s)"
%
s
)
def
is_valid_matcher
(
self
,
s
):
try
:
PRequirement
(
s
)
except
InvalidRequirement
:
return
False
return
True
VersionScheme
.
is_valid_
constraint_list
=
is_valid_constraint_list
VersionScheme
.
is_valid_
matcher
=
is_valid_matcher
_patch_version_parsing
()
...
...
pdm/models/specifiers.py
浏览文件 @
46098800
...
...
@@ -103,6 +103,21 @@ class PySpecSet(SpecifierSet):
elif
op
==
"!="
:
excludes
.
add
(
version
)
continue
elif
op
==
">"
:
# >X.Y.* => >=X.Y+1.0
op
=
">="
version
=
bump_version
(
version
,
-
2
)
elif
op
in
(
"<"
,
">="
,
"<="
):
# <X.Y.* => <X.Y.0
# >=X.Y.* => >=X.Y.0
# <=X.Y.* => <X.Y.0
version
=
version
[:
-
1
]
+
(
0
,)
if
op
==
"<="
:
op
=
"<"
else
:
raise
InvalidPyVersion
(
f
"Unsupported version specifier:
{
spec
.
op
}{
spec
.
version
}
"
)
if
op
!=
"~="
:
version
=
_complete_version
(
version
)
if
op
in
(
"=="
,
"==="
):
...
...
tests/models/test_specifiers.py
浏览文件 @
46098800
...
...
@@ -19,6 +19,10 @@ from pdm.models.specifiers import PySpecSet
(
">=3.6,<3.8,!=3.8.*"
,
">=3.6,<3.8"
),
(
">=2.7,<3.2,!=3.0.*,!=3.1.*"
,
">=2.7,<3.0"
),
(
"!=3.0.*,!=3.0.2"
,
"!=3.0.*"
),
(
">=3.4.*"
,
">=3.4"
),
(
">3.4.*"
,
">=3.5"
),
(
"<=3.4.*"
,
"<3.4"
),
(
"<3.4.*"
,
"<3.4"
),
],
)
def
test_normalize_pyspec
(
original
,
normalized
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录