@@ -45,7 +45,7 @@ def __init__(
45
45
undefine_symbols = None ,
46
46
cflags = "" ,
47
47
compiler = None ,
48
- xml_generator = "castxml" ,
48
+ xml_generator = None ,
49
49
keep_xml = False ,
50
50
compiler_path = None ,
51
51
flags = None ):
@@ -187,11 +187,16 @@ def __ensure_dir_exists(self, dir_path, meaning):
187
187
(meaning , dir_path ))
188
188
189
189
def raise_on_wrong_settings (self ):
190
- """validates the configuration settings and raises RuntimeError on
191
- error"""
190
+ """
191
+ Validates the configuration settings and raises RuntimeError on error
192
+ """
192
193
self .__ensure_dir_exists (self .working_directory , 'working directory' )
193
194
for idir in self .include_paths :
194
195
self .__ensure_dir_exists (idir , 'include directory' )
196
+ if self .__xml_generator not in ["castxml" , "gccxml" ]:
197
+ msg = ('xml_generator("%s") should either be ' +
198
+ '"castxml" or "gccxml".' ) % self .xml_generator
199
+ raise RuntimeError (msg )
195
200
196
201
197
202
class xml_generator_configuration_t (parser_configuration_t ):
@@ -215,7 +220,7 @@ def __init__(
215
220
ignore_gccxml_output = False ,
216
221
cflags = "" ,
217
222
compiler = None ,
218
- xml_generator = "castxml" ,
223
+ xml_generator = None ,
219
224
keep_xml = False ,
220
225
compiler_path = None ,
221
226
flags = None ):
@@ -277,31 +282,12 @@ def ignore_gccxml_output(self, val=True):
277
282
278
283
def raise_on_wrong_settings (self ):
279
284
super (xml_generator_configuration_t , self ).raise_on_wrong_settings ()
280
- if os .path .isfile (self .xml_generator_path ):
281
- return
282
- if os .name == 'nt' :
283
- gccxml_name = 'gccxml' + '.exe'
284
- environment_var_delimiter = ';'
285
- elif os .name == 'posix' :
286
- gccxml_name = 'gccxml'
287
- environment_var_delimiter = ':'
288
- else :
289
- raise RuntimeError (
290
- 'unable to find out location of the xml generator' )
291
- may_be_gccxml = os .path .join (self .xml_generator_path , gccxml_name )
292
- if os .path .isfile (may_be_gccxml ):
293
- self .xml_generator_path = may_be_gccxml
294
- else :
295
- for path in os .environ ['PATH' ].split (environment_var_delimiter ):
296
- xml_generator_path = os .path .join (path , gccxml_name )
297
- if os .path .isfile (xml_generator_path ):
298
- self .xml_generator_path = xml_generator_path
299
- break
300
- else :
301
- msg = (
302
- 'xml_generator_path("%s") should exists or to be a ' +
303
- 'valid file name.' ) % self .xml_generator_path
304
- raise RuntimeError (msg )
285
+ if self .xml_generator_path is None or \
286
+ not os .path .isfile (self .xml_generator_path ):
287
+ msg = (
288
+ 'xml_generator_path("%s") should be set and exist.' ) \
289
+ % self .xml_generator_path
290
+ raise RuntimeError (msg )
305
291
306
292
307
293
class _StringDeprecationWrapper (str ):
0 commit comments