f3a71245e8
Somehow these files got lost in a rebase. I'm sort of at a loss for how, but well, adding them back in.
29 lines
591 B
Python
29 lines
591 B
Python
import argparse
|
|
import re
|
|
import sys
|
|
|
|
|
|
def main(args=None):
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('filename')
|
|
parser.add_argument('commit')
|
|
args = parser.parse_args(args)
|
|
|
|
with open(args.filename) as f:
|
|
contents = f.read()
|
|
|
|
commit = args.commit[:7]
|
|
|
|
new_contents = re.sub(
|
|
r'^__version__ = [\'"](.*)[\'"]$',
|
|
r'__version__ = "\1-{}"'.format(commit),
|
|
contents,
|
|
flags=re.MULTILINE,
|
|
)
|
|
|
|
with open(args.filename, 'w') as f:
|
|
f.write(new_contents)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|