-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy path_PUBLISH_FACTORIZATION_
executable file
·112 lines (88 loc) · 3.46 KB
/
_PUBLISH_FACTORIZATION_
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/python
import os, random, time
if open("fzversion").read().strip() in open("build.log").read():
raise SystemExit("Version probably already published")
def getForgeVersion():
return "Minecraft Forge " + getMinecraftVersion()
def getMinecraftVersion():
tofind = "fmlbuild.mcversion="
for line in open("build.gradle"):
if "FORGEMARK" in line:
ret = line.split('"')[1].strip()
return ret
return "unknown"
def run(cmd, expect_exit_code=0):
print "> ", cmd
exit_code = os.system(cmd)
if expect_exit_code != exit_code and expect_exit_code != None:
print "> Exit code = ", exit_code
if expect_exit_code != any: raise SystemExit(exit_code)
def adfly(url):
return url
#return "http://adf.ly/2137658/" + url
def devify(name): return name.replace(".jar", "-dev.jar")
open("src/main/resources/assets/factorization/lang/en_US.lang").close()
exp = os.path.expanduser
run("./extract_license.py > src/main/resources/LICENSE.txt")
run("rm -f last_fz")
run("rm -f ~/tmp/factorization_last_commit")
run('git log | head -n 1 | line.py "_.split()[1]" > ~/tmp/factorization_last_commit')
commit = open(exp("~/tmp/factorization_last_commit")).read().strip()
run("rm -f ~/tmp/factorization_last_commit")
version = open("fzversion").read().strip()
mc_forge_version = getMinecraftVersion()
filename = "Factorization-{0}.jar".format(version)
run("./gradlew build deobfJar writeFzFile")
oldfile = exp("~/Dropbox/Public/old/" + filename)
last_fz = open("last_fz").read().strip()
run("cp " + last_fz + " " + oldfile)
run("cp " + devify(last_fz) + " " + devify(oldfile))
mfurl = exp("~/tmp/factorization_mediafire_url")
run("rm -f " + mfurl)
changelogFilename = "changelogs/Changelog-" + version + ".txt"
my_dropbox = "http://dl.dropbox.com/u/76265666/"
#Check for baddies
run("./check_norelease", expect_exit_code=any)
#Factorization
run("cp CHANGELOG ~/Dropbox/Public/old/")
run("cp CHANGELOG ~/Dropbox/Public/" + changelogFilename)
changelog_url = my_dropbox + changelogFilename
#Dropbox
dropbox_url = my_dropbox + "old/" + filename
run("dropbox_uploader.sh upload " + oldfile + " Public/old/" + filename)
run("dropbox_uploader.sh upload " + devify(oldfile) + " Public/old/" + devify(filename))
#Mediafire
run("mediafire upload --quiet " + oldfile + " > " + mfurl, expect_exit_code=None)
mediafire_url = ""
try:
mediafire_url = open(mfurl).read().strip().strip("()").strip()
except Exception as e:
print(e)
if mediafire_url == "":
print("Mediafire upload failed! Lameness! Enter the URL to use:")
mediafire_url = raw_input()
#Don't add non-trivial tasks here unless we can get mediafire behaving properly.
print("\n"*4)
LOG = "Factorization " + version + "\n"
LOG += '''
[url="{0}"]MediaFire[/url], or\n[url="{1}"]DropBox[/url]
'''.format(
adfly(mediafire_url),
adfly(dropbox_url)
).strip() + "\n"
LOG += "Built on " + time.strftime("%F") + " against " + (getForgeVersion() + "\n")
LOG += '[url="{0}"]Changelog[/url]\n'.format(changelog_url)
LOG += '[url="{0}"]Deobf for Mod Authors[/url]\n'.format(devify(dropbox_url))
LOG += '' + commit
print(LOG)
print
print "Update targets:"
for _ in "read forum thread; add build log; paste to forum post; update thread title; post changelog; IRC topic; twitter; patreon; forgecraft; personal instance".split('; '):
print "[ ]", _
open("build.log", 'a').write(LOG+ '\n\n')
db = os.system("pidof dropbox > /dev/zero")
if db:
print()
print()
print("Dropbox not running! Starting dropbox")
os.system("dropbox &")