]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blame - modules/config.py
- handle missing sign_key from config
[projects/pld-ftp-admin.git] / modules / config.py
CommitLineData
098f4a50
MM
1# vi: encoding=utf-8 ts=8 sts=4 sw=4 et
2
3import string, os
4
8911f226 5value = {}
098f4a50 6
1610d209 7if os.environ.has_key('HOME'):
8911f226 8 path = os.environ['HOME']
1610d209 9else:
8911f226 10 path = '../../' # cgi-bin interface
1610d209 11
8911f226 12f = open(path + '/.ftpadmrc', 'r')
1610d209 13
098f4a50
MM
14for line in f.readlines():
15 if line[0] == '#' or string.find(line, '=') == -1:
16 continue
8911f226 17 tuple = string.split(string.strip(line), '=')
098f4a50 18 if tuple[1][0] == '"':
8911f226 19 value[string.strip(tuple[0])] = tuple[1][1:-1]
098f4a50 20 else:
8911f226 21 value[string.strip(tuple[0])] = string.strip(tuple[1])
098f4a50
MM
22
23f.close()
24
8911f226
ER
25default_to = value['ftp_dir'] + '/' + value['default_to'] + '/'
26ftp_dir = value['ftp_dir'] + '/'
27incoming_dir = value['ftp_dir'] + '/' + value['incoming_dir'] + '/'
28test_builds_dir = value['ftp_dir'] + '/' + value['test_builds_dir'] + '/'
29ftp_archs = value['ftp_archs'].split(' ')
796b7867 30
8911f226 31builderqueue = value['builderqueue']
0767aa5e 32
472e4cf1
ER
33if 'sign_key' in value:
34 sign_key = value['sign_key']
35else:
36 sign_key = None
37
8911f226
ER
38if 'old_poldek' in value and value['old_poldek'] == 'yes':
39 old_poldek = True
0bf1ad60 40else:
8911f226 41 old_poldek = False
0bf1ad60 42
cf5727b7 43if 'poldek_indexes' in value:
8911f226 44 poldek_indexes = value['poldek_indexes']
cf5727b7 45else:
8911f226 46 poldek_indexes = 'old'
cf5727b7 47
8911f226
ER
48if value['separate_noarch'] == 'yes':
49 separate_noarch = True
796b7867 50else:
8911f226 51 separate_noarch = False
796b7867 52
54ff0049
ER
53if value['separate_debuginfo'] == 'yes':
54 separate_debuginfo = True
55else:
56 separate_debuginfo = False
57
796b7867 58if separate_noarch:
8911f226 59 all_ftp_archs = ['noarch'] + ftp_archs
796b7867 60else:
8911f226 61 all_ftp_archs = ftp_archs
This page took 0.068706 seconds and 4 git commands to generate.