-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
45 lines (33 loc) · 840 Bytes
/
config.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
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import codecs
import os
import sys
import RezzMe.config.builder
onMacOSX = sys.platform == 'darwin'
onLinux = sys.platform == 'linux2'
onWindows = sys.platform == 'win32'
# check prereqs
if not os.path.exists('rezzme.cfg'):
print '''
oops...you need to create rezzme.cfg first!
copy rezzme.cfg.example to rezzme.cfg and adapt it to your needs,
and run me again.
'''
sys.exit(1)
if len(sys.argv) != 2:
print 'usage: config.py out-file'
sys.exit(2)
# read in configuration
cfg = RezzMe.config.builder.buildCfg('rezzme')
outfile = codecs.open(sys.argv[1], 'w', 'utf8')
outfile.write('''
#!/usr/bin/python
# -*- encoding: utf-8 -*-
# AUTOMATICALLY GENERATED, CHANGES HERE WILL BE LOST FOREVER
def config():
return %s
# done
''' % str(cfg))
outfile.close()
sys.exit(0)