Add image-make tools

This commit is contained in:
urpylka
2018-02-06 21:24:41 +03:00
parent c2c82cef80
commit 6e9664e221
7 changed files with 1049 additions and 0 deletions

38
image/git_release.py Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env python
#
# Simple github release body-editor
# Smirnov Artem @urpylka
#
# Use:
# python git_release.py CONFIG_FILE RELEASE_ID RELEASE_BODY
#
from ConfigParser import SafeConfigParser
import requests, sys, urllib
def json_wrapper(image_name, image_link, image_size, old_text):
old_text = urllib.unquote_plus(old_text)
buffer = "### Download\n* [" + image_name + ".zip](" + image_link + ") (" + image_size + ")\n\n" + old_text
js = {}
js["body"] = buffer
return js
def main():
cfgParser = SafeConfigParser()
cfgParser.read(sys.argv[1])
js = json_wrapper(sys.argv[4], sys.argv[5], sys.argv[6], sys.argv[3])
r = requests.patch(cfgParser.get('github','url') + sys.argv[2], json=js, auth=(cfgParser.get('github','login'), cfgParser.get('github','password')))
if r.status_code == 200:
print("Message has been successfully added!")
else:
return 1
if __name__ == '__main__':
main()