Commit 97720d5e authored by 张永's avatar 张永

Merge branch 'feature/channel_package_zy' into 'dev'

修改apk上传逻辑

See merge request !83
parents b1dc2f80 5abda5d0
......@@ -34,7 +34,8 @@ def version_release_task(packed_channels, version_id=None, version=None): # 一
@shared_task
def channel_build_one(version=None, channel=None, data=None):
url = ChannelPackage.apk_url('', version)
r = requests.get(url)
r = requests.get(url, stream=True)
info_logger.debug(url)
chn_pkg = ChannelPackage(r.content, version)
build_one_channel(chn_pkg, channel)
......@@ -50,7 +51,7 @@ def channel_build(version=None, channels=None, data=None, ):
return
info_logger.debug(channels)
chn_pkg = ChannelPackage(target_path, version)
chn_pkg = ChannelPackage(data, version)
# 遍历渠道号并创建对应渠道号的apk文件
for channel in channels:
build_one_channel(chn_pkg, channel)
......
......@@ -53,14 +53,18 @@ class ChannelPackage(object):
def build_channel_apk(self, channel_name):
cp = re.compile(r'[^{}]+')
self.apk = self.channel_prefix + '.apk'
walle_cli_path = os.getcwd() + '/walle-cli-all.jar'
os.system('java -jar {0} batch -c {1} {2}'.format(walle_cli_path, channel_name, self.apk_data))
with open(self.apk, 'wb') as fw:
fw.write(self.apk_data)
os.system('java -jar {0} batch -c {1} {2}'.format(walle_cli_path, channel_name, self.apk))
targe_apk = self.channel_prefix + '_' + channel_name + '.apk'
cmd_res = os.popen('java -jar walle-cli-all.jar show %s' % targe_apk)
ret_res = cmd_res.readlines()[0]
target_channel_info = cp.findall(ret_res)[1]
if target_channel_info and channel_name == target_channel_info.split('=')[1]:
target_path = self.channel_prefix + '_' + channel_name + '.apk'
os.remove(self.apk)
return target_path
else:
log_error()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment