Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
07900ed7
P
pip
项目概览
镜像
/
Python_Packaging_Authority
/
pip
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pip
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
07900ed7
编写于
11月 08, 2018
作者:
C
Chris Jerdonek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change VersionControl.get_src_requirement() to accept the project name.
上级
b0f06c8d
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
23 addition
and
32 deletion
+23
-32
src/pip/_internal/operations/freeze.py
src/pip/_internal/operations/freeze.py
+1
-1
src/pip/_internal/utils/misc.py
src/pip/_internal/utils/misc.py
+3
-1
src/pip/_internal/vcs/__init__.py
src/pip/_internal/vcs/__init__.py
+1
-1
src/pip/_internal/vcs/bazaar.py
src/pip/_internal/vcs/bazaar.py
+2
-3
src/pip/_internal/vcs/git.py
src/pip/_internal/vcs/git.py
+2
-3
src/pip/_internal/vcs/mercurial.py
src/pip/_internal/vcs/mercurial.py
+2
-4
src/pip/_internal/vcs/subversion.py
src/pip/_internal/vcs/subversion.py
+2
-4
tests/unit/test_utils.py
tests/unit/test_utils.py
+3
-0
tests/unit/test_vcs.py
tests/unit/test_vcs.py
+7
-15
未找到文件。
src/pip/_internal/operations/freeze.py
浏览文件 @
07900ed7
...
...
@@ -168,7 +168,7 @@ def get_requirement_info(dist):
return
(
location
,
True
,
comments
)
try
:
req
=
vc_type
().
get_src_requirement
(
dist
,
location
)
req
=
vc_type
().
get_src_requirement
(
location
,
dist
.
project_name
)
except
BadCommand
:
logger
.
warning
(
'cannot determine version of editable source in %s '
...
...
src/pip/_internal/utils/misc.py
浏览文件 @
07900ed7
...
...
@@ -850,13 +850,15 @@ def enum(*sequential, **named):
return
type
(
'Enum'
,
(),
enums
)
def
make_vcs_requirement_url
(
repo_url
,
rev
,
egg_
project_name
,
subdir
=
None
):
def
make_vcs_requirement_url
(
repo_url
,
rev
,
project_name
,
subdir
=
None
):
"""
Return the URL for a VCS requirement.
Args:
repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
project_name: the (unescaped) project name.
"""
egg_project_name
=
pkg_resources
.
to_filename
(
project_name
)
req
=
'{}@{}#egg={}'
.
format
(
repo_url
,
rev
,
egg_project_name
)
if
subdir
:
req
+=
'&subdirectory={}'
.
format
(
subdir
)
...
...
src/pip/_internal/vcs/__init__.py
浏览文件 @
07900ed7
...
...
@@ -411,7 +411,7 @@ class VersionControl(object):
rmtree
(
location
)
self
.
obtain
(
location
)
def
get_src_requirement
(
self
,
dist
,
location
):
def
get_src_requirement
(
self
,
location
,
project_name
):
"""
Return a string representing the requirement needed to
redownload the files currently present in location, something
...
...
src/pip/_internal/vcs/bazaar.py
浏览文件 @
07900ed7
...
...
@@ -94,15 +94,14 @@ class Bazaar(VersionControl):
)
return
revision
.
splitlines
()[
-
1
]
def
get_src_requirement
(
self
,
dist
,
location
):
def
get_src_requirement
(
self
,
location
,
project_name
):
repo
=
self
.
get_url
(
location
)
if
not
repo
:
return
None
if
not
repo
.
lower
().
startswith
(
'bzr:'
):
repo
=
'bzr+'
+
repo
current_rev
=
self
.
get_revision
(
location
)
egg_project_name
=
dist
.
egg_name
().
split
(
'-'
,
1
)[
0
]
return
make_vcs_requirement_url
(
repo
,
current_rev
,
egg_project_name
)
return
make_vcs_requirement_url
(
repo
,
current_rev
,
project_name
)
def
is_commit_id_equal
(
self
,
dest
,
name
):
"""Always assume the versions don't match"""
...
...
src/pip/_internal/vcs/git.py
浏览文件 @
07900ed7
...
...
@@ -293,14 +293,13 @@ class Git(VersionControl):
return
None
return
os
.
path
.
relpath
(
location
,
root_dir
)
def
get_src_requirement
(
self
,
dist
,
location
):
def
get_src_requirement
(
self
,
location
,
project_name
):
repo
=
self
.
get_url
(
location
)
if
not
repo
.
lower
().
startswith
(
'git:'
):
repo
=
'git+'
+
repo
current_rev
=
self
.
get_revision
(
location
)
egg_project_name
=
dist
.
egg_name
().
split
(
'-'
,
1
)[
0
]
subdir
=
self
.
_get_subdirectory
(
location
)
req
=
make_vcs_requirement_url
(
repo
,
current_rev
,
egg_
project_name
,
req
=
make_vcs_requirement_url
(
repo
,
current_rev
,
project_name
,
subdir
=
subdir
)
return
req
...
...
src/pip/_internal/vcs/mercurial.py
浏览文件 @
07900ed7
...
...
@@ -84,14 +84,12 @@ class Mercurial(VersionControl):
show_stdout
=
False
,
cwd
=
location
).
strip
()
return
current_rev_hash
def
get_src_requirement
(
self
,
dist
,
location
):
def
get_src_requirement
(
self
,
location
,
project_name
):
repo
=
self
.
get_url
(
location
)
if
not
repo
.
lower
().
startswith
(
'hg:'
):
repo
=
'hg+'
+
repo
current_rev_hash
=
self
.
get_revision_hash
(
location
)
egg_project_name
=
dist
.
egg_name
().
split
(
'-'
,
1
)[
0
]
return
make_vcs_requirement_url
(
repo
,
current_rev_hash
,
egg_project_name
)
return
make_vcs_requirement_url
(
repo
,
current_rev_hash
,
project_name
)
def
is_commit_id_equal
(
self
,
dest
,
name
):
"""Always assume the versions don't match"""
...
...
src/pip/_internal/vcs/subversion.py
浏览文件 @
07900ed7
...
...
@@ -195,15 +195,13 @@ class Subversion(VersionControl):
return
url
,
rev
def
get_src_requirement
(
self
,
dist
,
location
):
def
get_src_requirement
(
self
,
location
,
project_name
):
repo
=
self
.
get_url
(
location
)
if
repo
is
None
:
return
None
repo
=
'svn+'
+
repo
rev
=
self
.
get_revision
(
location
)
# FIXME: why not project name?
egg_project_name
=
dist
.
egg_name
().
split
(
'-'
,
1
)[
0
]
return
make_vcs_requirement_url
(
repo
,
rev
,
egg_project_name
)
return
make_vcs_requirement_url
(
repo
,
rev
,
project_name
)
def
is_commit_id_equal
(
self
,
dest
,
name
):
"""Always assume the versions don't match"""
...
...
tests/unit/test_utils.py
浏览文件 @
07900ed7
...
...
@@ -646,6 +646,9 @@ def test_call_subprocess_closes_stdin():
# Test with None subdir.
((
'git+https://example.com/pkg'
,
'dev'
,
'myproj'
,
None
),
'git+https://example.com/pkg@dev#egg=myproj'
),
# Test an unescaped project name.
((
'git+https://example.com/pkg'
,
'dev'
,
'zope-interface'
),
'git+https://example.com/pkg@dev#egg=zope_interface'
),
])
def
test_make_vcs_requirement_url
(
args
,
expected
):
actual
=
make_vcs_requirement_url
(
*
args
)
...
...
tests/unit/test_vcs.py
浏览文件 @
07900ed7
...
...
@@ -80,13 +80,6 @@ def git():
return
git
@
pytest
.
fixture
def
dist
():
dist
=
Mock
()
dist
.
egg_name
=
Mock
(
return_value
=
'pip_test_package'
)
return
dist
def
test_looks_like_hash
():
assert
looks_like_hash
(
40
*
'a'
)
assert
looks_like_hash
(
40
*
'A'
)
...
...
@@ -97,14 +90,13 @@ def test_looks_like_hash():
@
pytest
.
mark
.
network
def
test_git_get_src_requirements
(
git
,
dist
):
ret
=
git
.
get_src_requirement
(
dist
,
location
=
'.'
)
assert
ret
==
''
.
join
([
'git+https://github.com/pypa/pip-test-package'
,
'@5547fa909e83df8bd743d3978d6667497983a4b7'
,
'#egg=pip_test_package'
])
def
test_git_get_src_requirements
(
git
):
ret
=
git
.
get_src_requirement
(
'.'
,
'pip-test-package'
)
assert
ret
==
(
'git+https://github.com/pypa/pip-test-package'
'@5547fa909e83df8bd743d3978d6667497983a4b7#egg=pip_test_package'
)
@
patch
(
'pip._internal.vcs.git.Git.get_revision_sha'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录