Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
sun
Commits
85ef596e
Commit
85ef596e
authored
Mar 05, 2019
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改上传逻辑
parent
637cf7cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
11 deletions
+5
-11
tasks.py
api/tasks/tasks.py
+1
-1
channel_package_tools.py
utils/channel_package_tools.py
+4
-10
No files found.
api/tasks/tasks.py
View file @
85ef596e
...
@@ -50,7 +50,7 @@ def channel_build(version=None, channels=None, data=None, ):
...
@@ -50,7 +50,7 @@ def channel_build(version=None, channels=None, data=None, ):
return
return
info_logger
.
debug
(
channels
)
info_logger
.
debug
(
channels
)
chn_pkg
=
ChannelPackage
(
data
,
version
)
chn_pkg
=
ChannelPackage
(
target_path
,
version
)
# 遍历渠道号并创建对应渠道号的apk文件
# 遍历渠道号并创建对应渠道号的apk文件
for
channel
in
channels
:
for
channel
in
channels
:
build_one_channel
(
chn_pkg
,
channel
)
build_one_channel
(
chn_pkg
,
channel
)
...
...
utils/channel_package_tools.py
View file @
85ef596e
...
@@ -45,35 +45,29 @@ class ChannelPackage(object):
...
@@ -45,35 +45,29 @@ class ChannelPackage(object):
self
.
apk
=
None
self
.
apk
=
None
@classmethod
@classmethod
def
get_parent_path
(
cls
,
data
):
def
get_parent_path
(
cls
,
data
):
# 母包地址
path
=
os
.
getcwd
()
+
'/'
+
cls
.
channel_prefix
+
'
_parent
.apk'
path
=
os
.
getcwd
()
+
'/'
+
cls
.
channel_prefix
+
'.apk'
with
open
(
path
,
'wb'
)
as
fw
:
with
open
(
path
,
'wb'
)
as
fw
:
fw
.
write
(
data
)
fw
.
write
(
data
)
return
path
return
path
def
build_channel_apk
(
self
,
channel_name
):
def
build_channel_apk
(
self
,
channel_name
):
cp
=
re
.
compile
(
r'[^{}]+'
)
cp
=
re
.
compile
(
r'[^{}]+'
)
self
.
apk
=
self
.
channel_prefix
+
'.apk'
walle_cli_path
=
os
.
getcwd
()
+
'/walle-cli-all.jar'
walle_cli_path
=
os
.
getcwd
()
+
'/walle-cli-all.jar'
with
open
(
self
.
apk
,
'wb'
)
as
fw
:
os
.
system
(
'java -jar {0} batch -c {1} {2}'
.
format
(
walle_cli_path
,
channel_name
,
self
.
apk_data
))
fw
.
write
(
self
.
apk_data
)
# 母包
os
.
system
(
'java -jar {0} batch -c {1} {2}'
.
format
(
walle_cli_path
,
channel_name
,
self
.
apk
))
# with open(self.channel_prefix + '_' + channel_name + '.apk', 'rb') as fr:
# data = fr.read()
targe_apk
=
self
.
channel_prefix
+
'_'
+
channel_name
+
'.apk'
targe_apk
=
self
.
channel_prefix
+
'_'
+
channel_name
+
'.apk'
cmd_res
=
os
.
popen
(
'java -jar walle-cli-all.jar show
%
s'
%
targe_apk
)
cmd_res
=
os
.
popen
(
'java -jar walle-cli-all.jar show
%
s'
%
targe_apk
)
ret_res
=
cmd_res
.
readlines
()[
0
]
ret_res
=
cmd_res
.
readlines
()[
0
]
target_channel_info
=
cp
.
findall
(
ret_res
)[
1
]
target_channel_info
=
cp
.
findall
(
ret_res
)[
1
]
if
target_channel_info
and
channel_name
==
target_channel_info
.
split
(
'='
)[
1
]:
if
target_channel_info
and
channel_name
==
target_channel_info
.
split
(
'='
)[
1
]:
target_path
=
self
.
channel_prefix
+
'_'
+
channel_name
+
'.apk'
target_path
=
self
.
channel_prefix
+
'_'
+
channel_name
+
'.apk'
os
.
remove
(
self
.
apk
)
return
target_path
return
target_path
else
:
else
:
log_error
()
log_error
()
os
.
remove
(
self
.
apk
)
os
.
remove
(
self
.
apk
)
os
.
remove
(
self
.
channel_prefix
+
'_'
+
channel_name
+
'.apk'
)
os
.
remove
(
self
.
channel_prefix
+
'_'
+
channel_name
+
'.apk'
)
def
upload_apk
(
self
,
channel_name
):
# zhuoyi
def
upload_apk
(
self
,
channel_name
):
chn_apk_path
=
self
.
build_channel_apk
(
channel_name
)
chn_apk_path
=
self
.
build_channel_apk
(
channel_name
)
apk_uri
=
self
.
apk_key
(
channel_name
,
self
.
version
)
apk_uri
=
self
.
apk_key
(
channel_name
,
self
.
version
)
QiniuTool
.
delete
(
apk_uri
,
settings
.
APK_SCOPE
)
QiniuTool
.
delete
(
apk_uri
,
settings
.
APK_SCOPE
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment