From 4b1ba5925748d23c5c4a91dbb886e4f96a770d12 Mon Sep 17 00:00:00 2001
From: sidheshenator <sidheshenator@gmail.com>
Date: Tue, 23 Jun 2015 09:38:22 -0400
Subject: [PATCH] early exit if jdiff or javadoc not found

---
 update_versions.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/update_versions.py b/update_versions.py
index 58f3a74a43..d7d7951b5e 100755
--- a/update_versions.py
+++ b/update_versions.py
@@ -223,7 +223,7 @@ def compare_xml(module, apiname_tag, apiname_cur):
         jdiff.wait()
         code = jdiff.returncode
     except Exception:
-        printt("Javadoc not found. Exiting...")
+        printt("Error executing javadoc. Exiting...")
         exit(1)
     log.close()
 
@@ -266,7 +266,7 @@ def gen_xml(path, modules, name):
             jdiff = subprocess.Popen(cmd, stdout=log, stderr=log)
             jdiff.wait()
         except Exception:
-            printt("Javadoc not found. Exiting...")
+            printt("Error executing javadoc. Exiting...")
             exit(1)
         log.close()
         print("Generated XML for " + name + " " + module.name)
@@ -860,6 +860,16 @@ def main():
         return 0
     printinfo()
 
+    # Check if javadoc and jdiff are present.
+    jdiff = fix_path(os.path.abspath("./thirdparty/jdiff/v-custom/jdiff.jar"))
+    if(not os.path.isdir(jdiff)):
+        printt("jdiff not found. Exiting...")
+        return 1
+    try:
+        subprocess.call(["javadoc"], stdout=open(os.devnull, "w"), stderr=subprocess.STDOUT)
+    except Exception:
+        printt("javadoc not found. Exiting...")
+        return 1
     # -----------------------------------------------
     # 1) Clone Autopsy, checkout to given tag/commit
     # 2) Get the modules in the clone and the source
-- 
GitLab