lbry-sdk/packaging/append_sha_to_version.py
Job Evers-Meltzer f3a71245e8 Add missing files
Somehow these files got lost in a rebase. I'm sort of at a loss
for how, but well, adding them back in.
2016-11-09 11:35:03 -06:00

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())