Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
pyporter
提交
c0f25a06
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 搜索 >>
提交
c0f25a06
编写于
7月 11, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
7月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
!13 delete useused code
Merge pull request !13 from GuanYL/delete_unused
上级
3787eec6
80862a53
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
0 addition
and
164 deletion
+0
-164
README.md
README.md
+0
-8
pyporter_run
pyporter_run
+0
-156
未找到文件。
README.md
浏览文件 @
c0f25a06
...
...
@@ -21,14 +21,6 @@ For more details, please use pyporter -h
pyporter
<package>
-s -b -d -o python-
<package>
.spec
pyporter_run is a wrapper tool for pyporter, which analyze the dependency
of the python modules and build & install them automatically.
Usage :
pyporter_run PKG_MODULE_NAME
Notice : please run pyporter_run with sudo privilages
#### Contribution
1.
Fork the repository
...
...
pyporter_run
已删除
100755 → 0
浏览文件 @
3787eec6
#!/usr/bin/python3
"""
This is a packager bot for python modules from pypi.org
"""
#******************************************************************************
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
# licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
# PURPOSE.
# See the Mulan PSL v2 for more details.
# Author: Shinwell_Hu Myeuler
# Create: 2020-05-07
# Description: This is a helper tools for pyporter
# ******************************************************************************/
from
pprint
import
pprint
from
os
import
path
import
json
import
sys
import
re
import
datetime
import
argparse
import
subprocess
import
os
from
pathlib
import
Path
import
queue
def
pkg_installed
(
pkg
):
#ret = subprocess.call(["rpm", "-qi", pkg], stdout=subprocess.PIPE)
ret
=
subprocess
.
call
([
"rpm"
,
"-qi"
,
pkg
])
if
(
ret
==
0
):
return
True
# try to install it
ret
=
subprocess
.
call
([
"yum"
,
"install"
,
"-y"
,
pkg
])
if
(
ret
==
0
):
return
True
return
False
def
circle_dep
(
pkg
,
prepare
):
for
ppg
in
prepare
:
if
(
ppg
==
pkg
):
return
True
return
False
def
issue_analysis
(
prepare
):
while
(
len
(
prepare
)
!=
0
):
pkg
=
prepare
.
pop
(
0
)
bpkg
=
pkg
.
replace
(
"python3-"
,
""
)
deps
=
get_deps
(
bpkg
)
if
(
len
(
deps
)
<
2
):
continue
if
(
deps
[
1
]
==
False
):
print
(
"Get module %s failed
\n
"
%
pkg
)
return
False
if
(
len
(
deps
[
0
])
==
0
):
ret
=
build_install_pkg
(
pkg
)
if
(
ret
==
False
):
return
False
else
:
#
# push back to stack
#
prepare
.
insert
(
0
,
pkg
)
for
req
in
deps
[
0
]:
if
(
circle_dep
(
req
,
prepare
)):
print
(
"There is circle dependency"
)
print
(
prepare
)
print
(
bpkg
)
return
False
else
:
prepare
.
insert
(
0
,
req
)
return
True
def
do_prepare_job
(
pkgs
):
pkg_prepare
=
[]
for
pkg
in
pkgs
:
pkg_prepare
.
append
(
pkg
)
if
(
len
(
pkg_prepare
)
==
0
):
return
True
return
issue_analysis
(
pkg_prepare
)
def
build_install_pkg
(
pkg
):
print
(
"Build&Install : %s
\n
"
%
pkg
)
bpkg
=
pkg
.
replace
(
"python3-"
,
""
)
# ret = subprocess.call(["./pyporter", "-B", bpkg], stdout=subprocess.PIPE)
ret
=
subprocess
.
call
([
"./pyporter"
,
"-B"
,
bpkg
])
if
(
ret
!=
0
):
print
(
" Build&Install package %s failed
\n
"
%
pkg
)
return
False
return
True
def
do_pkg_check
(
pkg
):
"""
For the reason that json file may have some misinfo, need to add a checklist
to refine the package name
"""
if
(
pkg
==
"python3-cython"
):
pkg
=
"python3-Cython"
return
pkg
def
get_deps
(
pkg
):
needed
=
[]
proc
=
subprocess
.
Popen
([
"./pyporter"
,
"-R"
,
pkg
],
stdout
=
subprocess
.
PIPE
)
#if (proc.returncode != 0):
# return (needed, False)
while
(
True
):
line
=
proc
.
stdout
.
readline
()
if
not
line
:
break
;
newpkg
=
do_pkg_check
(
str
(
line
.
strip
().
decode
()))
if
(
pkg_installed
(
newpkg
)
==
False
):
needed
.
append
(
newpkg
)
proc
.
stdout
.
close
()
proc
.
wait
()
return
(
needed
,
True
)
if
__name__
==
"__main__"
:
ret
=
True
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"pkg"
,
type
=
str
,
help
=
"The python module name"
)
args
=
parser
.
parse_args
()
reqs
=
get_deps
(
args
.
pkg
)
if
(
reqs
[
1
]
==
False
):
print
(
"Get deps failed
\n
"
)
sys
.
exit
(
1
)
if
(
len
(
reqs
[
0
])
!=
0
):
ret
=
do_prepare_job
(
reqs
[
0
])
if
(
ret
==
True
):
build_install_pkg
(
args
.
pkg
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录