Skip to content

Commit

Permalink
add some extra code to deal with malformed and absent VERSION files
Browse files Browse the repository at this point in the history
  • Loading branch information
arrdem committed Dec 27, 2012
1 parent d47a8de commit ed254fe
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bump
Expand Up @@ -20,9 +20,16 @@ if __name__ == "__main__":
try:
v = re.split(re.compile("\.|-"),open("VERSION").read()) or __INITIAL__
v = v[0:3]
except:
map(int, v)

except ValueError:
print("failed to parse the existing VERSION file, assuming v 0.0.1")
v = ['0', '0', '1']

except FileNotFoundError:
print("failed to find a VERSION file, assuming v 0.0.0")
v = ['0', '0', '0']

op = ''
try:
op = sys.argv[1]
Expand Down Expand Up @@ -50,5 +57,8 @@ if __name__ == "__main__":

v += "\n"

print(v)

open("VERSION",'w').write(v)

sys.exit(0)

0 comments on commit ed254fe

Please sign in to comment.