diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 6cac71b93..481307aa4 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -100,7 +100,6 @@ def __init__(self, *args, **kwargs): else: self.extra_p4a_args += ' --ignore-setup-py' - activity_class_name = self.buildozer.config.getdefault( 'app', 'android.activity_class_name', 'org.kivy.android.PythonActivity') if activity_class_name != 'org.kivy.android.PythonActivity': diff --git a/buildozer/targets/ios.py b/buildozer/targets/ios.py index 5323763c1..8c8d61961 100644 --- a/buildozer/targets/ios.py +++ b/buildozer/targets/ios.py @@ -133,6 +133,14 @@ def get_available_packages(self): available_modules = self.toolchain("recipes --compact", get_stdout=True)[0] return available_modules.splitlines()[0].split() + def load_plist_from_file(self, plist_rfn): + with open(plist_rfn, 'rb') as f: + return plistlib.load(f) + + def dump_plist_to_file(self, plist, plist_rfn): + with open(plist_rfn, 'wb') as f: + plistlib.dump(plist, f) + def compile_platform(self): # for ios, the compilation depends really on the app requirements. # compile the distribution only if the requirements changed. @@ -207,8 +215,7 @@ def build_package(self): plist_rfn = join(self.app_project_dir, plist_fn) version = self.buildozer.get_version() self.buildozer.info('Update Plist {}'.format(plist_fn)) - with open(plist_rfn, 'rb') as f: - plist = plistlib.load(f) + plist = self.load_plist_from_file(plist_rfn) plist['CFBundleIdentifier'] = self._get_package() plist['CFBundleShortVersionString'] = version plist['CFBundleVersion'] = '{}.{}'.format(version, @@ -236,8 +243,7 @@ def build_package(self): } # ok, write the modified plist. - with open(plist_rfn, 'wb') as f: - plistlib.dump(plist, f) + self.dump_plist_to_file(plist, plist_rfn) mode = self.build_mode.capitalize() self.xcodebuild( diff --git a/tests/targets/test_android.py b/tests/targets/test_android.py index 94ee1e05f..9d2f0b490 100644 --- a/tests/targets/test_android.py +++ b/tests/targets/test_android.py @@ -116,7 +116,7 @@ def test_init(self): assert ( target_android.extra_p4a_args == ( ' --color=always' - ' --storage-dir="{buildozer_dir}/android/platform/build-armeabi-v7a" --ndk-api=21 --ignore-setup-py'.format( + ' --storage-dir="{buildozer_dir}/android/platform/build-armeabi-v7a" --ndk-api=21 --ignore-setup-py --debug'.format( buildozer_dir=buildozer.buildozer_dir) ) ) diff --git a/tests/targets/test_ios.py b/tests/targets/test_ios.py index 862d11ab1..bf6ca812f 100644 --- a/tests/targets/test_ios.py +++ b/tests/targets/test_ios.py @@ -182,10 +182,10 @@ def test_build_package_no_signature(self): # fmt: off with patch_target_ios("_unlock_keychain") as m_unlock_keychain, \ patch_buildozer_error() as m_error, \ - mock.patch("buildozer.targets.ios.plistlib.readPlist") as m_readplist, \ - mock.patch("buildozer.targets.ios.plistlib.writePlist") as m_writeplist, \ + mock.patch("buildozer.targets.ios.TargetIos.load_plist_from_file") as m_load_plist_from_file, \ + mock.patch("buildozer.targets.ios.TargetIos.dump_plist_to_file") as m_dump_plist_to_file, \ patch_buildozer_cmd() as m_cmd: - m_readplist.return_value = {} + m_load_plist_from_file.return_value = {} target.build_package() # fmt: on assert m_unlock_keychain.call_args_list == [mock.call()] @@ -195,10 +195,10 @@ def test_build_package_no_signature(self): 'You must fill the "ios.codesign.debug" token.' ) ] - assert m_readplist.call_args_list == [ + assert m_load_plist_from_file.call_args_list == [ mock.call("/ios/dir/myapp-ios/myapp-Info.plist") ] - assert m_writeplist.call_args_list == [ + assert m_dump_plist_to_file.call_args_list == [ mock.call( { "CFBundleIdentifier": "org.test.myapp",