Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
pyporter
提交
3787eec6
P
pyporter
项目概览
openeuler
/
pyporter
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pyporter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3787eec6
编写于
7月 03, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
7月 03, 2020
浏览文件
操作
浏览文件
下载
差异文件
!8 check to avoid to download the source file again when debugging
Merge pull request !8 from GuanYL/master
上级
79d75982
e5b65c59
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
5 deletion
+29
-5
pyporter
pyporter
+29
-5
未找到文件。
pyporter
浏览文件 @
3787eec6
...
...
@@ -30,6 +30,7 @@ import subprocess
import
os
import
platform
from
pathlib
import
Path
import
hashlib
# python3-wget is not default available on openEuler yet.
# import wget
...
...
@@ -107,16 +108,26 @@ class PyPorter:
return
ks
[
2
].
strip
()
return
""
def
get_source_
url
(
self
):
def
get_source_
info
(
self
):
"""
return
URL for source file for the latest version
return
""
in errors
return
a map of source filename, md5 of source, source url
return
None
in errors
"""
v
=
self
.
__json
[
"info"
][
"version"
]
rs
=
self
.
__json
[
"releases"
][
v
]
for
r
in
rs
:
if
r
[
"packagetype"
]
==
"sdist"
:
return
r
[
"url"
]
return
{
"filename"
:
r
[
"filename"
],
"md5"
:
r
[
"md5_digest"
],
"url"
:
r
[
"url"
]}
return
None
def
get_source_url
(
self
):
"""
return URL for source file for the latest version
return "" in errors
"""
s_info
=
self
.
get_source_info
()
if
s_info
:
return
s_info
.
get
(
"url"
)
return
""
def
get_requires
(
self
):
...
...
@@ -289,7 +300,20 @@ def download_source(porter, tgtpath):
if
(
os
.
path
.
exists
(
tgtpath
)
==
False
):
print
(
"download path %s does not exist
\n
"
,
tgtpath
)
return
False
s_url
=
porter
.
get_source_url
()
s_info
=
porter
.
get_source_info
()
if
s_info
is
None
:
print
(
"analyze source info error"
)
return
False
s_url
=
s_info
.
get
(
"url"
)
s_path
=
os
.
path
.
join
(
tgtpath
,
s_info
.
get
(
"filename"
))
if
os
.
path
.
exists
(
s_path
):
with
open
(
s_path
,
'rb'
)
as
f
:
md5obj
=
hashlib
.
md5
()
md5obj
.
update
(
f
.
read
())
_hash
=
str
(
md5obj
.
hexdigest
()).
lower
()
if
s_info
.
get
(
"md5"
)
==
_hash
:
print
(
"same source file exists, skip"
)
return
True
return
subprocess
.
call
([
"wget"
,
s_url
,
"-P"
,
tgtpath
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录