@@ -239,49 +239,12 @@ def _parse_makefile(filename, vars=None):
239
239
vars .update (done )
240
240
return vars
241
241
242
- def parse_config_h (fp , vars = None ):
243
- """Parse a config.h-style file.
244
-
245
- A dictionary containing name/value pairs is returned. If an
246
- optional dictionary is passed in as the second argument, it is
247
- used instead of a new dictionary.
248
- """
249
- import re
250
- if vars is None :
251
- vars = {}
252
- define_rx = re .compile ("#define ([A-Z][A-Za-z0-9_]+) (.*)\n " )
253
- undef_rx = re .compile ("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n " )
254
-
255
- while True :
256
- line = fp .readline ()
257
- if not line :
258
- break
259
- m = define_rx .match (line )
260
- if m :
261
- n , v = m .group (1 , 2 )
262
- try : v = int (v )
263
- except ValueError : pass
264
- vars [n ] = v
265
- else :
266
- m = undef_rx .match (line )
267
- if m :
268
- vars [m .group (1 )] = 0
269
- return vars
270
242
271
243
def _get_makefile_filename ():
272
244
if _PYTHON_BUILD :
273
245
return os .path .join (_PROJECT_BASE , "Makefile" )
274
246
return os .path .join (get_path ('stdlib' ), "config" , "Makefile" )
275
247
276
- def get_config_h_filename ():
277
- if _PYTHON_BUILD :
278
- if os .name == "nt" :
279
- inc_dir = os .path .join (_PROJECT_BASE , "PC" )
280
- else :
281
- inc_dir = _PROJECT_BASE
282
- else :
283
- inc_dir = get_path ('platinclude' )
284
- return os .path .join (inc_dir , 'pyconfig.h' )
285
248
286
249
def _init_posix (vars ):
287
250
"""Initialize the module as appropriate for POSIX systems."""
@@ -339,10 +302,55 @@ def _init_non_posix(vars):
339
302
# public APIs
340
303
#
341
304
305
+
306
+ def parse_config_h (fp , vars = None ):
307
+ """Parse a config.h-style file.
308
+
309
+ A dictionary containing name/value pairs is returned. If an
310
+ optional dictionary is passed in as the second argument, it is
311
+ used instead of a new dictionary.
312
+ """
313
+ import re
314
+ if vars is None :
315
+ vars = {}
316
+ define_rx = re .compile ("#define ([A-Z][A-Za-z0-9_]+) (.*)\n " )
317
+ undef_rx = re .compile ("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n " )
318
+
319
+ while True :
320
+ line = fp .readline ()
321
+ if not line :
322
+ break
323
+ m = define_rx .match (line )
324
+ if m :
325
+ n , v = m .group (1 , 2 )
326
+ try : v = int (v )
327
+ except ValueError : pass
328
+ vars [n ] = v
329
+ else :
330
+ m = undef_rx .match (line )
331
+ if m :
332
+ vars [m .group (1 )] = 0
333
+ return vars
334
+
335
+ def get_config_h_filename ():
336
+ """Returns the path of pyconfig.h."""
337
+ if _PYTHON_BUILD :
338
+ if os .name == "nt" :
339
+ inc_dir = os .path .join (_PROJECT_BASE , "PC" )
340
+ else :
341
+ inc_dir = _PROJECT_BASE
342
+ else :
343
+ inc_dir = get_path ('platinclude' )
344
+ return os .path .join (inc_dir , 'pyconfig.h' )
345
+
342
346
def get_scheme_names ():
343
- return _INSTALL_SCHEMES .keys ()
347
+ """Returns a tuple containing the schemes names."""
348
+ schemes = list (_INSTALL_SCHEMES .keys ())
349
+ schemes .sort ()
350
+ return tuple (schemes )
344
351
345
352
def get_path_names ():
353
+ """Returns a tuple containing the paths names."""
346
354
return _SCHEME_KEYS
347
355
348
356
def get_paths (scheme = _get_default_scheme (), vars = None , expand = True ):
0 commit comments