Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (30 sloc) 0.929 kb
df02500c »
2011-09-24 initial import
1 #!/usr/bin/python
2 MODULE_DIRECTORY = 'modules.d'
3 LOCAL_MODULES = 'modules.local.d'
4 CONFIG = 'module_config.py'
5 outfile = 'bModules.py'
6
7 import os
8
9 def rebuild_bModules():
10 out = open(outfile, 'w')
11 # Module directory
12 modules = [os.path.join(MODULE_DIRECTORY, i) for i in os.listdir(MODULE_DIRECTORY)]
13 if os.path.exists(LOCAL_MODULES):
14 modules.append(os.path.join(LOCAL_MODULES, i) for i in os.listdir(LOCAL_MODULES)
15 modules.sort()
16 modules.append(CONFIG)
17 for i in modules:
18 if not i.endswith(".py"):
19 continue
20 if os.path.isdir(i):
21 continue
22 # We're happy with the file.
23 for line in open(i, 'r').readlines():
24 out.write(line)
25 out.close()
26 return outfile
27
28 def save_modules(module_map):
29 pass
30 # XXX TODO construct this function to save to module_config.py
31
32 if __name__ == '__main__':
33 # Test rig
34 rebuild_bModules()
35
36
37
Something went wrong with that request. Please try again.