1 Star 0 Fork 70

张先生01/ascend-deployer

forked from Ascend/ascend-deployer 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
setup.py 2.76 KB
一键复制 编辑 原始数据 按行查看 历史
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===========================================================================
"""setup package."""
import os
import glob
import stat
import shutil
import setuptools
cache_folder = ('*egg-info', 'build')
def clean():
for pattern in cache_folder:
for name in glob.glob(pattern):
if os.path.exists(name):
shutil.rmtree(name)
def crlf_to_lf(file_path):
with os.fdopen(os.open(file_path, os.O_RDONLY, 0o640), 'r', encoding='utf-8') as src:
content = src.read()
os.chmod(file_path, stat.S_IWRITE)
with open(file_path, 'w', newline='\n', encoding='utf-8') as dst:
dst.write(content.replace('\r\n', '\n'))
def handle_shell_scripts():
cur_dir = os.path.abspath(os.path.dirname(__file__))
for base, dirs, files in os.walk(os.path.join(cur_dir, 'ascend_deployer')):
for file_name in files:
file_path = os.path.join(base, file_name)
if not file_path.endswith('.sh'):
continue
crlf_to_lf(file_path)
os.umask(stat.S_IRWXG | stat.S_IRWXO)
os.chmod('ascend_deployer/install.sh', stat.S_IEXEC | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP)
os.chmod('ascend_deployer/start_download.sh', stat.S_IEXEC | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP)
clean()
handle_shell_scripts()
with open('README.rst', encoding='utf-8') as f:
readme = f.read()
setuptools.setup(
name='ascend-deployer',
version='0.0.3',
description='ascend offline installer',
url='https://gitee.com/ascend/ascend-deployer',
long_description_content_type="text/x-rst",
long_description=readme,
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent'
],
license='Apache',
python_requires='>= 3.6',
include_package_data=True,
package_dir={'downloader': 'ascend_deployer/downloader', 'playbooks': 'ascend_deployer/playbooks'},
packages=['ascend_deployer'],
entry_points={ # Optional
'console_scripts': [
'ascend-download=ascend_deployer.ascend_download:main',
'ascend-deployer=ascend_deployer.ascend_deployer:main'
]
},
)
clean()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mr_zhang_01/ascend-deployer.git
git@gitee.com:mr_zhang_01/ascend-deployer.git
mr_zhang_01
ascend-deployer
ascend-deployer
dev

搜索帮助