lbry-desktop/set-version.py

21 lines
525 B
Python
Raw Normal View History

2017-02-10 03:09:31 +01:00
"""Set the package version to the output of `git describe`"""
import json
import os.path
import subprocess
import sys
def main():
version = subprocess.check_output(['git', 'describe']).strip()
package_file = os.path.join('app', 'package.json')
with open(package_file) as fp:
package_data = json.load(fp)
package_data['version'] = version
with open(package_file, 'w') as fp:
json.dump(package_data, fp, indent=2, separators=(',', ': '))
if __name__ == '__main__':
sys.exit(main())