Skip to content

Commit

Permalink
Add keep/delete_build_dirs to Builder.build
Browse files Browse the repository at this point in the history
  • Loading branch information
jiri-janousek committed Jan 12, 2019
1 parent 829d365 commit 8c324a9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions nufb/builder.py
Expand Up @@ -32,17 +32,28 @@ def __init__(self, build_root: Path, resources_dir: Path,
self.build_name = f'{manifest.id}-{manifest.branch}'
self.paths = BuildPaths(build_root, self.build_name)

def build(self):
def build(self,
keep_build_dirs: bool = False,
delete_build_dirs: bool = False):
"""
Build the flatpak.
:param bool keep_build_dirs: Keep the build directories even if the
build is successful.
:param bool delete_build_dirs: Delete the build dirs even if the build
fails.
:raise OSError: When a filesystem operation fails.
"""
# Build dir is kept on failure by default.
clean_up = delete_build_dirs
try:
self.set_up()
self.copy_resources()
# Build dir is deleted on success by default.
clean_up = not keep_build_dirs
finally:
self.clean_up()
if clean_up:
self.clean_up()

def set_up(self):
"""
Expand Down

0 comments on commit 8c324a9

Please sign in to comment.