mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-12 08:58:51 -04:00
Relative/Remote paths work with upload-apk.py #453
This commit is contained in:
parent
09bfffd9e5
commit
b3be115ada
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"app_name": "PhET",
|
"app_name": "PhET",
|
||||||
"package": "org.kiwix.kiwixcustomphet",
|
"package": "org.kiwix.kiwixcustomphet",
|
||||||
"version_name": "2017-01",
|
"version_name": "2017-02",
|
||||||
"version_code": "3",
|
"version_code": "3",
|
||||||
"zim_file": "content.zim",
|
"zim_file": "content.zim",
|
||||||
"embed_zim": false,
|
"embed_zim": false,
|
||||||
|
@ -52,6 +52,8 @@ def syscall(args, shell=False, with_print=True):
|
|||||||
args = ' '.join(args)
|
args = ' '.join(args)
|
||||||
call(args, shell=shell)
|
call(args, shell=shell)
|
||||||
|
|
||||||
|
def move_to_current_folder():
|
||||||
|
os.chdir(CURRENT_PATH)
|
||||||
|
|
||||||
def get_remote_content(url):
|
def get_remote_content(url):
|
||||||
''' file descriptor from remote file using GET '''
|
''' file descriptor from remote file using GET '''
|
||||||
@ -156,6 +158,21 @@ def upload_to_play_store(jsdata, channel=None):
|
|||||||
apk_file = os.path.join(CURRENT_PATH, 'build', 'outputs', 'apk',
|
apk_file = os.path.join(CURRENT_PATH, 'build', 'outputs', 'apk',
|
||||||
'{}-{}.apk'.format(package_name, version_name))
|
'{}-{}.apk'.format(package_name, version_name))
|
||||||
|
|
||||||
|
json_file_dir = os.path.abspath(os.path.dirname(jspath))
|
||||||
|
|
||||||
|
# download remote zim file
|
||||||
|
if is_remote_path(jsdata.get('zim_file')):
|
||||||
|
zimfile_url = jsdata.get('zim_file')
|
||||||
|
remote_filename = get_remote_file_name(zimfile_url)
|
||||||
|
local_file_path = os.path.join(json_file_dir, remote_filename)
|
||||||
|
download_remote_file(zimfile_url, local_file_path)
|
||||||
|
jsdata.update({'zim_file': local_file_path})
|
||||||
|
|
||||||
|
# update relative paths to absolute
|
||||||
|
os.chdir(json_file_dir)
|
||||||
|
jsdata.update({'zim_file': os.path.abspath(jsdata.get('zim_file'))})
|
||||||
|
move_to_current_folder()
|
||||||
|
|
||||||
if not jsdata.get('embed_zim', False):
|
if not jsdata.get('embed_zim', False):
|
||||||
comp_file = tempfile.NamedTemporaryFile(suffix='.a').name
|
comp_file = tempfile.NamedTemporaryFile(suffix='.a').name
|
||||||
copy_to(jsdata['zim_file'], comp_file)
|
copy_to(jsdata['zim_file'], comp_file)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user