Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Pdm
提交
41b148ed
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,发现更多精彩内容 >>
未验证
提交
41b148ed
编写于
3月 29, 2020
作者:
F
Frost Ming
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ensure wheel package is installed
上级
965d3a93
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
23 deletion
+50
-23
news/90.bugfix
news/90.bugfix
+1
-0
pdm/installers.py
pdm/installers.py
+24
-20
pdm/iostream.py
pdm/iostream.py
+6
-2
pdm/models/environment.py
pdm/models/environment.py
+19
-1
未找到文件。
news/90.bugfix
0 → 100644
浏览文件 @
41b148ed
Ensure `wheel` package is available before building packages.
pdm/installers.py
浏览文件 @
41b148ed
...
...
@@ -433,7 +433,7 @@ class Synchronizer:
elif
not
_is_dist_editable
(
dist
)
and
dist
.
version
!=
can
.
version
:
# XXX: An editable distribution is always considered as consistent.
to_update
.
append
(
key
)
elif
key
not
in
self
.
all_candidates
:
elif
key
not
in
self
.
all_candidates
and
key
!=
"wheel"
:
# Remove package only if it is not required by any section
to_remove
.
append
(
key
)
to_add
=
list
(
...
...
@@ -596,22 +596,26 @@ class Synchronizer:
)
if
key
in
self
.
SEQUENTIAL_PACKAGES
:
future
.
result
()
# End installation
self
.
summarize
(
result
)
if
not
any
(
failed
.
values
()):
return
stream
.
echo
(
stream
.
red
(
"[ERROR]"
,
bold
=
True
))
if
failed
[
"add"
]
+
failed
[
"update"
]:
stream
.
echo
(
f
"Installation failed:
{
', '
.
join
(
failed
[
'add'
]
+
failed
[
'update'
])
}
"
)
if
failed
[
"remove"
]:
stream
.
echo
(
f
"Removal failed:
{
', '
.
join
(
failed
[
'remove'
])
}
"
)
for
error
in
errors
:
stream
.
echo
(
""
.
join
(
traceback
.
format_exception
(
type
(
error
),
error
,
error
.
__traceback__
)
),
verbosity
=
stream
.
DEBUG
,
)
raise
InstallationError
()
# End installation
self
.
summarize
(
result
)
if
not
any
(
failed
.
values
()):
return
stream
.
echo
(
"
\n
"
)
error_msg
=
[]
if
failed
[
"add"
]
+
failed
[
"update"
]:
error_msg
.
append
(
"Installation failed: "
f
"
{
', '
.
join
(
failed
[
'add'
]
+
failed
[
'update'
])
}
"
)
if
failed
[
"remove"
]:
error_msg
.
append
(
f
"Removal failed:
{
', '
.
join
(
failed
[
'remove'
])
}
"
)
for
error
in
errors
:
stream
.
echo
(
""
.
join
(
traceback
.
format_exception
(
type
(
error
),
error
,
error
.
__traceback__
)
),
verbosity
=
stream
.
DEBUG
,
)
raise
InstallationError
(
"
\n
"
+
"
\n
"
.
join
(
error_msg
))
pdm/iostream.py
浏览文件 @
41b148ed
...
...
@@ -91,7 +91,10 @@ class IOStream:
logger
=
logging
.
getLogger
(
__name__
)
logger
.
setLevel
(
logging
.
DEBUG
)
handler
=
logging
.
FileHandler
(
file_name
,
encoding
=
"utf-8"
)
if
self
.
verbosity
>=
self
.
DETAIL
:
handler
=
logging
.
StreamHandler
()
else
:
handler
=
logging
.
FileHandler
(
file_name
,
encoding
=
"utf-8"
)
handler
.
setLevel
(
logging
.
DEBUG
)
logger
.
addHandler
(
handler
)
pip_logger
=
logging
.
getLogger
(
"pip"
)
...
...
@@ -100,7 +103,8 @@ class IOStream:
self
.
logger
=
logger
yield
logger
except
Exception
:
self
.
echo
(
self
.
yellow
(
f
"See
{
file_name
}
for detailed debug log."
))
if
self
.
verbosity
<
self
.
DETAIL
:
self
.
echo
(
self
.
yellow
(
f
"See
{
file_name
}
for detailed debug log."
))
raise
else
:
try
:
...
...
pdm/models/environment.py
浏览文件 @
41b148ed
...
...
@@ -82,6 +82,7 @@ class Environment:
"""
self
.
python_requires
=
project
.
python_requires
self
.
project
=
project
self
.
_wheel_ensured
=
False
@
cached_property
def
python_executable
(
self
)
->
str
:
...
...
@@ -307,7 +308,11 @@ class Environment:
# Now all source is prepared, build it.
if
ireq
.
link
.
is_wheel
:
return
(
self
.
project
.
cache
(
"wheels"
)
/
ireq
.
link
.
filename
).
as_posix
()
builder_class
=
EditableBuilder
if
ireq
.
editable
else
WheelBuilder
if
ireq
.
editable
:
builder_class
=
EditableBuilder
else
:
builder_class
=
WheelBuilder
self
.
ensure_wheel_package
()
kwargs
[
"finder"
]
=
finder
with
builder_class
(
ireq
)
as
builder
,
self
.
activate
():
return
builder
.
build
(
**
kwargs
)
...
...
@@ -335,6 +340,19 @@ class Environment:
# Fallback to use shutil.which to find the executable
return
shutil
.
which
(
command
,
path
=
os
.
getenv
(
"PATH"
))
def
ensure_wheel_package
(
self
)
->
None
:
"""Ensure wheel package is available and install if it isn't."""
from
pdm.installers
import
Installer
from
pdm.models.requirements
import
parse_requirement
from
pdm.models.candidates
import
Candidate
if
self
.
_wheel_ensured
or
"wheel"
in
self
.
get_working_set
():
return
req
=
parse_requirement
(
"wheel"
)
candidate
=
Candidate
(
req
,
self
,
"wheel"
)
Installer
(
self
).
install
(
candidate
)
self
.
_wheel_ensured
=
True
class
GlobalEnvironment
(
Environment
):
"""Global environment"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录