-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathremove_DEV.py
36 lines (31 loc) · 1.23 KB
/
remove_DEV.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
from pathlib import Path
import shutil
directory = Path("files/directory-menu@torchipeppo")
# be very restrictive here to avoid accidents
po = list(directory.glob("po/*.po"))
for fname in po + [directory/"applet.js", directory/"popup_menu.py"]:
with open(fname, "r") as f:
content = f.read()
content = content.replace("directory-menu-DEV", "directory-menu")
content = content.replace("torchipeppo-DEV", "torchipeppo")
with open(fname, "w") as f:
f.write(content)
# here too, but rename also
potfile = directory/"po"/"[email protected]"
with open(potfile, "r") as f:
content = f.read()
content = content.replace("directory-menu-DEV", "directory-menu")
content = content.replace("torchipeppo-DEV", "torchipeppo")
with open(directory/"po"/"[email protected]", "w") as f:
f.write(content)
potfile.unlink()
# this is a small known file, let's get aggressive
with open(directory/"metadata.json", "r") as f:
content = f.read()
content = content.replace("-DEV", "")
content = content.replace(" DEV", "")
content = content.replace(" (DEVELOPMENT)", "")
with open(directory/"metadata.json", "w") as f:
f.write(content)
# reset icon
shutil.copy("icon-standard.png", directory/"icon.png")