Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
da1870b2
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,发现更多精彩内容 >>
提交
da1870b2
编写于
4月 17, 2010
作者:
A
Alexandre Conrad
浏览文件
操作
浏览文件
下载
差异文件
merge
上级
d4ab186a
627c3e72
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
5 deletion
+38
-5
docs/news.txt
docs/news.txt
+1
-0
pip/commands/install.py
pip/commands/install.py
+2
-1
pip/req.py
pip/req.py
+23
-3
tests/test_basic.py
tests/test_basic.py
+12
-1
未找到文件。
docs/news.txt
浏览文件 @
da1870b2
...
...
@@ -41,6 +41,7 @@ News for pip
download and installation into two steps. Thanks Simon Cross.
* Fix uninstalling from requirements file containing -f, -i, or
--extra-index-url.
* Leftover build directories are now removed. Thanks Alexandre Conrad.
0.6.3
-----
...
...
pip/commands/install.py
浏览文件 @
da1870b2
...
...
@@ -158,7 +158,7 @@ class InstallCommand(Command):
for
req
in
parse_requirements
(
filename
,
finder
=
finder
,
options
=
options
):
requirement_set
.
add_requirement
(
req
)
if
not
options
.
no_download
:
requirement_set
.
install
_files
(
finder
,
force_root_egg_info
=
self
.
bundle
,
bundle
=
self
.
bundle
)
requirement_set
.
prepare
_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
:
...
...
@@ -172,6 +172,7 @@ class InstallCommand(Command):
requirement_set
.
successfully_downloaded
])
if
downloaded
:
logger
.
notify
(
'Successfully downloaded %s'
%
downloaded
)
requirement_set
.
cleanup_files
(
bundle
=
self
.
bundle
)
return
requirement_set
InstallCommand
()
pip/req.py
浏览文件 @
da1870b2
...
...
@@ -716,6 +716,7 @@ class RequirementSet(object):
self
.
ignore_dependencies
=
ignore_dependencies
self
.
successfully_downloaded
=
[]
self
.
successfully_installed
=
[]
self
.
reqs_to_cleanup
=
[]
def
__str__
(
self
):
reqs
=
[
req
for
req
in
self
.
requirements
.
values
()
...
...
@@ -806,7 +807,8 @@ class RequirementSet(object):
'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
):
def
prepare_files
(
self
,
finder
,
force_root_egg_info
=
False
,
bundle
=
False
):
"""Prepare process. Create temp directories, download and/or unpack files."""
unnamed
=
list
(
self
.
unnamed_requirements
)
reqs
=
self
.
requirements
.
values
()
while
reqs
or
unnamed
:
...
...
@@ -835,8 +837,8 @@ class RequirementSet(object):
else
:
logger
.
notify
(
'Downloading/unpacking %s'
%
req_to_install
)
logger
.
indent
+=
2
is_bundle
=
False
try
:
is_bundle
=
False
if
req_to_install
.
editable
:
if
req_to_install
.
source_dir
is
None
:
location
=
req_to_install
.
build_location
(
self
.
src_dir
)
...
...
@@ -927,7 +929,7 @@ class RequirementSet(object):
if
req_to_install
.
name
not
in
self
.
requirements
:
self
.
requirements
[
req_to_install
.
name
]
=
req_to_install
else
:
req_to_install
.
remove_temporary_source
(
)
self
.
reqs_to_cleanup
.
append
(
req_to_install
)
if
install
:
self
.
successfully_downloaded
.
append
(
req_to_install
)
if
bundle
and
(
req_to_install
.
url
and
req_to_install
.
url
.
startswith
(
'file:///'
)):
...
...
@@ -935,6 +937,24 @@ class RequirementSet(object):
finally
:
logger
.
indent
-=
2
def
cleanup_files
(
self
,
bundle
=
False
):
"""Clean up files, remove builds."""
logger
.
notify
(
'Cleaning up...'
)
logger
.
indent
+=
2
for
req
in
self
.
reqs_to_cleanup
:
req
.
remove_temporary_source
()
try
:
# create_bundle() is responsible for removing build_dir and
# src_dir after compression. create_bundle() is ran afterwards.
if
not
bundle
:
for
directory
in
self
.
build_dir
,:
if
not
os
.
path
.
exists
(
directory
):
continue
logger
.
info
(
'Removing %s...'
%
directory
)
os
.
rmdir
(
directory
)
finally
:
logger
.
indent
-=
2
def
copy_to_builddir
(
self
,
req_to_install
):
target_dir
=
req_to_install
.
editable
and
self
.
src_dir
or
self
.
build_dir
logger
.
info
(
"Copying %s to %s"
%
(
req_to_install
.
name
,
target_dir
))
...
...
tests/test_basic.py
浏览文件 @
da1870b2
from
os.path
import
abspath
,
join
,
dirname
,
curdir
,
pardir
from
os.path
import
abspath
,
exists
,
join
,
dirname
,
curdir
,
pardir
from
test_pip
import
here
,
reset_env
,
run_pip
,
pyversion
,
lib_py
,
mkdir
def
test_correct_pip_version
():
...
...
@@ -253,3 +253,14 @@ def test_install_pardir():
result
=
run_pip
(
'install'
,
pardir
,
cwd
=
run_from
,
expect_error
=
False
)
assert
(
lib_py
+
'site-packages/fspkg'
)
in
result
.
files_created
,
str
(
result
.
stdout
)
assert
(
lib_py
+
'site-packages/FSPkg-0.1dev-py%s.egg-info'
%
pyversion
)
in
result
.
files_created
,
str
(
result
)
def
test_cleanup
():
"""
Test clean up of build directory after an install.
"""
reset_env
()
# FIXME: We may want to test more scenarios
result
=
run_pip
(
'install'
,
'INITools==dev'
,
expect_error
=
False
)
build
=
join
(
here
,
"test-scratch"
,
"build"
)
assert
not
exists
(
build
),
"build dir still exists: %s"
%
build
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录