-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaseholders.py
More file actions
executable file
·65 lines (53 loc) · 1.41 KB
/
plaseholders.py
File metadata and controls
executable file
·65 lines (53 loc) · 1.41 KB
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
#!/usr/bin/python -u
import os
import yaml
import shutil
import time
import tempfile
import re
import distutils.core
import subprocess
class Conf(object):
def __init__(self, app):
self.app = app
def createTemp(self):
configDir = '/home/pls/configs/'
path = configDir+self.app
tmp = tempfile.mkdtemp()
subprocess.call('cp -r '+path+'/* '+tmp, shell=True)
return os.path.abspath(tmp)
def findFiles(self):
config_files = []
path = self.createTemp()
for dirpath, dirnames, filenames in os.walk(path):
for name in filenames:
f = os.path.join(dirpath,name)
abso = os.path.abspath(f)
config_files.append(abso)
return config_files
def findMaster(self):
masterDir = '/home/pls/masterfiles/'
placeholders = []
f = open(masterDir+self.app, 'r')
for line in f:
tmp = line.split(':')
placeholders.append(tmp)
return placeholders
def prepare(self):
files = self.findFiles()
#masters = self.findMaster()
tmp = self.createTemp()
print files
#print masters
print tmp
#regx = re.findall('{{(.*?)}', line)
#re.findall(':\s(.*$)', master)
#{{(.*?)}
#{{[a-zA-Z0-9_-]*}}
# temp = tempfile.mkdtemp()
bbb = Conf('cinbox')
bbb.prepare()
#files = bbb.findFiles()
#masters = bbb.findMaster()
#print files
#print masters