diff --git a/update_versions.py b/update_versions.py index 507419d688..2f96480556 100755 --- a/update_versions.py +++ b/update_versions.py @@ -218,10 +218,15 @@ def compare_xml(module, apiname_tag, apiname_cur): "-newapi", newapi, "-script", null_file] - jdiff = subprocess.Popen(cmd, stdout=log, stderr=log) - jdiff.wait() + try: + jdiff = subprocess.Popen(cmd, stdout=log, stderr=log) + jdiff.wait() + code = jdiff.returncode + except Exception: + printt("Error executing javadoc. Exiting...") + exit(1) log.close() - code = jdiff.returncode + print("Compared XML for " + module.name) if code == NO_CHANGES: print(" No API changes") @@ -257,8 +262,12 @@ def gen_xml(path, modules, name): "-apiname", xml_out, # leaving it in just in case it's needed once again "-sourcepath", fix_path(src)] cmd = cmd + get_packages(src) - jdiff = subprocess.Popen(cmd, stdout=log, stderr=log) - jdiff.wait() + try: + jdiff = subprocess.Popen(cmd, stdout=log, stderr=log) + jdiff.wait() + except Exception: + printt("Error executing javadoc. Exiting...") + exit(1) log.close() print("Generated XML for " + name + " " + module.name) sys.stdout.flush() @@ -633,16 +642,16 @@ def print_version_updates(modules): output = (module.name + ":\n") output += ("\tMajor Release:\tNo Change.\n") output += ("\tSpecification:\t" + str(versions[0]) + "\t->\t" + str(versions[0].increment()) + "\n") - output += ("\tImplementation:\t" + str(versions[1]) + "\t->\t" + str(versions[1] + 1) + "\n") + output += ("\tImplementation:\t" + str(versions[1]) + "\t->\t" + str(float(versions[1]) + 1) + "\n") output += ("\n") print(output) sys.stdout.flush() f.write(output) elif module.ret == NON_COMPATIBLE: output = (module.name + ":\n") - output += ("\Major Release:\t" + str(versions[2]) + "\t->\t" + str(versions[2] + 1) + "\n") + output += ("\Major Release:\t" + str(versions[2]) + "\t->\t" + str(float(versions[2]) + 1) + "\n") output += ("\tSpecification:\t" + str(versions[0]) + "\t->\t" + str(versions[0].overflow()) + "\n") - output += ("\tImplementation:\t" + str(versions[1]) + "\t->\t" + str(versions[1] + 1) + "\n") + output += ("\tImplementation:\t" + str(versions[1]) + "\t->\t" + str(float(versions[1]) + 1) + "\n") output += ("\n") print(output) sys.stdout.flush() @@ -662,7 +671,7 @@ def print_version_updates(modules): if versions[1] is None: output += ("\tImplementation: None\n") else: - output += ("\tImplementation:\t" + str(versions[1]) + "\t->\t" + str(versions[1] + 1) + "\n") + output += ("\tImplementation:\t" + str(versions[1]) + "\t->\t" + str(float(versions[1]) + 1) + "\n") output += ("\n") print(output) sys.stdout.flush() @@ -851,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 in path. Exiting...") + return 1 # ----------------------------------------------- # 1) Clone Autopsy, checkout to given tag/commit # 2) Get the modules in the clone and the source