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

Remove some attributes defined outside of __init__() #1694

Merged
merged 1 commit into from
Sep 16, 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
12 changes: 7 additions & 5 deletions buildozer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def __init__(self, filename='buildozer.spec', target=None):
self.build_id = None
self.config = SpecParser()
self._venv_created = False
self._build_prepared = False
self._build_done = False

self.logger = Logger()

Expand Down Expand Up @@ -77,7 +79,7 @@ def prepare_for_build(self):
'''Prepare the build.
'''
assert self.target is not None
if hasattr(self.target, '_build_prepared'):
if self._build_prepared:
return

self.logger.info('Preparing build')
Expand All @@ -97,7 +99,7 @@ def prepare_for_build(self):
self.target.compile_platform()

# flag to prevent multiple build
self.target._build_prepared = True
self._build_prepared = True

def build(self):
'''Do the build.
Expand All @@ -108,9 +110,9 @@ def build(self):
(:meth:`prepare_for_build` must have been call before.)
'''
assert self.target is not None
assert hasattr(self.target, '_build_prepared')
assert self._build_prepared

if hasattr(self.target, '_build_done'):
if self._build_done:
return

# increment the build number
Expand All @@ -124,7 +126,7 @@ def build(self):
self.target.build_package()

# flag to prevent multiple build
self.target._build_done = True
self._build_done = True

def check_configuration_tokens(self):
'''Ensure the spec file is 'correct'.
Expand Down
3 changes: 2 additions & 1 deletion buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

self.artifact_format = 'apk'
self._serials = None

if self.buildozer.config.has_option(
"app", "android.arch"
Expand Down Expand Up @@ -1405,7 +1406,7 @@ def _update_libraries_references(self, dist_dir):

@property
def serials(self):
if hasattr(self, '_serials'):
if self._serials is not None:
return self._serials
serial = environ.get('ANDROID_SERIAL')
if serial:
Expand Down
Loading