Remove getattr usage
MODIFY
repo2docker/app.py
repo2docker/app.py
@@ -745,11 +745,9 @@ class Repo2Docker(Application):
picked_buildpack = self.default_buildpack()
picked_buildpack.appendix = self.appendix
- picked_buildpack.labels = {
- 'repo2docker.version': self.version,
- 'repo2docker.repo': self.repo,
- 'repo2docker.ref': self.ref,
- }
+ picked_buildpack.labels['repo2docker.version'] = self.version
+ picked_buildpack.labels['repo2docker.repo'] = self.repo
+ picked_buildpack.labels['repo2docker.ref'] = self.ref
self.log.debug(picked_buildpack.render(),
extra=dict(phase='building'))

MODIFY
repo2docker/buildpacks/base.py
repo2docker/buildpacks/base.py
@@ -171,6 +171,7 @@ class BuildPack:
def __init__(self):
self.log = logging.getLogger('repo2docker')
self.appendix = ''
+ self.labels = {}
if sys.platform.startswith('win'):
self.log.warning("Windows environment detected. Note that Windows "
"support is experimental in repo2docker.")
@@ -246,7 +247,7 @@ class BuildPack:
"""
Docker labels to set on the built image.
"""
- return getattr(self, 'labels', {})
+ return self.labels
def get_build_script_files(self):
"""

Remove getattr usage