From c55492e17d6fda194e9d844b8ec31a42f88949de Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 6 Feb 2014 07:53:09 +0100 Subject: [PATCH] Check that mvn is installed and abort if not Change-Id: I6f9e78672c361871defe099009c5bd1c58863dab Closes-Bug: #1276763 --- os_doc_tools/doctest.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/os_doc_tools/doctest.py b/os_doc_tools/doctest.py index 7096d9ee..02f1f604 100755 --- a/os_doc_tools/doctest.py +++ b/os_doc_tools/doctest.py @@ -668,6 +668,15 @@ def publish_book(publish_path, book): ignore=shutil.ignore_patterns('*.xml')) +def ensure_exists(program): + """Check that program exists, abort if not.""" + retcode = subprocess.call("type " + program, shell=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + if retcode != 0: + print("Program '%s' does not exist, please install!" % program) + sys.exit(1) + + def build_book(book, publish_path): """Build book(s) in directory book.""" @@ -1147,6 +1156,9 @@ def main(): check_deleted_files(doc_path, FILE_EXCEPTIONS, CONF.verbose) if CONF.check_build: + # Some programs are called in subprocesses, make sure that they + # really exist. + ensure_exists("mvn") read_properties() build_affected_books(doc_path, BOOK_EXCEPTIONS, FILE_EXCEPTIONS,