diff --git a/custom/phet/info.json b/custom/phet/info.json index a8569cd60..64b009492 100644 --- a/custom/phet/info.json +++ b/custom/phet/info.json @@ -1,7 +1,7 @@ { "app_name": "PhET", "package": "org.kiwix.kiwixcustomphet", - "version_name": "2017-01", + "version_name": "2017-02", "version_code": "3", "zim_file": "content.zim", "embed_zim": false, diff --git a/upload-apk.py b/upload-apk.py index e0570bf66..1f0bfedd9 100755 --- a/upload-apk.py +++ b/upload-apk.py @@ -52,6 +52,8 @@ def syscall(args, shell=False, with_print=True): args = ' '.join(args) call(args, shell=shell) +def move_to_current_folder(): + os.chdir(CURRENT_PATH) def get_remote_content(url): ''' 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'.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): comp_file = tempfile.NamedTemporaryFile(suffix='.a').name copy_to(jsdata['zim_file'], comp_file)