1 Star 0 Fork 0

ForkRepoCenter/xbmc-addons-chinese

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
release.py 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
taxigps 提交于 2020-04-14 23:38 . initial commit
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" plugin release tool"""
import os, sys, re, zipfile, shutil
def cp(src, dst):
if os.path.exists(src):
shutil.copyfile(src, dst)
def release(plugin, version):
# zip dir
zipdir = 'repo/%s' % (plugin)
if not os.path.exists(zipdir):
os.mkdir(zipdir)
# zip repo
zipname = 'repo/%s/%s-%s.zip' % (plugin, plugin, version)
f = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED)
for dirpath, dirnames, filenames in os.walk(plugin):
for filename in filenames:
f.write(os.path.join(dirpath,filename))
f.close()
# copy icon
src = '%s/icon.png' % (plugin)
dst = 'repo/%s/icon.png' % (plugin)
cp(src, dst)
# copy change log
src = '%s/changelog.txt' % plugin
dst = 'repo/%s/changelog-%s.txt' % (plugin, version)
cp(src, dst)
def getVersion(plugin):
name = '%s/addon.xml' % plugin
if sys.version_info[0] >= 3:
cont = open(name,encoding='utf-8').read()
else:
cont = open(name).read()
addon = re.findall('<addon.*?version="(.*?)"', cont, re.DOTALL)
if addon:
return addon[0]
argc = len(sys.argv)
if argc >= 2:
plugin = sys.argv[1].rstrip('/')
version = getVersion(plugin) if argc == 2 else sys.argv[2]
release(plugin, version)
else:
print('usage: %s plugin_dir [plugin_version]' % sys.argv[0])
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ForkRepoCenter/xbmc-addons-chinese.git
git@gitee.com:ForkRepoCenter/xbmc-addons-chinese.git
ForkRepoCenter
xbmc-addons-chinese
xbmc-addons-chinese
matrix

搜索帮助

0d507c66 1850385 C8b1a773 1850385