Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Pdm
提交
757b9a3b
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,发现更多精彩内容 >>
未验证
提交
757b9a3b
编写于
2月 25, 2021
作者:
F
Frost Ming
提交者:
GitHub
2月 25, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #276 from frostming/bugfix/275
Make requirement complying with PEP 508
上级
1bcf229a
93c472dd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
19 deletion
+18
-19
news/275.bugfix.rst
news/275.bugfix.rst
+1
-0
pdm/models/requirements.py
pdm/models/requirements.py
+15
-17
tests/models/test_requirements.py
tests/models/test_requirements.py
+2
-2
未找到文件。
news/275.bugfix.rst
0 → 100644
浏览文件 @
757b9a3b
Fix the requirement string of a VCS requirement to comply with PEP 508.
pdm/models/requirements.py
浏览文件 @
757b9a3b
...
...
@@ -211,10 +211,7 @@ class Requirement:
)
def
as_ireq
(
self
,
**
kwargs
)
->
InstallRequirement
:
if
self
.
is_file_or_url
:
line_for_req
=
self
.
as_line
(
True
)
else
:
line_for_req
=
self
.
as_line
()
line_for_req
=
self
.
as_line
()
if
self
.
editable
:
line_for_req
=
line_for_req
[
3
:].
strip
()
ireq
=
install_req_from_editable
(
line_for_req
,
**
kwargs
)
...
...
@@ -311,20 +308,14 @@ class FileRequirement(Requirement):
def
key
(
self
)
->
Optional
[
str
]:
return
self
.
project_name
.
lower
()
if
self
.
project_name
else
None
def
as_line
(
self
,
for_ireq
:
bool
=
False
)
->
str
:
editable
=
"-e "
if
self
.
editable
else
""
def
as_line
(
self
)
->
str
:
project_name
=
f
"
{
self
.
project_name
}
"
if
self
.
project_name
else
""
extras
=
f
"[
{
','
.
join
(
sorted
(
self
.
extras
))
}
]"
if
self
.
extras
else
""
if
self
.
path
and
not
for_ireq
and
self
.
editable
and
not
project_name
:
location
=
self
.
str_path
else
:
location
=
self
.
url
marker
=
self
.
_format_marker
()
if
for_ireq
and
project_name
:
return
f
"
{
editable
}{
location
}
#egg=
{
project_name
}{
extras
}{
marker
}
"
else
:
delimiter
=
" @ "
if
project_name
else
""
return
f
"
{
editable
}{
project_name
}{
extras
}{
delimiter
}{
location
}{
marker
}
"
if
self
.
editable
:
return
f
"-e
{
self
.
url
}
#egg=
{
project_name
}{
extras
}{
marker
}
"
delimiter
=
" @ "
if
project_name
else
""
return
f
"
{
project_name
}{
extras
}{
delimiter
}{
self
.
url
}{
marker
}
"
def
_parse_name_from_url
(
self
)
->
None
:
parsed
=
urlparse
.
urlparse
(
self
.
url
)
...
...
@@ -381,8 +372,15 @@ class VcsRequirement(FileRequirement):
return
r
def
as_line
(
self
)
->
str
:
editable
=
"-e "
if
self
.
editable
else
""
return
f
"
{
editable
}{
self
.
vcs
}
+
{
self
.
url
}{
self
.
_format_marker
()
}
"
if
self
.
editable
:
return
f
"-e
{
self
.
vcs
}
+
{
self
.
url
}{
self
.
_format_marker
()
}
"
else
:
extras
=
f
"[
{
','
.
join
(
self
.
extras
)
}
]"
if
self
.
extras
else
""
ref
=
f
"@
{
self
.
ref
}
"
if
self
.
ref
else
""
return
(
f
"
{
self
.
project_name
}{
extras
}
@
{
self
.
vcs
}
+
{
self
.
repo
}
"
f
"
{
ref
}{
self
.
_format_marker
()
}
"
)
def
_parse_url
(
self
)
->
None
:
if
self
.
url
.
startswith
(
"git@"
):
...
...
tests/models/test_requirements.py
浏览文件 @
757b9a3b
...
...
@@ -24,7 +24,7 @@ REQUIREMENTS = [
),
(
"git+http://git.example.com/MyProject.git@master#egg=MyProject"
,
None
,
"MyProject @ git+http://git.example.com/MyProject.git@master"
,
),
(
"https://github.com/pypa/pip/archive/1.3.1.zip"
,
...
...
@@ -49,7 +49,7 @@ REQUIREMENTS = [
),
(
"git+git@github.com:pypa/pip.git#egg=pip"
,
"
git+ssh://git@github.com/pypa/pip.git#egg=pip
"
,
"
pip @ git+ssh://git@github.com/pypa/pip.git
"
,
),
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录