Raise NoBuildToolsFound.

This commit is contained in:
Jelmer Vernooij 2021-02-06 16:09:49 +00:00
parent 1dac0c527a
commit 8133a5fa68
No known key found for this signature in database
GPG key ID: 579C160D4C9E23E8
2 changed files with 15 additions and 15 deletions

View file

@ -18,9 +18,9 @@
import os import os
import sys import sys
from . import ( from . import (
run_build, run_clean, run_install, run_test, NoBuildToolsFound, run_build, run_clean, run_install, run_test,
note note)
) from .buildsystem import NoBuildToolsFound
from .dist import run_dist from .dist import run_dist

View file

@ -419,7 +419,7 @@ def create_dist_schroot(
tree: Tree, target_dir: str, tree: Tree, target_dir: str,
chroot: str, packaging_tree: Optional[Tree] = None, chroot: str, packaging_tree: Optional[Tree] = None,
include_controldir: bool = True, include_controldir: bool = True,
subdir: Optional[str] = None) -> Optional[str]: subdir: Optional[str] = None) -> str:
if subdir is None: if subdir is None:
subdir = 'package' subdir = 'package'
with SchrootSession(chroot) as session: with SchrootSession(chroot) as session:
@ -447,10 +447,6 @@ def create_dist_schroot(
try: try:
session.chdir(os.path.join(reldir, subdir)) session.chdir(os.path.join(reldir, subdir))
run_dist(session) run_dist(session)
except NoBuildToolsFound:
logging.info(
'No build tools found, falling back to simple export.')
return None
finally: finally:
os.chdir(oldcwd) os.chdir(oldcwd)
@ -495,11 +491,15 @@ if __name__ == '__main__':
packaging_tree = None packaging_tree = None
subdir = None subdir = None
try:
ret = create_dist_schroot( ret = create_dist_schroot(
tree, subdir=subdir, target_dir=os.path.abspath(args.target_directory), tree, subdir=subdir,
target_dir=os.path.abspath(args.target_directory),
packaging_tree=packaging_tree, packaging_tree=packaging_tree,
chroot=args.chroot) chroot=args.chroot)
if ret: except NoBuildToolsFound:
sys.exit(0) logging.info('No build tools found, falling back to simple export.')
export(tree, 'dist.tar.gz', 'tgz', None)
else: else:
sys.exit(1) print('Created %s' % ret)
sys.exit(0)