Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Pdm
提交
965d3a93
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,发现更多精彩内容 >>
未验证
提交
965d3a93
编写于
3月 29, 2020
作者:
F
Frost Ming
提交者:
GitHub
3月 29, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #93 from frostming/bugfix/92
only remove if it isn't required by any
上级
a1b95801
c7fab50a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
15 addition
and
3 deletion
+15
-3
news/92.bugfix
news/92.bugfix
+1
-0
pdm/installers.py
pdm/installers.py
+5
-3
tests/cli/test_actions.py
tests/cli/test_actions.py
+9
-0
未找到文件。
news/92.bugfix
0 → 100644
浏览文件 @
965d3a93
Fix an issue of remove command that will unexpectedly uninstall packages in default section.
pdm/installers.py
浏览文件 @
965d3a93
...
@@ -392,6 +392,7 @@ class Synchronizer:
...
@@ -392,6 +392,7 @@ class Synchronizer:
self
.
candidates
=
candidates
self
.
candidates
=
candidates
self
.
environment
=
environment
self
.
environment
=
environment
self
.
parallel
=
environment
.
project
.
config
[
"parallel_install"
]
self
.
parallel
=
environment
.
project
.
config
[
"parallel_install"
]
self
.
all_candidates
=
environment
.
project
.
get_locked_candidates
(
"__all__"
)
self
.
working_set
=
environment
.
get_working_set
()
self
.
working_set
=
environment
.
get_working_set
()
@
contextlib
.
contextmanager
@
contextlib
.
contextmanager
...
@@ -425,15 +426,16 @@ class Synchronizer:
...
@@ -425,15 +426,16 @@ class Synchronizer:
candidates
=
self
.
candidates
.
copy
()
candidates
=
self
.
candidates
.
copy
()
environment
=
self
.
environment
.
marker_environment
environment
=
self
.
environment
.
marker_environment
for
key
,
dist
in
working_set
.
items
():
for
key
,
dist
in
working_set
.
items
():
if
key
not
in
candidates
:
if
key
in
candidates
:
to_remove
.
append
(
key
)
else
:
can
=
candidates
.
pop
(
key
)
can
=
candidates
.
pop
(
key
)
if
can
.
marker
and
not
can
.
marker
.
evaluate
(
environment
):
if
can
.
marker
and
not
can
.
marker
.
evaluate
(
environment
):
to_remove
.
append
(
key
)
to_remove
.
append
(
key
)
elif
not
_is_dist_editable
(
dist
)
and
dist
.
version
!=
can
.
version
:
elif
not
_is_dist_editable
(
dist
)
and
dist
.
version
!=
can
.
version
:
# XXX: An editable distribution is always considered as consistent.
# XXX: An editable distribution is always considered as consistent.
to_update
.
append
(
key
)
to_update
.
append
(
key
)
elif
key
not
in
self
.
all_candidates
:
# Remove package only if it is not required by any section
to_remove
.
append
(
key
)
to_add
=
list
(
to_add
=
list
(
{
{
strip_extras
(
name
)[
0
]
strip_extras
(
name
)[
0
]
...
...
tests/cli/test_actions.py
浏览文件 @
965d3a93
...
@@ -277,6 +277,15 @@ def test_remove_package_not_exist(project, repository, working_set):
...
@@ -277,6 +277,15 @@ def test_remove_package_not_exist(project, repository, working_set):
actions
.
do_remove
(
project
,
sync
=
False
,
packages
=
[
"django"
])
actions
.
do_remove
(
project
,
sync
=
False
,
packages
=
[
"django"
])
def
test_remove_package_exist_in_multi_section
(
project
,
repository
,
working_set
):
actions
.
do_add
(
project
,
packages
=
[
"requests"
])
actions
.
do_add
(
project
,
dev
=
True
,
packages
=
[
"urllib3"
])
actions
.
do_remove
(
project
,
dev
=
True
,
packages
=
[
"urllib3"
])
assert
"urllib3"
not
in
project
.
tool_settings
[
"dev-dependencies"
]
assert
"urllib3"
in
working_set
assert
"requests"
in
working_set
def
test_add_remove_no_package
(
project
,
repository
):
def
test_add_remove_no_package
(
project
,
repository
):
with
pytest
.
raises
(
PdmUsageError
):
with
pytest
.
raises
(
PdmUsageError
):
actions
.
do_add
(
project
,
packages
=
())
actions
.
do_add
(
project
,
packages
=
())
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录