Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
7088526d
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,发现更多精彩内容 >>
提交
7088526d
编写于
4月 15, 2010
作者:
C
Carl Meyer
浏览文件
操作
浏览文件
下载
差异文件
merge from Simon Cross
上级
c6250ece
4ed59f91
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
99 addition
and
1 deletion
+99
-1
docs/news.txt
docs/news.txt
+2
-0
pip/commands/install.py
pip/commands/install.py
+10
-1
pip/req.py
pip/req.py
+37
-0
tests/test_basic.py
tests/test_basic.py
+50
-0
未找到文件。
docs/news.txt
浏览文件 @
7088526d
...
...
@@ -37,6 +37,8 @@ hg tip
* Support Debian/Ubuntu "dist-packages" in zip command. Thanks duckx.
* Fix relative --src folder. Thanks Simon Cross.
* Handle missing VCS with an error message. Thanks Alexandre Conrad.
* Added --no-download option to install; pairs with --no-install to separate
download and installation into two steps. Thanks Simon Cross.
0.6.3
-----
...
...
pip/commands/install.py
浏览文件 @
7088526d
...
...
@@ -106,6 +106,12 @@ class InstallCommand(Command):
dest
=
'no_install'
,
action
=
'store_true'
,
help
=
"Download and unpack all packages, but don't actually install them"
)
self
.
parser
.
add_option
(
'--no-download'
,
dest
=
'no_download'
,
action
=
"store_true"
,
help
=
"Don't download any packages, just install the ones already downloaded "
"(completes an install run with --no-install)"
)
self
.
parser
.
add_option
(
'--install-option'
,
...
...
@@ -151,7 +157,10 @@ class InstallCommand(Command):
for
filename
in
options
.
requirements
:
for
req
in
parse_requirements
(
filename
,
finder
=
finder
,
options
=
options
):
requirement_set
.
add_requirement
(
req
)
requirement_set
.
install_files
(
finder
,
force_root_egg_info
=
self
.
bundle
,
bundle
=
self
.
bundle
)
if
not
options
.
no_download
:
requirement_set
.
install_files
(
finder
,
force_root_egg_info
=
self
.
bundle
,
bundle
=
self
.
bundle
)
else
:
requirement_set
.
locate_files
()
if
not
options
.
no_install
and
not
self
.
bundle
:
requirement_set
.
install
(
install_options
)
installed
=
' '
.
join
([
req
.
name
for
req
in
...
...
pip/req.py
浏览文件 @
7088526d
...
...
@@ -769,6 +769,43 @@ class RequirementSet(object):
req
.
uninstall
(
auto_confirm
=
auto_confirm
)
req
.
commit_uninstall
()
def
locate_files
(
self
):
## FIXME: duplicates code from install_files; relevant code should
## probably be factored out into a separate method
unnamed
=
list
(
self
.
unnamed_requirements
)
reqs
=
self
.
requirements
.
values
()
while
reqs
or
unnamed
:
if
unnamed
:
req_to_install
=
unnamed
.
pop
(
0
)
else
:
req_to_install
=
reqs
.
pop
(
0
)
install_needed
=
True
if
not
self
.
ignore_installed
and
not
req_to_install
.
editable
:
req_to_install
.
check_if_exists
()
if
req_to_install
.
satisfied_by
:
if
self
.
upgrade
:
req_to_install
.
conflicts_with
=
req_to_install
.
satisfied_by
req_to_install
.
satisfied_by
=
None
else
:
install_needed
=
False
if
req_to_install
.
satisfied_by
:
logger
.
notify
(
'Requirement already satisfied '
'(use --upgrade to upgrade): %s'
%
req_to_install
)
if
req_to_install
.
editable
:
if
req_to_install
.
source_dir
is
None
:
req_to_install
.
source_dir
=
req_to_install
.
build_location
(
self
.
src_dir
)
elif
install_needed
:
req_to_install
.
source_dir
=
req_to_install
.
build_location
(
self
.
build_dir
,
not
self
.
is_download
)
if
req_to_install
.
source_dir
is
not
None
and
not
os
.
path
.
isdir
(
req_to_install
.
source_dir
):
raise
InstallationError
(
'Could not install requirement %s '
'because source folder %s does not exist '
'(perhaps --no-download was used without first running '
'an equivalent install with --no-install?)'
%
(
req_to_install
,
req_to_install
.
source_dir
))
def
install_files
(
self
,
finder
,
force_root_egg_info
=
False
,
bundle
=
False
):
unnamed
=
list
(
self
.
unnamed_requirements
)
reqs
=
self
.
requirements
.
values
()
...
...
tests/test_basic.py
浏览文件 @
7088526d
...
...
@@ -90,6 +90,56 @@ def test_download_editable_to_custom_path():
assert
'customsrc/initools/setup.py'
in
result
.
files_created
assert
[
filename
for
filename
in
result
.
files_created
.
keys
()
if
filename
.
startswith
(
'customdl/initools'
)]
def
test_editable_no_install_followed_by_no_download
():
"""
Test installing an editable in two steps (first with --no-install, then with --no-download).
"""
reset_env
()
result
=
run_pip
(
'install'
,
'-e'
,
'svn+http://svn.colorstudy.com/INITools/trunk#egg=initools-dev'
,
'--no-install'
,
expect_error
=
True
)
assert
lib_py
+
'site-packages/INITools.egg-link'
not
in
result
.
files_created
assert
'src/initools'
in
result
.
files_created
assert
'src/initools/.svn'
in
result
.
files_created
result
=
run_pip
(
'install'
,
'-e'
,
'svn+http://svn.colorstudy.com/INITools/trunk#egg=initools-dev'
,
'--no-download'
,
expect_error
=
True
)
egg_link
=
result
.
files_created
[
lib_py
+
'site-packages/INITools.egg-link'
]
# FIXME: I don't understand why there's a trailing . here:
assert
egg_link
.
bytes
.
endswith
(
'/test-scratch/src/initools
\n
.'
),
egg_link
.
bytes
assert
(
lib_py
+
'site-packages/easy-install.pth'
)
in
result
.
files_updated
assert
'src/initools'
not
in
result
.
files_created
assert
'src/initools/.svn'
not
in
result
.
files_created
def
test_no_install_followed_by_no_download
():
"""
Test installing in two steps (first with --no-install, then with --no-download).
"""
reset_env
()
result
=
run_pip
(
'install'
,
'INITools==0.2'
,
'--no-install'
,
expect_error
=
True
)
assert
(
lib_py
+
'site-packages/INITools-0.2-py%s.egg-info'
%
pyversion
)
not
in
result
.
files_created
,
str
(
result
)
assert
(
lib_py
+
'site-packages/initools'
)
not
in
result
.
files_created
,
sorted
(
result
.
files_created
.
keys
())
assert
'build/INITools'
in
result
.
files_created
assert
'build/INITools/INITools.egg-info'
in
result
.
files_created
result
=
run_pip
(
'install'
,
'INITools==0.2'
,
'--no-download'
,
expect_error
=
True
)
assert
(
lib_py
+
'site-packages/INITools-0.2-py%s.egg-info'
%
pyversion
)
in
result
.
files_created
,
str
(
result
)
assert
(
lib_py
+
'site-packages/initools'
)
in
result
.
files_created
,
sorted
(
result
.
files_created
.
keys
())
assert
'build/INITools'
not
in
result
.
files_created
assert
'build/INITools/INITools.egg-info'
not
in
result
.
files_created
def
test_bad_install_with_no_download
():
"""
Test that --no-download behaves sensibly if the package source can't be found.
"""
reset_env
()
result
=
run_pip
(
'install'
,
'INITools==0.2'
,
'--no-download'
,
expect_error
=
True
)
assert
result
.
stdout
.
find
(
"perhaps --no-download was used without first running an equivalent install with --no-install?"
)
>
0
def
test_install_dev_version_from_pypi
():
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录