54
55
if line[ :1 ] == '#': continue
57
matches = re.match( '\[(.*)\]$', line );
58
matches = re.search( '^\[(.*)\]$', line );
59
60
section = matches.group( 1 )
61
matches = re.match( '([a-z0-9_-]+)\\s*=\\s*(.*)$', line, re.I )
62
matches = re.search( '^([a-z0-9_-]+)\\s*=\\s*(.*)$', line, re.I )
63
64
name = matches.group( 1 )
64
65
value = matches.group( 2 )
67
matches = re.match( '(["\'])((?:\\.|[^\\1])*)\\1(?:\\s*#.*)?$',
69
'^(["\'])((?:\\.|[^\\1])*)\\1(?:\\s*#.*)?$', value )
70
71
value = matches.group( 2 )
72
matches = re.match( '([^#]+?)(?:\\s*#.*)?$', value )
73
matches = re.search( '^([^#]+?)(?:\\s*#.*)?$', value )
74
75
value = matches.group( 1 )
75
76
config[ "%s.%s" % ( section, name ) ] = value
76
print " %s.%s = %s" % ( section, name, value )
77
#print " %s.%s = %s" % ( section, name, value )
79
80
if 'stdhome.home-dir' in config:
80
81
the.home_dir = config[ 'stdhome.home-dir' ]
82
if 'stdhome.default-vcs' in config:
83
self.default_vcs = config[ 'stdhome.default-vcs' ]
82
85
# read file matcher lists
83
86
self.symlinks = FileMatcher( config_file, 'symlink' )
87
90
def to_bool( self, value ):
88
91
value = value.lower()
89
return value == 't' || value == 'true' || value == 'yes' || \
90
( re.match( '[0-9]+$', value ) && int( value ) != 0 )
92
return value == 't' or value == 'true' or value == 'yes' or \
93
( re.search( '^[0-9]+$', value ) and int( value ) != 0 )