Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
c08d4cc8
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,发现更多精彩内容 >>
未验证
提交
c08d4cc8
编写于
3月 04, 2018
作者:
P
Pradyun Gedam
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add --no-build-isolation for disabling build isolation
上级
34cc3649
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
46 addition
and
10 deletion
+46
-10
src/pip/_internal/cmdoptions.py
src/pip/_internal/cmdoptions.py
+11
-0
src/pip/_internal/commands/download.py
src/pip/_internal/commands/download.py
+2
-0
src/pip/_internal/commands/install.py
src/pip/_internal/commands/install.py
+2
-0
src/pip/_internal/commands/wheel.py
src/pip/_internal/commands/wheel.py
+4
-1
src/pip/_internal/operations/prepare.py
src/pip/_internal/operations/prepare.py
+11
-8
tests/functional/test_wheel.py
tests/functional/test_wheel.py
+14
-0
tests/unit/test_req.py
tests/unit/test_req.py
+2
-1
未找到文件。
src/pip/_internal/cmdoptions.py
浏览文件 @
c08d4cc8
...
...
@@ -451,6 +451,17 @@ ignore_requires_python = partial(
help
=
'Ignore the Requires-Python information.'
)
# type: Any
no_build_isolation
=
partial
(
Option
,
'--no-build-isolation'
,
dest
=
'build_isolation'
,
action
=
'store_false'
,
default
=
True
,
help
=
'Disable isolation when building a modern source distribution. '
'Build dependencies specified by PEP 518 must be already installed '
'if this option is used.'
)
# type: Any
install_options
=
partial
(
Option
,
'--install-option'
,
...
...
src/pip/_internal/commands/download.py
浏览文件 @
c08d4cc8
...
...
@@ -57,6 +57,7 @@ class DownloadCommand(RequirementCommand):
cmd_opts
.
add_option
(
cmdoptions
.
no_clean
())
cmd_opts
.
add_option
(
cmdoptions
.
require_hashes
())
cmd_opts
.
add_option
(
cmdoptions
.
progress_bar
())
cmd_opts
.
add_option
(
cmdoptions
.
no_build_isolation
())
cmd_opts
.
add_option
(
'-d'
,
'--dest'
,
'--destination-dir'
,
'--destination-directory'
,
...
...
@@ -201,6 +202,7 @@ class DownloadCommand(RequirementCommand):
download_dir
=
options
.
download_dir
,
wheel_download_dir
=
None
,
progress_bar
=
options
.
progress_bar
,
build_isolation
=
options
.
build_isolation
,
)
resolver
=
Resolver
(
...
...
src/pip/_internal/commands/install.py
浏览文件 @
c08d4cc8
...
...
@@ -139,6 +139,7 @@ class InstallCommand(RequirementCommand):
help
=
'Ignore the installed packages (reinstalling instead).'
)
cmd_opts
.
add_option
(
cmdoptions
.
ignore_requires_python
())
cmd_opts
.
add_option
(
cmdoptions
.
no_build_isolation
())
cmd_opts
.
add_option
(
cmdoptions
.
install_options
())
cmd_opts
.
add_option
(
cmdoptions
.
global_options
())
...
...
@@ -260,6 +261,7 @@ class InstallCommand(RequirementCommand):
download_dir
=
None
,
wheel_download_dir
=
None
,
progress_bar
=
options
.
progress_bar
,
build_isolation
=
options
.
build_isolation
,
)
resolver
=
Resolver
(
...
...
src/pip/_internal/commands/wheel.py
浏览文件 @
c08d4cc8
...
...
@@ -63,7 +63,9 @@ class WheelCommand(RequirementCommand):
dest
=
'build_options'
,
metavar
=
'options'
,
action
=
'append'
,
help
=
"Extra arguments to be supplied to 'setup.py bdist_wheel'."
)
help
=
"Extra arguments to be supplied to 'setup.py bdist_wheel'."
,
)
cmd_opts
.
add_option
(
cmdoptions
.
no_build_isolation
())
cmd_opts
.
add_option
(
cmdoptions
.
constraints
())
cmd_opts
.
add_option
(
cmdoptions
.
editable
())
cmd_opts
.
add_option
(
cmdoptions
.
requirements
())
...
...
@@ -158,6 +160,7 @@ class WheelCommand(RequirementCommand):
download_dir
=
None
,
wheel_download_dir
=
options
.
wheel_dir
,
progress_bar
=
options
.
progress_bar
,
build_isolation
=
options
.
build_isolation
,
)
resolver
=
Resolver
(
...
...
src/pip/_internal/operations/prepare.py
浏览文件 @
c08d4cc8
...
...
@@ -104,7 +104,7 @@ class IsWheel(DistAbstraction):
return
list
(
pkg_resources
.
find_distributions
(
self
.
req
.
source_dir
))[
0
]
def
prep_for_dist
(
self
,
finder
):
def
prep_for_dist
(
self
,
finder
,
build_isolation
):
# FIXME:https://github.com/pypa/pip/issues/1112
pass
...
...
@@ -120,11 +120,11 @@ class IsSDist(DistAbstraction):
)
return
dist
def
prep_for_dist
(
self
,
finder
):
def
prep_for_dist
(
self
,
finder
,
build_isolation
):
# Before calling "setup.py egg_info", we need to set-up the build
# environment.
build_requirements
,
isolate
=
self
.
req
.
get_pep_518_info
()
should_isolate
=
build_isolation
and
isolate
if
'setuptools'
not
in
build_requirements
:
logger
.
warning
(
...
...
@@ -132,11 +132,11 @@ class IsSDist(DistAbstraction):
"it cannot build a wheel without setuptools. You may need to "
"upgrade to a newer version of pip."
)
if
not
isolate
:
if
not
should_
isolate
:
self
.
req
.
build_env
=
NoOpBuildEnvironment
(
no_clean
=
False
)
with
self
.
req
.
build_env
as
prefix
:
if
isolate
:
if
should_
isolate
:
_install_build_reqs
(
finder
,
prefix
,
build_requirements
)
self
.
req
.
run_egg_info
()
...
...
@@ -157,7 +157,7 @@ class RequirementPreparer(object):
"""
def
__init__
(
self
,
build_dir
,
download_dir
,
src_dir
,
wheel_download_dir
,
progress_bar
):
progress_bar
,
build_isolation
):
super
(
RequirementPreparer
,
self
).
__init__
()
self
.
src_dir
=
src_dir
...
...
@@ -181,6 +181,9 @@ class RequirementPreparer(object):
self
.
progress_bar
=
progress_bar
# Is build isolation allowed?
self
.
build_isolation
=
build_isolation
@
property
def
_download_should_save
(
self
):
# TODO: Modify to reduce indentation needed
...
...
@@ -306,7 +309,7 @@ class RequirementPreparer(object):
(
req
,
exc
,
req
.
link
)
)
abstract_dist
=
make_abstract_dist
(
req
)
abstract_dist
.
prep_for_dist
(
finder
)
abstract_dist
.
prep_for_dist
(
finder
,
self
.
build_isolation
)
if
self
.
_download_should_save
:
# Make a .zip of the source_dir we already created.
if
req
.
link
.
scheme
in
vcs
.
all_schemes
:
...
...
@@ -331,7 +334,7 @@ class RequirementPreparer(object):
req
.
update_editable
(
not
self
.
_download_should_save
)
abstract_dist
=
make_abstract_dist
(
req
)
abstract_dist
.
prep_for_dist
(
finder
)
abstract_dist
.
prep_for_dist
(
finder
,
self
.
build_isolation
)
if
self
.
_download_should_save
:
req
.
archive
(
self
.
download_dir
)
...
...
tests/functional/test_wheel.py
浏览文件 @
c08d4cc8
...
...
@@ -222,3 +222,17 @@ def test_pip_wheel_with_pep518_build_reqs(script, data):
assert
wheel_file_path
in
result
.
files_created
,
result
.
stdout
assert
"Successfully built pep518"
in
result
.
stdout
,
result
.
stdout
assert
"Installing build dependencies"
in
result
.
stdout
,
result
.
stdout
@
pytest
.
mark
.
network
def
test_pip_wheel_with_pep518_build_reqs_no_isolation
(
script
,
data
):
script
.
pip
(
'install'
,
'wheel'
)
result
=
script
.
pip
(
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'--no-build-isolation'
,
'pep518==3.0'
,
)
wheel_file_name
=
'pep518-3.0-py%s-none-any.whl'
%
pyversion
[
0
]
wheel_file_path
=
script
.
scratch
/
wheel_file_name
assert
wheel_file_path
in
result
.
files_created
,
result
.
stdout
assert
"Successfully built pep518"
in
result
.
stdout
,
result
.
stdout
assert
"Installing build dependencies"
not
in
result
.
stdout
,
result
.
stdout
tests/unit/test_req.py
浏览文件 @
c08d4cc8
...
...
@@ -39,7 +39,8 @@ class TestRequirementSet(object):
src_dir
=
os
.
path
.
join
(
self
.
tempdir
,
'src'
),
download_dir
=
None
,
wheel_download_dir
=
None
,
progress_bar
=
"on"
progress_bar
=
"on"
,
build_isolation
=
True
,
)
return
Resolver
(
preparer
=
preparer
,
wheel_cache
=
None
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录