-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclock_1_merge.py
executable file
·39 lines (37 loc) · 1.08 KB
/
clock_1_merge.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
#!/bin/python
import os
ofn = "notclock.svg"
ifn = "clock_1.svg"
outfile = open(ofn,'w')
infile = open(ifn, 'r')
Lines = infile.readlines()
skip = False
for line in Lines:
if skip:
skip = False
continue
if line.find('var _VERSION') != -1:
args = line.split("=")
v = int(float(args[1])*100)
v=(v+1)/100
print(f"Version: {v:.2f}")
line = f" var _VERSION = {v:.2f}\n"
# update original file with new version number
cmd = f"perl -pi -e 's/var _VERSION.*/var _VERSION = {v}/' clock_1.svg"
os.system(cmd)
if line.find('var _DEV_MODE') != -1:
line = " var _DEV_MODE = false\n"
if line.find('%PRAGMA') != -1:
args = line.split(":")
if args[1] == "delete_next_line":
skip = True
if args[1] == "insert":
itf = open(args[2].strip(), 'r')
itfLines = itf.readlines()
for itfline in itfLines:
outfile.write(itfline)
itf.close()
if not skip:
outfile.write(line)
outfile.close()
print(f"brave ./{ofn}")