@@ -1043,48 +1043,48 @@ def _finish_package(self, args, output, build_args, package_type, output_dir):
10431043 :param output_dir: where to put the package file
10441044 """
10451045
1046- with current_directory (self ._dist .dist_dir ):
1047- package_glob = "*-{}.%s" % package_type
1048- package_add_version = True
1049-
1050- self .hook ("after_apk_assemble" )
1051-
1052- info_main ('# Copying android package to current directory' )
1053-
1054- package_re = re .compile (r'.*Package: (.*\.apk)$' )
1055- package_file = None
1056- for line in reversed (output .splitlines ()):
1057- m = package_re .match (line )
1058- if m :
1059- package_file = m .groups ()[0 ]
1046+ package_glob = "*-{}.%s" % package_type
1047+ package_add_version = True
1048+
1049+ self .hook ("after_apk_assemble" )
1050+
1051+ info_main ('# Copying android package to current directory' )
1052+
1053+ package_re = re .compile (r'.*Package: (.*\.apk)$' )
1054+ package_file = None
1055+ for line in reversed (output .splitlines ()):
1056+ m = package_re .match (line )
1057+ if m :
1058+ package_file = m .groups ()[0 ]
1059+ break
1060+ if not package_file :
1061+ info_main ('# Android package filename not found in build output. Guessing...' )
1062+ if args .build_mode == "release" :
1063+ suffixes = ("release" , "release-unsigned" )
1064+ else :
1065+ suffixes = ("debug" , )
1066+ for suffix in suffixes :
1067+
1068+ package_files = glob .glob (join (output_dir , package_glob .format (suffix )))
1069+ if package_files :
1070+ if len (package_files ) > 1 :
1071+ info ('More than one built APK found... guessing you '
1072+ 'just built {}' .format (package_files [- 1 ]))
1073+ package_file = package_files [- 1 ]
10601074 break
1061- if not package_file :
1062- info_main ('# Android package filename not found in build output. Guessing...' )
1063- if args .build_mode == "release" :
1064- suffixes = ("release" , "release-unsigned" )
1065- else :
1066- suffixes = ("debug" , )
1067- for suffix in suffixes :
1068- package_files = glob .glob (join (output_dir , package_glob .format (suffix )))
1069- if package_files :
1070- if len (package_files ) > 1 :
1071- info ('More than one built APK found... guessing you '
1072- 'just built {}' .format (package_files [- 1 ]))
1073- package_file = package_files [- 1 ]
1074- break
1075- else :
1076- raise BuildInterruptingException ('Couldn\' t find the built APK' )
1077-
1078- info_main ('# Found android package file: {}' .format (package_file ))
1079- if package_add_version :
1080- info ('# Add version number to android package' )
1081- package_name = basename (package_file )[:- len (APK_SUFFIX )]
1082- package_file_dest = "{}-{}-{}" .format (
1083- package_name , build_args .version , APK_SUFFIX )
1084- info ('# Android package renamed to {}' .format (package_file_dest ))
1085- shprint (sh .cp , package_file , package_file_dest )
10861075 else :
1087- shprint (sh .cp , package_file , './' )
1076+ raise BuildInterruptingException ('Couldn\' t find the built APK' )
1077+
1078+ info_main ('# Found android package file: {}' .format (package_file ))
1079+ if package_add_version :
1080+ info ('# Add version number to android package' )
1081+ package_name = basename (package_file )[:- len (APK_SUFFIX )]
1082+ package_file_dest = "{}-{}-{}" .format (
1083+ package_name , build_args .version , APK_SUFFIX )
1084+ info ('# Android package renamed to {}' .format (package_file_dest ))
1085+ shprint (sh .cp , package_file , package_file_dest )
1086+ else :
1087+ shprint (sh .cp , package_file , './' )
10881088
10891089 @require_prebuilt_dist
10901090 def apk (self , args ):
0 commit comments