Skip to content

Instantly share code, notes, and snippets.

@mikedh
Created January 28, 2018 19:18
Show Gist options
  • Save mikedh/d99697e4e8cac74f369c8ff310641b96 to your computer and use it in GitHub Desktop.
Save mikedh/d99697e4e8cac74f369c8ff310641b96 to your computer and use it in GitHub Desktop.
quick script to do version bumps
import sys
import numpy as np
file_name = 'trimesh/version.py'
if __name__ == '__main__':
with open(file_name, 'r') as f:
text = f.read()
split = text.split("'")
v = split[1]
assert v.count('.') == 2
vs = np.array([int(i) for i in v.split('.')])
# -0: major bump
# -1: minor bump
# anything else: patch bump
if '-0' in sys.argv:
which = 0
elif '-1' in sys.argv:
which = 1
else:
which = 2
vs[which+1:] = 0
vs[which] += 1
split[1] = '.'.join(vs.astype(str))
new = "'".join(split)
print('was: {}\nnow: {}'.format(text.strip(), new.strip()))
with open(file_name, 'w') as f:
f.write(new)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment