Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
5aca64da
M
mindinsight
项目概览
MindSpore
/
mindinsight
通知
7
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindinsight
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5aca64da
编写于
8月 03, 2020
作者:
L
liangyongxiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add tips on building failure
上级
42b5acf4
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
49 addition
and
28 deletion
+49
-28
setup.py
setup.py
+49
-28
未找到文件。
setup.py
浏览文件 @
5aca64da
...
...
@@ -30,7 +30,12 @@ from setuptools.command.install import install
def
get_version
():
"""Get version."""
"""
Get version.
Returns:
str, mindinsight version.
"""
machinery
=
import_module
(
'importlib.machinery'
)
version_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'mindinsight'
,
'_version.py'
)
module_name
=
'__mindinsightversion__'
...
...
@@ -40,15 +45,24 @@ def get_version():
return
version_module
.
VERSION
def
get_os
():
"""Get OS."""
os_system
=
platform
.
system
().
lower
()
return
os_system
def
get_platform
():
"""
Get platform name.
Returns:
str, platform name in lowercase.
"""
return
platform
.
system
().
lower
()
def
get_description
():
"""Get description."""
os_info
=
get_os
()
"""
Get description.
Returns:
str, wheel package description.
"""
os_info
=
get_platform
()
cpu_info
=
platform
.
machine
()
cmd
=
"git log --format='[sha1]:%h, [branch]:%d' -1"
...
...
@@ -68,7 +82,12 @@ def get_description():
def
get_install_requires
():
"""Get install requirements."""
"""
Get install requirements.
Returns:
list, list of dependent packages.
"""
with
open
(
'requirements.txt'
)
as
file
:
return
file
.
read
().
splitlines
()
...
...
@@ -95,15 +114,34 @@ def run_script(script):
Args:
script (str): Target script file path.
Returns:
int, return code.
"""
cmd
=
'/bin/bash {}'
.
format
(
script
)
process
=
subprocess
.
Popen
(
shlex
.
split
(
cmd
),
shell
=
False
)
return
process
.
wait
()
rc
=
process
.
wait
()
def
build_dependencies
():
"""Build dependencies."""
build_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'build'
)
sys
.
stdout
.
write
(
'building crc32 ...
\n
'
)
crc32_script
=
os
.
path
.
join
(
build_dir
,
'scripts'
,
'crc32.sh'
)
rc
=
run_script
(
crc32_script
)
if
rc
:
sys
.
stdout
.
write
(
'building crc32 failure
\n
'
)
sys
.
exit
(
1
)
sys
.
stdout
.
write
(
'building ui ...
\n
'
)
ui_script
=
os
.
path
.
join
(
build_dir
,
'scripts'
,
'ui.sh'
)
rc
=
run_script
(
ui_script
)
if
rc
:
sys
.
stdout
.
write
(
'building ui failure
\n
'
)
sys
.
exit
(
1
)
...
...
@@ -111,26 +149,12 @@ class EggInfo(egg_info):
"""Egg info."""
def
run
(
self
):
self
.
build_dependencies
()
build_dependencies
()
egg_info_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'mindinsight.egg-info'
)
shutil
.
rmtree
(
egg_info_dir
,
ignore_errors
=
True
)
super
().
run
()
update_permissions
(
egg_info_dir
)
def
build_dependencies
(
self
):
build_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'build'
)
sys
.
stdout
.
write
(
'building crc32 ...
\n
'
)
crc32_script
=
os
.
path
.
join
(
build_dir
,
'scripts'
,
'crc32.sh'
)
run_script
(
crc32_script
)
sys
.
stdout
.
write
(
'building ui ...
\n
'
)
ui_script
=
os
.
path
.
join
(
build_dir
,
'scripts'
,
'ui.sh'
)
run_script
(
ui_script
)
class
BuildPy
(
build_py
):
"""Build py files."""
...
...
@@ -138,9 +162,7 @@ class BuildPy(build_py):
def
run
(
self
):
mindinsight_lib_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'build'
,
'lib'
,
'mindinsight'
)
shutil
.
rmtree
(
mindinsight_lib_dir
,
ignore_errors
=
True
)
super
().
run
()
update_permissions
(
mindinsight_lib_dir
)
...
...
@@ -149,7 +171,6 @@ class Install(install):
def
run
(
self
):
super
().
run
()
if
sys
.
argv
[
-
1
]
==
'install'
:
pip
=
import_module
(
'pip'
)
mindinsight_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
pip
.
__path__
[
0
]),
'mindinsight'
)
...
...
@@ -175,7 +196,7 @@ if __name__ == '__main__':
},
description
=
get_description
(),
packages
=
[
'mindinsight'
],
platforms
=
[
get_
os
()],
platforms
=
[
get_
platform
()],
include_package_data
=
True
,
cmdclass
=
{
'egg_info'
:
EggInfo
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录