Fixed syntax errors and other small changes.

This commit is contained in:
Jeff Wallace 2013-07-24 16:02:18 -04:00
parent 31d93f0d11
commit c55c5c68cc

View File

@ -80,9 +80,17 @@ class Module:
class Spec:
# Initialize specification number, where num is a string like x.y
def __init__(self, num):
l, r = num.split(".")
self.third = None
spec_nums = num.split(".")
if len(spec_nums) == 3:
final = spec_nums[2]
self.third = int(final)
l, r = spec_nums[0], spec_nums[1]
self.left = int(l)
self.right = int(r)
def __str__(self):
return self.get()
def __cmp__(self, other):
@ -114,7 +122,10 @@ class Spec:
def increment(self):
return str(self.left) + "." + str(self.right + 1)
def get(self):
return str(self.left) + "." + str(self.right)
spec_str = str(self.left) + "." + str(self.right)
if self.third is not None:
spec_str += "." + str(self.final)
return spec_str
def set(self, num):
if isinstance(num, str):
l, r = num.split(".")
@ -158,6 +169,10 @@ def compare_xml(module, apiname_tag, apiname_cur):
jdiff_com = fix_path(comments + "/jdiff-xml")
tag_comments = fix_path(jdiff_com + "/" + apiname_tag + "-" + module.name + "_to_build")
jdiff_tag_com = fix_path(tag_comments + "/jdiff-xml")
if not os.path.exists(jdiff):
print("JDIFF doesn't exist.")
make_dir(docs)
make_dir(comments)
make_dir(jdiff_com)
@ -251,7 +266,7 @@ def get_tag(sourcepath):
if second_instance:
ver = line.split("VERSION ")[1]
ver = ver.split(" -")[0]
return "autopsy-" + ver
return ("autopsy-" + ver).strip()
else:
second_instance = True
continue
@ -395,9 +410,10 @@ def get_specification(project, manifest):
for line in f:
if "OpenIDE-Module-Specification-Version:" in line:
return Spec(line.split(": ")[1].strip())
except:
except Exception as e:
print("Error parsing Specification version for")
print(project)
print(e)
# Set the specification version in the given project properties file
# but if it can't be found there, set it in the manifest file
@ -473,8 +489,9 @@ def get_release(manifest):
return int(line.split("/")[1].strip())
f.close()
except:
print("Error parsing Release version for")
print(manifest)
#print("Error parsing Release version for")
#print(manifest)
return 0
# Set the release version in the given manifest file
def set_release(manifest, num):
@ -591,6 +608,7 @@ def print_version_updates(modules):
output += (" Updated Implementation version:\t" + str(versions[1] + 1) + "\n")
output += ("\n")
print(output)
sys.stdout.flush()
f.write(output)
elif module.ret == 102:
output = (module.name + ":\n")
@ -604,6 +622,7 @@ def print_version_updates(modules):
output += (" Updated Release version:\t\t" + str(versions[2] + 1) + "\n")
output += ("\n")
print(output)
sys.stdout.flush()
f.write(output)
elif module.ret == 1:
output = (module.name + ":\n")
@ -614,12 +633,17 @@ def print_version_updates(modules):
output += ("\n")
print(output)
f.write(output)
sys.stdout.flush()
elif module.ret == 100:
output = (module.name + ":\n")
if versions[1] is None:
output += (" No Implementation version.\n")
else:
output += (" Current Implementation version:\t" + str(versions[1]) + "\n")
output += (" Updated Implementation version:\t" + str(versions[1] + 1) + "\n")
output += ("\n")
print(output)
sys.stdout.flush()
f.write(output)
elif module.ret is None:
output = ("Added " + module.name + ":\n")
@ -636,6 +660,7 @@ def print_version_updates(modules):
output += (" Updated Release version:\t\t1\n")
output += ("\n")
print(output)
sys.stdout.flush()
f.write(output)
sys.stdout.flush()
f.close()
@ -721,7 +746,7 @@ def do_git(tag, tag_dir):
return True
except Exception as ex:
print("Error cloning and checking out Autopsy: ", sys.exc_info()[0])
print ex
print(str(ex))
print("The terminal you are using most likely does not recognize git commands.")
return False