blob: daa4dc77ca858719f3dcf836bcdd533bcb63c1c7 [file] [log] [blame]
Fred Drake70b014d2001-07-18 18:39:56 +00001"""Provide access to Python's configuration information. The specific
2configuration variables available depend heavily on the platform and
3configuration. The values may be retrieved using
4get_config_var(name), and the list of variables is available via
5get_config_vars().keys(). Additional convenience functions are also
6available.
Greg Ward1190ee31998-12-18 23:46:33 +00007
8Written by: Fred L. Drake, Jr.
9Email: <fdrake@acm.org>
Greg Ward1190ee31998-12-18 23:46:33 +000010"""
11
Greg Ward82d71ca2000-06-03 00:44:30 +000012__revision__ = "$Id$"
Greg Ward1190ee31998-12-18 23:46:33 +000013
Tarek Ziadédd7bef92010-03-05 00:16:02 +000014import os
Greg Ward9ddaaa11999-01-06 14:46:06 +000015import re
Tarek Ziadédd7bef92010-03-05 00:16:02 +000016import string
17import sys
Greg Ward1190ee31998-12-18 23:46:33 +000018
Tarek Ziadédd7bef92010-03-05 00:16:02 +000019from distutils.errors import DistutilsPlatformError
Greg Warda0ca3f22000-02-02 00:05:14 +000020
Tarek Ziadédd7bef92010-03-05 00:16:02 +000021# These are needed in a couple of spots, so just compute them once.
22PREFIX = os.path.normpath(sys.prefix)
23EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
Tarek Ziadé0276c7a2010-01-26 21:21:54 +000024
Tarek Ziadédd7bef92010-03-05 00:16:02 +000025# Path to the base directory of the project. On Windows the binary may
26# live in project/PCBuild9. If we're dealing with an x64 Windows build,
27# it'll live in project/PCbuild/amd64.
28project_base = os.path.dirname(os.path.abspath(sys.executable))
29if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
30 project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
31# PC/VS7.1
32if os.name == "nt" and "\\pc\\v" in project_base[-10:].lower():
33 project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
34 os.path.pardir))
35# PC/AMD64
36if os.name == "nt" and "\\pcbuild\\amd64" in project_base[-14:].lower():
37 project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
38 os.path.pardir))
Fred Drakec1ee39a2000-03-09 15:54:52 +000039
Tarek Ziadédd7bef92010-03-05 00:16:02 +000040# python_build: (Boolean) if true, we're either building Python or
41# building an extension with an un-installed Python, so we use
42# different (hard-wired) directories.
43# Setup.local is available for Makefile builds including VPATH builds,
44# Setup.dist is available on Windows
Marc-André Lemburg2db7cd32008-02-05 14:50:40 +000045def _python_build():
Tarek Ziadédd7bef92010-03-05 00:16:02 +000046 for fn in ("Setup.dist", "Setup.local"):
47 if os.path.isfile(os.path.join(project_base, "Modules", fn)):
48 return True
49 return False
Marc-André Lemburg2db7cd32008-02-05 14:50:40 +000050python_build = _python_build()
Fred Drakec1ee39a2000-03-09 15:54:52 +000051
Tarek Ziadé5633a802010-01-23 09:23:15 +000052
Tarek Ziadédd7bef92010-03-05 00:16:02 +000053def get_python_version():
54 """Return a string containing the major and minor Python version,
55 leaving off the patchlevel. Sample return values could be '1.5'
56 or '2.2'.
57 """
58 return sys.version[:3]
59
60
61def get_python_inc(plat_specific=0, prefix=None):
62 """Return the directory containing installed Python header files.
Fred Drakec1ee39a2000-03-09 15:54:52 +000063
64 If 'plat_specific' is false (the default), this is the path to the
65 non-platform-specific header files, i.e. Python.h and so on;
66 otherwise, this is the path to platform-specific header files
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +000067 (namely pyconfig.h).
Fred Drakec1ee39a2000-03-09 15:54:52 +000068
Greg Wardd38e6f72000-04-10 01:17:49 +000069 If 'prefix' is supplied, use it instead of sys.prefix or
70 sys.exec_prefix -- i.e., ignore 'plat_specific'.
Fred Drakeb94b8492001-12-06 20:51:35 +000071 """
Tarek Ziadédd7bef92010-03-05 00:16:02 +000072 if prefix is None:
73 prefix = plat_specific and EXEC_PREFIX or PREFIX
Tarek Ziadéa5cd1822010-04-30 12:15:12 +000074
Tarek Ziadédd7bef92010-03-05 00:16:02 +000075 if os.name == "posix":
76 if python_build:
Tarek Ziadéa5cd1822010-04-30 12:15:12 +000077 buildir = os.path.dirname(sys.executable)
Tarek Ziadédd7bef92010-03-05 00:16:02 +000078 if plat_specific:
Tarek Ziadéa5cd1822010-04-30 12:15:12 +000079 # python.h is located in the buildir
80 inc_dir = buildir
Tarek Ziadédd7bef92010-03-05 00:16:02 +000081 else:
Tarek Ziadéa5cd1822010-04-30 12:15:12 +000082 # the source dir is relative to the buildir
83 srcdir = os.path.abspath(os.path.join(buildir,
84 get_config_var('srcdir')))
85 # Include is located in the srcdir
86 inc_dir = os.path.join(srcdir, "Include")
Tarek Ziadédd7bef92010-03-05 00:16:02 +000087 return inc_dir
88 return os.path.join(prefix, "include", "python" + get_python_version())
89 elif os.name == "nt":
90 return os.path.join(prefix, "include")
Tarek Ziadédd7bef92010-03-05 00:16:02 +000091 elif os.name == "os2":
92 return os.path.join(prefix, "Include")
Greg Ward7d73b9e2000-03-09 03:16:05 +000093 else:
Tarek Ziadédd7bef92010-03-05 00:16:02 +000094 raise DistutilsPlatformError(
95 "I don't know where Python installs its C header files "
96 "on platform '%s'" % os.name)
Greg Ward7d73b9e2000-03-09 03:16:05 +000097
98
Tarek Ziadédd7bef92010-03-05 00:16:02 +000099def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
100 """Return the directory containing the Python library (standard or
Fred Drakec1ee39a2000-03-09 15:54:52 +0000101 site additions).
Greg Ward7d73b9e2000-03-09 03:16:05 +0000102
Fred Drakec1ee39a2000-03-09 15:54:52 +0000103 If 'plat_specific' is true, return the directory containing
104 platform-specific modules, i.e. any module from a non-pure-Python
105 module distribution; otherwise, return the platform-shared library
106 directory. If 'standard_lib' is true, return the directory
107 containing standard Python library modules; otherwise, return the
108 directory for site-specific modules.
109
Greg Wardd38e6f72000-04-10 01:17:49 +0000110 If 'prefix' is supplied, use it instead of sys.prefix or
111 sys.exec_prefix -- i.e., ignore 'plat_specific'.
Fred Drakec1ee39a2000-03-09 15:54:52 +0000112 """
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000113 if prefix is None:
114 prefix = plat_specific and EXEC_PREFIX or PREFIX
Marc-André Lemburg2544f512002-01-31 18:56:00 +0000115
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000116 if os.name == "posix":
117 libpython = os.path.join(prefix,
118 "lib", "python" + get_python_version())
119 if standard_lib:
120 return libpython
Marc-André Lemburg2544f512002-01-31 18:56:00 +0000121 else:
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000122 return os.path.join(libpython, "site-packages")
123
124 elif os.name == "nt":
125 if standard_lib:
126 return os.path.join(prefix, "Lib")
127 else:
128 if get_python_version() < "2.2":
129 return prefix
130 else:
131 return os.path.join(prefix, "Lib", "site-packages")
132
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000133 elif os.name == "os2":
134 if standard_lib:
135 return os.path.join(prefix, "Lib")
136 else:
137 return os.path.join(prefix, "Lib", "site-packages")
138
Greg Ward7d73b9e2000-03-09 03:16:05 +0000139 else:
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000140 raise DistutilsPlatformError(
141 "I don't know where Python installs its library "
142 "on platform '%s'" % os.name)
143
Ned Deily18fae3f2013-01-31 01:24:55 -0800144
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000145
146def customize_compiler(compiler):
147 """Do any platform-specific customization of a CCompiler instance.
148
149 Mainly needed on Unix, so we can plug in the information that
150 varies across Unices and is stored in Python's Makefile.
151 """
152 if compiler.compiler_type == "unix":
Ned Deily18fae3f2013-01-31 01:24:55 -0800153 if sys.platform == "darwin":
154 # Perform first-time customization of compiler-related
155 # config vars on OS X now that we know we need a compiler.
156 # This is primarily to support Pythons from binary
157 # installers. The kind and paths to build tools on
158 # the user system may vary significantly from the system
159 # that Python itself was built on. Also the user OS
160 # version and build tools may not support the same set
161 # of CPU architectures for universal builds.
162 global _config_vars
163 if not _config_vars.get('CUSTOMIZED_OSX_COMPILER', ''):
164 import _osx_support
165 _osx_support.customize_compiler(_config_vars)
166 _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
167
Ned Deilyc47a4592012-02-11 20:40:24 +0100168 (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000169 get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
Ned Deilyc47a4592012-02-11 20:40:24 +0100170 'CCSHARED', 'LDSHARED', 'SO', 'AR',
171 'ARFLAGS')
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000172
Ned Deily0d0ea482012-02-10 12:59:06 +0100173 newcc = None
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000174 if 'CC' in os.environ:
Ned Deily18fae3f2013-01-31 01:24:55 -0800175 cc = os.environ['CC']
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000176 if 'CXX' in os.environ:
177 cxx = os.environ['CXX']
178 if 'LDSHARED' in os.environ:
179 ldshared = os.environ['LDSHARED']
180 if 'CPP' in os.environ:
181 cpp = os.environ['CPP']
Andrew M. Kuchling29c86232002-11-04 19:53:24 +0000182 else:
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000183 cpp = cc + " -E" # not always
184 if 'LDFLAGS' in os.environ:
185 ldshared = ldshared + ' ' + os.environ['LDFLAGS']
186 if 'CFLAGS' in os.environ:
187 cflags = opt + ' ' + os.environ['CFLAGS']
188 ldshared = ldshared + ' ' + os.environ['CFLAGS']
189 if 'CPPFLAGS' in os.environ:
190 cpp = cpp + ' ' + os.environ['CPPFLAGS']
191 cflags = cflags + ' ' + os.environ['CPPFLAGS']
192 ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
Ned Deilyc47a4592012-02-11 20:40:24 +0100193 if 'AR' in os.environ:
194 ar = os.environ['AR']
195 if 'ARFLAGS' in os.environ:
196 archiver = ar + ' ' + os.environ['ARFLAGS']
197 else:
198 archiver = ar + ' ' + ar_flags
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000199
200 cc_cmd = cc + ' ' + cflags
201 compiler.set_executables(
202 preprocessor=cpp,
203 compiler=cc_cmd,
204 compiler_so=cc_cmd + ' ' + ccshared,
205 compiler_cxx=cxx,
206 linker_so=ldshared,
Ned Deilyc47a4592012-02-11 20:40:24 +0100207 linker_exe=cc,
208 archiver=archiver)
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000209
210 compiler.shared_lib_extension = so_ext
211
212
213def get_config_h_filename():
214 """Return full pathname of installed pyconfig.h file."""
215 if python_build:
216 if os.name == "nt":
217 inc_dir = os.path.join(project_base, "PC")
218 else:
219 inc_dir = project_base
220 else:
221 inc_dir = get_python_inc(plat_specific=1)
222 if get_python_version() < '2.2':
223 config_h = 'config.h'
224 else:
225 # The name of the config.h file changed in 2.2
226 config_h = 'pyconfig.h'
227 return os.path.join(inc_dir, config_h)
228
Greg Ward1190ee31998-12-18 23:46:33 +0000229
Greg Ward9ddaaa11999-01-06 14:46:06 +0000230def get_makefile_filename():
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000231 """Return full pathname of installed Makefile from the Python build."""
232 if python_build:
233 return os.path.join(os.path.dirname(sys.executable), "Makefile")
234 lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
235 return os.path.join(lib_dir, "config", "Makefile")
Greg Ward7d73b9e2000-03-09 03:16:05 +0000236
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000237
238def parse_config_h(fp, g=None):
239 """Parse a config.h-style file.
240
241 A dictionary containing name/value pairs is returned. If an
242 optional dictionary is passed in as the second argument, it is
243 used instead of a new dictionary.
Fred Drake522af3a1999-01-06 16:28:34 +0000244 """
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000245 if g is None:
246 g = {}
247 define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
248 undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
249 #
250 while 1:
251 line = fp.readline()
252 if not line:
253 break
254 m = define_rx.match(line)
255 if m:
256 n, v = m.group(1, 2)
257 try: v = int(v)
258 except ValueError: pass
259 g[n] = v
260 else:
261 m = undef_rx.match(line)
262 if m:
263 g[m.group(1)] = 0
264 return g
265
Greg Wardd283ce72000-09-17 00:53:02 +0000266
267# Regexes needed for parsing Makefile (and similar syntaxes,
268# like old-style Setup files).
269_variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
270_findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
271_findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
272
Greg Ward3fff8d22000-09-15 00:03:13 +0000273def parse_makefile(fn, g=None):
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000274 """Parse a Makefile-style file.
Fred Drakec1ee39a2000-03-09 15:54:52 +0000275
276 A dictionary containing name/value pairs is returned. If an
277 optional dictionary is passed in as the second argument, it is
278 used instead of a new dictionary.
Fred Drake522af3a1999-01-06 16:28:34 +0000279 """
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000280 from distutils.text_file import TextFile
281 fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1)
282
283 if g is None:
284 g = {}
285 done = {}
286 notdone = {}
287
288 while 1:
289 line = fp.readline()
290 if line is None: # eof
291 break
292 m = _variable_rx.match(line)
293 if m:
294 n, v = m.group(1, 2)
295 v = v.strip()
296 # `$$' is a literal `$' in make
297 tmpv = v.replace('$$', '')
298
299 if "$" in tmpv:
300 notdone[n] = v
301 else:
302 try:
303 v = int(v)
304 except ValueError:
305 # insert literal `$'
306 done[n] = v.replace('$$', '$')
307 else:
308 done[n] = v
309
310 # do variable interpolation here
311 while notdone:
312 for name in notdone.keys():
313 value = notdone[name]
314 m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
315 if m:
316 n = m.group(1)
317 found = True
318 if n in done:
319 item = str(done[n])
320 elif n in notdone:
321 # get it on a subsequent round
322 found = False
323 elif n in os.environ:
324 # do it like make: fall back to environment
325 item = os.environ[n]
326 else:
327 done[n] = item = ""
328 if found:
329 after = value[m.end():]
330 value = value[:m.start()] + item + after
331 if "$" in after:
332 notdone[name] = value
333 else:
334 try: value = int(value)
335 except ValueError:
336 done[name] = value.strip()
337 else:
338 done[name] = value
339 del notdone[name]
340 else:
341 # bogus variable reference; just drop it since we can't deal
342 del notdone[name]
343
344 fp.close()
345
Antoine Pitrou58dab672010-10-10 09:54:59 +0000346 # strip spurious spaces
347 for k, v in done.items():
348 if isinstance(v, str):
349 done[k] = v.strip()
350
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000351 # save the results in the global dictionary
352 g.update(done)
353 return g
354
Greg Ward1190ee31998-12-18 23:46:33 +0000355
Greg Wardd283ce72000-09-17 00:53:02 +0000356def expand_makefile_vars(s, vars):
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000357 """Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in
Greg Wardd283ce72000-09-17 00:53:02 +0000358 'string' according to 'vars' (a dictionary mapping variable names to
359 values). Variables not present in 'vars' are silently expanded to the
360 empty string. The variable values in 'vars' should not contain further
361 variable expansions; if 'vars' is the output of 'parse_makefile()',
362 you're fine. Returns a variable-expanded version of 's'.
363 """
364
365 # This algorithm does multiple expansion, so if vars['foo'] contains
366 # "${bar}", it will expand ${foo} to ${bar}, and then expand
367 # ${bar}... and so forth. This is fine as long as 'vars' comes from
368 # 'parse_makefile()', which takes care of such expansions eagerly,
369 # according to make's variable expansion semantics.
370
371 while 1:
372 m = _findvar1_rx.search(s) or _findvar2_rx.search(s)
373 if m:
Greg Wardd283ce72000-09-17 00:53:02 +0000374 (beg, end) = m.span()
375 s = s[0:beg] + vars.get(m.group(1)) + s[end:]
376 else:
377 break
378 return s
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000379
380
381_config_vars = None
382
383def _init_posix():
384 """Initialize the module as appropriate for POSIX systems."""
385 g = {}
386 # load the installed Makefile:
387 try:
388 filename = get_makefile_filename()
389 parse_makefile(filename, g)
390 except IOError, msg:
391 my_msg = "invalid Python installation: unable to open %s" % filename
392 if hasattr(msg, "strerror"):
393 my_msg = my_msg + " (%s)" % msg.strerror
394
395 raise DistutilsPlatformError(my_msg)
396
397 # load the installed pyconfig.h:
398 try:
399 filename = get_config_h_filename()
400 parse_config_h(file(filename), g)
401 except IOError, msg:
402 my_msg = "invalid Python installation: unable to open %s" % filename
403 if hasattr(msg, "strerror"):
404 my_msg = my_msg + " (%s)" % msg.strerror
405
406 raise DistutilsPlatformError(my_msg)
407
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000408 # On AIX, there are wrong paths to the linker scripts in the Makefile
409 # -- these paths are relative to the Python source, but when installed
410 # the scripts are in another directory.
411 if python_build:
412 g['LDSHARED'] = g['BLDSHARED']
413
414 elif get_python_version() < '2.1':
415 # The following two branches are for 1.5.2 compatibility.
416 if sys.platform == 'aix4': # what about AIX 3.x ?
417 # Linker script is in the config directory, not in Modules as the
418 # Makefile says.
419 python_lib = get_python_lib(standard_lib=1)
420 ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix')
421 python_exp = os.path.join(python_lib, 'config', 'python.exp')
422
423 g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp)
424
425 elif sys.platform == 'beos':
426 # Linker script is in the config directory. In the Makefile it is
427 # relative to the srcdir, which after installation no longer makes
428 # sense.
429 python_lib = get_python_lib(standard_lib=1)
430 linkerscript_path = string.split(g['LDSHARED'])[0]
431 linkerscript_name = os.path.basename(linkerscript_path)
432 linkerscript = os.path.join(python_lib, 'config',
433 linkerscript_name)
434
435 # XXX this isn't the right place to do this: adding the Python
436 # library to the link, if needed, should be in the "build_ext"
437 # command. (It's also needed for non-MS compilers on Windows, and
438 # it's taken care of for them by the 'build_ext.get_libraries()'
439 # method.)
440 g['LDSHARED'] = ("%s -L%s/lib -lpython%s" %
441 (linkerscript, PREFIX, get_python_version()))
442
443 global _config_vars
444 _config_vars = g
445
446
447def _init_nt():
448 """Initialize the module as appropriate for NT"""
449 g = {}
450 # set basic install directories
451 g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
452 g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1)
453
454 # XXX hmmm.. a normal install puts include files here
455 g['INCLUDEPY'] = get_python_inc(plat_specific=0)
456
457 g['SO'] = '.pyd'
458 g['EXE'] = ".exe"
459 g['VERSION'] = get_python_version().replace(".", "")
460 g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable))
461
462 global _config_vars
463 _config_vars = g
464
465
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000466def _init_os2():
467 """Initialize the module as appropriate for OS/2"""
468 g = {}
469 # set basic install directories
470 g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
471 g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1)
472
473 # XXX hmmm.. a normal install puts include files here
474 g['INCLUDEPY'] = get_python_inc(plat_specific=0)
475
476 g['SO'] = '.pyd'
477 g['EXE'] = ".exe"
478
479 global _config_vars
480 _config_vars = g
481
482
483def get_config_vars(*args):
484 """With no arguments, return a dictionary of all configuration
485 variables relevant for the current platform. Generally this includes
486 everything needed to build extensions and install both pure modules and
487 extensions. On Unix, this means every variable defined in Python's
488 installed Makefile; on Windows and Mac OS it's a much smaller set.
489
490 With arguments, return a list of values that result from looking up
491 each argument in the configuration variable dictionary.
492 """
493 global _config_vars
494 if _config_vars is None:
495 func = globals().get("_init_" + os.name)
496 if func:
497 func()
498 else:
499 _config_vars = {}
500
501 # Normalized versions of prefix and exec_prefix are handy to have;
502 # in fact, these are the standard versions used most places in the
503 # Distutils.
504 _config_vars['prefix'] = PREFIX
505 _config_vars['exec_prefix'] = EXEC_PREFIX
506
Ned Deily18fae3f2013-01-31 01:24:55 -0800507 # OS X platforms require special customization to handle
508 # multi-architecture, multi-os-version installers
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000509 if sys.platform == 'darwin':
Ned Deily18fae3f2013-01-31 01:24:55 -0800510 import _osx_support
511 _osx_support.customize_config_vars(_config_vars)
Tarek Ziadédd7bef92010-03-05 00:16:02 +0000512
513 if args:
514 vals = []
515 for name in args:
516 vals.append(_config_vars.get(name))
517 return vals
518 else:
519 return _config_vars
520
521def get_config_var(name):
522 """Return the value of a single variable using the dictionary
523 returned by 'get_config_vars()'. Equivalent to
524 get_config_vars().get(name)
525 """
526 return get_config_vars().get(name)