From 8133a5fa6899c83bf254ba28469859088377499a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sat, 6 Feb 2021 16:09:49 +0000 Subject: [PATCH] Raise NoBuildToolsFound. --- ognibuild/__main__.py | 6 +++--- ognibuild/dist.py | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ognibuild/__main__.py b/ognibuild/__main__.py index f4b6ba1..3cb47ae 100644 --- a/ognibuild/__main__.py +++ b/ognibuild/__main__.py @@ -18,9 +18,9 @@ import os import sys from . import ( - run_build, run_clean, run_install, run_test, NoBuildToolsFound, - note - ) + run_build, run_clean, run_install, run_test, + note) +from .buildsystem import NoBuildToolsFound from .dist import run_dist diff --git a/ognibuild/dist.py b/ognibuild/dist.py index bd5520d..62837b7 100644 --- a/ognibuild/dist.py +++ b/ognibuild/dist.py @@ -419,7 +419,7 @@ def create_dist_schroot( tree: Tree, target_dir: str, chroot: str, packaging_tree: Optional[Tree] = None, include_controldir: bool = True, - subdir: Optional[str] = None) -> Optional[str]: + subdir: Optional[str] = None) -> str: if subdir is None: subdir = 'package' with SchrootSession(chroot) as session: @@ -447,10 +447,6 @@ def create_dist_schroot( try: session.chdir(os.path.join(reldir, subdir)) run_dist(session) - except NoBuildToolsFound: - logging.info( - 'No build tools found, falling back to simple export.') - return None finally: os.chdir(oldcwd) @@ -495,11 +491,15 @@ if __name__ == '__main__': packaging_tree = None subdir = None - ret = create_dist_schroot( - tree, subdir=subdir, target_dir=os.path.abspath(args.target_directory), - packaging_tree=packaging_tree, - chroot=args.chroot) - if ret: - sys.exit(0) + try: + ret = create_dist_schroot( + tree, subdir=subdir, + target_dir=os.path.abspath(args.target_directory), + packaging_tree=packaging_tree, + chroot=args.chroot) + except NoBuildToolsFound: + logging.info('No build tools found, falling back to simple export.') + export(tree, 'dist.tar.gz', 'tgz', None) else: - sys.exit(1) + print('Created %s' % ret) + sys.exit(0)