Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up inheritance of targets #1690

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions buildozer/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Target:
def __init__(self, buildozer):
self.buildozer = buildozer
self.build_mode = 'debug'
self.artifact_format = 'apk'
self.platform_update = False
self.logger = Logger()

Expand Down Expand Up @@ -106,7 +105,6 @@ def cmd_update(self, *args):
def cmd_debug(self, *args):
self.buildozer.prepare_for_build()
self.build_mode = 'debug'
self.artifact_format = self.buildozer.config.getdefault('app', 'android.debug_artifact', 'apk')
self.buildozer.build()

def cmd_release(self, *args):
Expand Down Expand Up @@ -143,7 +141,6 @@ def cmd_release(self, *args):
exit(1)

self.build_mode = 'release'
self.artifact_format = self.buildozer.config.getdefault('app', 'android.release_artifact', 'aab')
self.buildozer.build()

def cmd_deploy(self, *args):
Expand Down
11 changes: 11 additions & 0 deletions buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ class TargetAndroid(Target):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

self.artifact_format = 'apk'

if self.buildozer.config.has_option(
"app", "android.arch"
) and not self.buildozer.config.has_option("app", "android.archs"):
Expand Down Expand Up @@ -989,6 +992,14 @@ def check_p4a_sign_env(self, error=False):
check = False
return check

def cmd_debug(self, *args):
self.artifact_format = self.buildozer.config.getdefault('app', 'android.debug_artifact', 'apk')
super().cmd_debug(*args)

def cmd_release(self, *args):
self.artifact_format = self.buildozer.config.getdefault('app', 'android.release_artifact', 'aab')
super().cmd_release(*args)

def cmd_run(self, *args):
entrypoint = self.buildozer.config.getdefault(
'app', 'android.entrypoint')
Expand Down
54 changes: 0 additions & 54 deletions buildozer/targets/osx.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ def check_requirements(self):
self.ensure_sdk()
self.ensure_kivyapp()

def check_configuration_tokens(self, errors=None):
if errors:
self.logger.info('Check target configuration tokens')
self.logger.error(
'{0} error(s) found in the buildozer.spec'.format(
len(errors)))
for error in errors:
print(error)
sys.exit(1)
# check

def build_package(self):
self.logger.info('Building package')

Expand Down Expand Up @@ -147,9 +136,6 @@ def build_package(self):
binpath)
self.logger.info('All Done!')

def compile_platform(self):
pass

def install_platform(self):
# ultimate configuration check.
# some of our configuration cannot be checked without platform.
Expand All @@ -159,16 +145,6 @@ def install_platform(self):
'PACKAGES_PATH': self.buildozer.global_packages_dir,
})

def get_custom_commands(self):
result = []
for x in dir(self):
if not x.startswith('cmd_'):
continue
if x[4:] in self.buildozer.standard_cmds:
continue
result.append((x[4:], getattr(self, x).__doc__))
return result

def get_available_packages(self):
return ['kivy', 'python3']

Expand Down Expand Up @@ -212,36 +188,6 @@ def run_commands(self, args):

func(args)

def check_build_prepared(self):
self._build_prepared = False

def cmd_clean(self, *args):
self.buildozer.clean_platform()

def cmd_update(self, *args):
self.platform_update = True
self.buildozer.prepare_for_build()

def cmd_debug(self, *args):
self.buildozer.prepare_for_build()
self.build_mode = 'debug'
self.check_build_prepared()
self.buildozer.build()

def cmd_release(self, *args):
self.buildozer.prepare_for_build()
self.build_mode = 'release'
self.buildozer.build()

def cmd_deploy(self, *args):
self.buildozer.prepare_for_build()

def cmd_run(self, *args):
self.buildozer.prepare_for_build()

def cmd_serve(self, *args):
self.buildozer.cmd_serve()


def get_target(buildozer):
return TargetOSX(buildozer)
Loading