Created
January 27, 2018 08:18
-
-
Save lashtear/f93cb708551917bc28c0abb96fe05239 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python3 | |
# small helper script for bundling up factorio mods redistributable | |
# under BSD3 or MIT terms as desired | |
import json | |
import subprocess | |
with open("info.json") as info_file: | |
info = json.load(info_file) | |
with subprocess.Popen(['git', 'describe', '--dirty', '--tags'], | |
universal_newlines=True, | |
stdout=subprocess.PIPE) as git: | |
git_version = git.stdout.read().rstrip() | |
if git_version != info['version']: | |
print ("git reported version {} does not match info.json version {}, retag?" | |
.format(git_version,info['version'])) | |
exit(1) | |
name = "{}_{}".format(info['name'], info['version']) | |
subprocess.run (['git', 'archive', | |
'--prefix', "{}/".format(name), | |
'--output', "{}.zip".format(name), | |
info['version']]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment