Ai
1 Star 1 Fork 1

raychow-github/iOS-DeviceSupport

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
deploy.py 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env python
import argparse
import zipfile
from os import listdir, path
SRC = path.join(path.dirname(path.abspath(__file__)), 'DeviceSupport')
DEVICE_SUPPORT_PATH='Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport'
def unzip_file(name, target):
f = path.join(SRC, name + '.zip')
zip_ref = zipfile.ZipFile(f, 'r')
zip_ref.extractall(target)
zip_ref.close()
def process(xcode, version):
target = path.join(xcode, DEVICE_SUPPORT_PATH)
exist = listdir(target)
all_files = [i.replace('.zip', '') for i in listdir(SRC) if i.endswith('.zip')]
new_files = list(set(all_files) - set(exist))
if version:
new_files = list(filter(lambda x : version in x, new_files))
for i in new_files:
print 'Unzip file "{}.zip" to {}'.format(i, target)
unzip_file(i, target)
print '\nUpdate successfully for {}'.format(xcode)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'-t',
type=str,
dest='target',
default='/Applications/Xcode.app',
help='The path for Xcode'
)
parser.add_argument(
'-v',
type=str,
dest='version',
default=None,
help='Specific version (default is all)'
)
args = parser.parse_args()
process(args.target, args.version)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/raychow-github/iOS-DeviceSupport.git
git@gitee.com:raychow-github/iOS-DeviceSupport.git
raychow-github
iOS-DeviceSupport
iOS-DeviceSupport
master

搜索帮助