comparison mozillatry.py @ 20:8587528177b4

begin to separate out path handling
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 06 Dec 2012 16:47:52 -0800
parents 328e88120fc2
children 0cac33b7682a
comparison
equal deleted inserted replaced
19:2d6b1a8a2b7d 20:8587528177b4
91 'mozilla_central': {'help': "path to mozilla-central clone", 91 'mozilla_central': {'help': "path to mozilla-central clone",
92 'required': True, 92 'required': True,
93 'flags': ["--m-c", "--mozilla-central"]} 93 'flags': ["--m-c", "--mozilla-central"]}
94 } 94 }
95 95
96 # configuration items to interpolate as paths
97 paths = ['mozilla_central']
98
96 def __init__(self): 99 def __init__(self):
97 configuration.Configuration.__init__(self, usage=self.usage, load='--config') 100 configuration.Configuration.__init__(self, usage=self.usage, load='--config')
98 101
99 def validate(self): 102 def validate(self):
100 """check configuration""" 103 """check configuration"""
102 configuration.Configuration.validate(self) 105 configuration.Configuration.validate(self)
103 106
104 if (not self.config.get('opt')) and (not self.config.get('debug')): 107 if (not self.config.get('opt')) and (not self.config.get('debug')):
105 raise ConfigurationError("Must have opt or debug builds") 108 raise ConfigurationError("Must have opt or debug builds")
106 109
107 self.config['mozilla_central'] = os.path.expanduser(self.config['mozilla_central']) 110 for path in self.paths:
111 self.config[path] = os.path.expanduser(self.config[path])
112
108 try_directory = self.config.get('mozilla_central') 113 try_directory = self.config.get('mozilla_central')
109 if (try_directory is None) or (not os.path.exists(try_directory)): 114 if (try_directory is None) or (not os.path.exists(try_directory)):
110 raise ConfigurationError("mozilla-central directory does not exist: %s" % try_directory) 115 raise ConfigurationError("mozilla-central directory does not exist: %s" % try_directory)
111 116
112 # TODO: make a 'path' type 117 # TODO: make a 'path' type