forked from renpy/renpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add.py
executable file
·154 lines (109 loc) · 3.59 KB
/
add.py
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import subprocess
import sys
from renpy import version_tuple # @UnresolvedImport
SOURCE = [
"/home/tom/ab/renpy",
"/home/tom/ab/renpy-build",
"/home/tom/ab/pygame_sdl2",
"/home/tom/ab/renpy-build/renpyweb",
]
version = ".".join(str(i) for i in version_tuple)
short_version = ".".join(str(i) for i in version_tuple[:-1])
major = short_version.split(".")[0]
print("Version", version)
ap = argparse.ArgumentParser()
ap.add_argument("--release", action="store_true")
ap.add_argument("--prerelease", action="store_true")
ap.add_argument("--experimental", action="store_true")
ap.add_argument("--no-tag", "-n", action="store_true")
ap.add_argument("--push-tags", action="store_true")
ap.add_argument("--delete-tag")
ap.add_argument("--github", action="store_true")
ap.add_argument("--real", action="store_true")
args = ap.parse_args()
if not args.real:
print("Did you want to use scripts/add_all.sh? If not, give --real.")
sys.exit(1)
if args.github:
subprocess.call([ "git", "push", "--tags" ])
subprocess.call([ "gh", "release", "create", version, "--notes", "See https://www.renpy.org/release/" + short_version, "-t", "Ren'Py {}".format(short_version) ])
dn = "/home/tom/ab/renpy/dl/" + short_version
for fn in os.listdir(dn):
if fn == ".build_cache":
continue
if fn.endswith(".update.gz"):
continue
if fn.endswith(".update.json"):
continue
if fn.startswith("updates.json"):
continue
if fn.endswith(".zsync"):
continue
if fn.endswith(".sums"):
continue
subprocess.call([ "gh", "release", "upload", version, os.path.join(dn, fn) ])
sys.exit(0)
if args.release:
subprocess.check_call([ "/home/tom/ab/renpy/scripts/checksums.py", "/home/tom/ab/renpy/dl/" + short_version ])
if args.delete_tag:
for i in SOURCE:
os.chdir(i)
if i == SOURCE[0]:
tag = args.delete_tag
else:
tag = "renpy-" + args.delete_tag
subprocess.call([ "git", "tag", "-d", tag, ])
sys.exit(0)
if args.push_tags:
for i in SOURCE:
os.chdir(i)
if subprocess.call([ "git", "push", "--tags" ]):
print("Tags not pushed: {}".format(os.getcwd()))
sys.exit(1)
print("Pushed tags.")
sys.exit(0)
if args.release:
links = [ "release", "prerelease", "experimental" ]
tag = True
elif args.prerelease:
links = [ "prerelease", "experimental" ]
tag = True
elif args.experimental:
links = [ "experimental" ]
tag = False
else:
links = [ ]
tag = False
if args.no_tag:
tag = False
links = [ i + "-" + major for i in links ]
if tag:
for i in SOURCE:
os.chdir(i)
if subprocess.call([ "git", "diff", "--quiet", "HEAD" ]):
print("Directory not checked in: {}".format(os.getcwd()))
sys.exit(1)
for i in SOURCE:
os.chdir(i)
if i == SOURCE[0]:
tag = version
else:
tag = "renpy-" + version
subprocess.check_call([ "git", "tag", "-a", tag, "-m", "Tagging Ren'Py + " + version + " release." ])
os.chdir("/home/tom/ab/renpy/dl")
for i in links:
if os.path.exists(i):
os.unlink(i)
os.symlink(short_version, i)
os.chdir("/home/tom/ab/website")
subprocess.check_call("./upload.sh")
os.chdir("/home/tom/ab/renpy/sphinx")
if args.release:
subprocess.check_call("./upload.sh")
elif args.prerelease:
subprocess.check_call("./upload_dev.sh")
print("Version", version)