-
Notifications
You must be signed in to change notification settings - Fork 0
/
lstart.py
54 lines (48 loc) · 1.08 KB
/
lstart.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
import os
filename = "lab.conf"
f = open (filename, "r")
l = f.readlines()
f.close()
def removeFinalEnter (txt):
if len(txt) != 0 and txt[-1] in ["\n", " "]:
return removeFinalEnter (txt[:-1])
elif len(txt) != 0 and txt[0] in ["\n", " "]:
return removeFinalEnter (txt[1:])
elif len(txt) != 0 and (txt[0] == "#" or txt.startswith("LAB_")):
return ""
return txt
def removeEnter (lst):
for i in range (len (lst)):
lst[i] = removeFinalEnter (lst[i])
return lst
l = removeEnter (l)
def splitShitFinal (txt):
return txt.split('[', 1 )[0]
def splitShit (lst):
for i in range (len (lst)):
lst[i] = splitShitFinal (lst[i])
return lst
l = splitShit (l)
def removeEquals (lst):
newLst = []
for i in lst:
exists = False
for j in newLst:
if i == j:
exists = True
if not exists and i != "":
newLst = newLst + [i]
return newLst
l = removeEquals (l)
for i in l:
startup = i + ".startup"
try:
f = open (startup, "r")
except:
f = open (startup, "a")
print "CREATED: " + startup
finally:
f.close()
if not os.path.exists(i):
os.makedirs(i)
print "CREATED: " + i + "/"