Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Pdm
提交
bb960a66
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
bb960a66
编写于
2月 22, 2020
作者:
F
Frost Ming
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Merge markers correctly from different parents
上级
fd143544
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
30 deletion
+18
-30
news/47.bugfix
news/47.bugfix
+1
-0
pdm/models/candidates.py
pdm/models/candidates.py
+0
-4
pdm/models/repositories.py
pdm/models/repositories.py
+9
-18
pdm/project/core.py
pdm/project/core.py
+0
-8
tests/resolver/test_resolve.py
tests/resolver/test_resolve.py
+8
-0
未找到文件。
news/47.bugfix
0 → 100644
浏览文件 @
bb960a66
Always consider wheels before tarballs; correctly merge markers from different parents.
pdm/models/candidates.py
浏览文件 @
bb960a66
...
...
@@ -108,10 +108,6 @@ class Candidate:
self
.
wheel
=
None
self
.
metadata
=
None
# Dependencies from lockfile content.
self
.
dependencies
=
None
self
.
summary
=
None
def
__hash__
(
self
):
return
hash
((
self
.
name
,
self
.
version
))
...
...
pdm/models/repositories.py
浏览文件 @
bb960a66
...
...
@@ -155,15 +155,6 @@ class BaseRepository:
for
c
in
matching_candidates
}
def
_get_dependencies_from_lockfile
(
self
,
candidate
:
Candidate
)
->
CandidateInfo
:
if
candidate
.
dependencies
is
None
:
raise
CandidateInfoNotFound
(
candidate
)
return
(
[
dep
.
as_line
()
for
dep
in
candidate
.
dependencies
],
candidate
.
requires_python
,
candidate
.
summary
,
)
def
dependency_generators
(
self
)
->
Iterable
[
Callable
[[
Candidate
],
CandidateInfo
]]:
"""Return an iterable of getter functions to get dependencies, which will be
called one by one.
...
...
@@ -212,7 +203,6 @@ class PyPIRepository(BaseRepository):
def
dependency_generators
(
self
)
->
Iterable
[
Callable
[[
Candidate
],
CandidateInfo
]]:
return
(
self
.
_get_dependencies_from_lockfile
,
self
.
_get_dependencies_from_cache
,
self
.
_get_dependencies_from_json
,
self
.
_get_dependencies_from_metadata
,
...
...
@@ -241,19 +231,20 @@ class PyPIRepository(BaseRepository):
c
for
c
in
cans
if
requirement
.
specifier
.
contains
(
c
.
version
,
allow_prereleases
)
and
(
allow_all
or
requires_python
.
is_subset
(
c
.
requires_python
))
),
key
=
lambda
c
:
(
c
.
version
,
c
.
ireq
.
is_wheel
),
key
=
lambda
c
:
(
c
.
version
,
c
.
link
.
is_wheel
),
)
if
not
allow_all
:
sorted_cans
=
[
can
for
can
in
sorted_cans
if
requires_python
.
is_subset
(
can
.
requires_python
)
]
if
not
sorted_cans
and
allow_prereleases
is
None
:
# No non-pre-releases is found, force pre-releases now
sorted_cans
=
sorted
(
(
c
for
c
in
cans
if
requirement
.
specifier
.
contains
(
c
.
version
,
True
)),
(
c
for
c
in
cans
if
requirement
.
specifier
.
contains
(
c
.
version
,
True
)
and
(
allow_all
or
requires_python
.
is_subset
(
c
.
requires_python
))
),
key
=
lambda
c
:
c
.
version
,
)
return
sorted_cans
pdm/project/core.py
浏览文件 @
bb960a66
...
...
@@ -185,17 +185,9 @@ class Project:
if
version
:
package
[
"version"
]
=
f
"==
{
version
}
"
package_name
=
package
.
pop
(
"name"
)
summary
=
package
.
pop
(
"summary"
,
None
)
dependencies
=
[
Requirement
.
from_req_dict
(
k
,
v
)
for
k
,
v
in
package
.
pop
(
"dependencies"
,
{}).
items
()
]
req
=
Requirement
.
from_req_dict
(
package_name
,
dict
(
package
))
can
=
Candidate
(
req
,
self
.
environment
,
name
=
package_name
,
version
=
version
)
can
.
marker
=
req
.
marker
can
.
requires_python
=
str
(
req
.
requires_python
)
can
.
dependencies
=
dependencies
can
.
summary
=
summary
can
.
hashes
=
{
item
[
"file"
]:
item
[
"hash"
]
for
item
in
self
.
lockfile
[
"metadata"
].
get
(
...
...
tests/resolver/test_resolve.py
浏览文件 @
bb960a66
...
...
@@ -178,6 +178,14 @@ def test_exclude_incompatible_requirements(project, repository):
assert
"bar"
not
in
result
def
test_union_markers_from_different_parents
(
project
,
repository
):
repository
.
add_candidate
(
"foo"
,
"0.1.0"
)
repository
.
add_dependencies
(
"foo"
,
"0.1.0"
,
[
"bar; python_version < '3'"
])
repository
.
add_candidate
(
"bar"
,
"0.1.0"
)
result
=
resolve_requirements
(
repository
,
[
"foo"
,
"bar"
],
">=3.6"
)
assert
not
result
[
"bar"
].
requires_python
def
test_requirements_from_different_sections
(
project
,
repository
):
repository
.
add_candidate
(
"foo"
,
"0.1.0"
)
repository
.
add_candidate
(
"foo"
,
"0.2.0"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录