/Lib/distutils/sysconfig.py

http://unladen-swallow.googlecode.com/ · Python · 650 lines · 503 code · 52 blank · 95 comment · 56 complexity · 63d1d5f6fa1e9187aab0d7dccd766f2a MD5 · raw file

  1. """Provide access to Python's configuration information. The specific
  2. configuration variables available depend heavily on the platform and
  3. configuration. The values may be retrieved using
  4. get_config_var(name), and the list of variables is available via
  5. get_config_vars().keys(). Additional convenience functions are also
  6. available.
  7. Written by: Fred L. Drake, Jr.
  8. Email: <fdrake@acm.org>
  9. """
  10. __revision__ = "$Id: sysconfig.py 75023 2009-09-22 19:31:34Z ronald.oussoren $"
  11. import os
  12. import re
  13. import sys
  14. # These are needed in a couple of spots, so just compute them once.
  15. PREFIX = os.path.normpath(sys.prefix)
  16. EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
  17. # Path to the base directory of the project. On Windows the binary may
  18. # live in project/PCBuild9. If we're dealing with an x64 Windows build,
  19. # it'll live in project/PCbuild/amd64.
  20. project_base = os.path.dirname(os.path.abspath(sys.executable))
  21. if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
  22. project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
  23. # PC/VS7.1
  24. if os.name == "nt" and "\\pc\\v" in project_base[-10:].lower():
  25. project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
  26. os.path.pardir))
  27. # PC/AMD64
  28. if os.name == "nt" and "\\pcbuild\\amd64" in project_base[-14:].lower():
  29. project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
  30. os.path.pardir))
  31. # python_build: (Boolean) if true, we're either building Python or
  32. # building an extension with an un-installed Python, so we use
  33. # different (hard-wired) directories.
  34. # Setup.local is available for Makefile builds including VPATH builds,
  35. # Setup.dist is available on Windows
  36. def _python_build():
  37. for fn in ("Setup.dist", "Setup.local"):
  38. if os.path.isfile(os.path.join(project_base, "Modules", fn)):
  39. return True
  40. return False
  41. python_build = _python_build()
  42. def get_python_version():
  43. """Return a string containing the major and minor Python version,
  44. leaving off the patchlevel. Sample return values could be '1.5'
  45. or '2.2'.
  46. """
  47. return sys.version[:3]
  48. def get_python_inc(plat_specific=0, prefix=None):
  49. """Return the directory containing installed Python header files.
  50. If 'plat_specific' is false (the default), this is the path to the
  51. non-platform-specific header files, i.e. Python.h and so on;
  52. otherwise, this is the path to platform-specific header files
  53. (namely pyconfig.h).
  54. If 'prefix' is supplied, use it instead of sys.prefix or
  55. sys.exec_prefix -- i.e., ignore 'plat_specific'.
  56. """
  57. if prefix is None:
  58. prefix = plat_specific and EXEC_PREFIX or PREFIX
  59. if os.name == "posix":
  60. if python_build:
  61. # Assume the executable is in the build directory. The
  62. # pyconfig.h file should be in the same directory. Since
  63. # the build directory may not be the source directory, we
  64. # must use "srcdir" from the makefile to find the "Include"
  65. # directory.
  66. base = os.path.dirname(os.path.abspath(sys.executable))
  67. if plat_specific:
  68. return base
  69. else:
  70. incdir = os.path.join(get_config_var('srcdir'), 'Include')
  71. return os.path.normpath(incdir)
  72. return os.path.join(prefix, "include", "python" + get_python_version())
  73. elif os.name == "nt":
  74. return os.path.join(prefix, "include")
  75. elif os.name == "mac":
  76. if plat_specific:
  77. return os.path.join(prefix, "Mac", "Include")
  78. else:
  79. return os.path.join(prefix, "Include")
  80. elif os.name == "os2":
  81. return os.path.join(prefix, "Include")
  82. else:
  83. # Delay import to improve interpreter-startup time.
  84. from distutils.errors import DistutilsPlatformError
  85. raise DistutilsPlatformError(
  86. "I don't know where Python installs its C header files "
  87. "on platform '%s'" % os.name)
  88. def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
  89. """Return the directory containing the Python library (standard or
  90. site additions).
  91. If 'plat_specific' is true, return the directory containing
  92. platform-specific modules, i.e. any module from a non-pure-Python
  93. module distribution; otherwise, return the platform-shared library
  94. directory. If 'standard_lib' is true, return the directory
  95. containing standard Python library modules; otherwise, return the
  96. directory for site-specific modules.
  97. If 'prefix' is supplied, use it instead of sys.prefix or
  98. sys.exec_prefix -- i.e., ignore 'plat_specific'.
  99. """
  100. if prefix is None:
  101. prefix = plat_specific and EXEC_PREFIX or PREFIX
  102. if os.name == "posix":
  103. libpython = os.path.join(prefix,
  104. "lib", "python" + get_python_version())
  105. if standard_lib:
  106. return libpython
  107. else:
  108. return os.path.join(libpython, "site-packages")
  109. elif os.name == "nt":
  110. if standard_lib:
  111. return os.path.join(prefix, "Lib")
  112. else:
  113. if get_python_version() < "2.2":
  114. return prefix
  115. else:
  116. return os.path.join(prefix, "Lib", "site-packages")
  117. elif os.name == "mac":
  118. if plat_specific:
  119. if standard_lib:
  120. return os.path.join(prefix, "Lib", "lib-dynload")
  121. else:
  122. return os.path.join(prefix, "Lib", "site-packages")
  123. else:
  124. if standard_lib:
  125. return os.path.join(prefix, "Lib")
  126. else:
  127. return os.path.join(prefix, "Lib", "site-packages")
  128. elif os.name == "os2":
  129. if standard_lib:
  130. return os.path.join(prefix, "Lib")
  131. else:
  132. return os.path.join(prefix, "Lib", "site-packages")
  133. else:
  134. # Delay import to improve interpreter-startup time.
  135. from distutils.errors import DistutilsPlatformError
  136. raise DistutilsPlatformError(
  137. "I don't know where Python installs its library "
  138. "on platform '%s'" % os.name)
  139. def customize_compiler(compiler):
  140. """Do any platform-specific customization of a CCompiler instance.
  141. Mainly needed on Unix, so we can plug in the information that
  142. varies across Unices and is stored in Python's Makefile.
  143. """
  144. if compiler.compiler_type == "unix":
  145. (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, libs) = \
  146. get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
  147. 'CCSHARED', 'LDSHARED', 'SO', 'LIBS')
  148. if 'CC' in os.environ:
  149. cc = os.environ['CC']
  150. if 'CXX' in os.environ:
  151. cxx = os.environ['CXX']
  152. if 'LDSHARED' in os.environ:
  153. ldshared = os.environ['LDSHARED']
  154. if 'CPP' in os.environ:
  155. cpp = os.environ['CPP']
  156. else:
  157. cpp = cc + " -E" # not always
  158. if 'LDFLAGS' in os.environ:
  159. ldshared = ldshared + ' ' + os.environ['LDFLAGS']
  160. if 'CFLAGS' in os.environ:
  161. cflags = opt + ' ' + os.environ['CFLAGS']
  162. ldshared = ldshared + ' ' + os.environ['CFLAGS']
  163. if 'CPPFLAGS' in os.environ:
  164. cpp = cpp + ' ' + os.environ['CPPFLAGS']
  165. cflags = cflags + ' ' + os.environ['CPPFLAGS']
  166. ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
  167. if 'LIBS' in os.environ:
  168. libs = os.environ['LIBS']
  169. cc_cmd = cc + ' ' + cflags
  170. compiler.set_executables(
  171. preprocessor=cpp,
  172. compiler=cc_cmd,
  173. compiler_so=cc_cmd + ' ' + ccshared,
  174. compiler_cxx=cxx,
  175. linker_so=ldshared,
  176. linker_exe=cc)
  177. compiler.shared_lib_extension = so_ext
  178. for chunk in libs.split(" "):
  179. if not chunk:
  180. continue
  181. if chunk.startswith("-l"):
  182. chunk = chunk[2:]
  183. compiler.libraries.append(chunk)
  184. def get_config_h_filename():
  185. """Return full pathname of installed pyconfig.h file."""
  186. if python_build:
  187. if os.name == "nt":
  188. inc_dir = os.path.join(project_base, "PC")
  189. else:
  190. inc_dir = project_base
  191. else:
  192. inc_dir = get_python_inc(plat_specific=1)
  193. if get_python_version() < '2.2':
  194. config_h = 'config.h'
  195. else:
  196. # The name of the config.h file changed in 2.2
  197. config_h = 'pyconfig.h'
  198. return os.path.join(inc_dir, config_h)
  199. def get_makefile_filename():
  200. """Return full pathname of installed Makefile from the Python build."""
  201. if python_build:
  202. return os.path.join(os.path.dirname(sys.executable), "Makefile")
  203. lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
  204. return os.path.join(lib_dir, "config", "Makefile")
  205. def get_sysconfig_filename():
  206. """Return absolute pathname of the installed sysconfig file."""
  207. if python_build:
  208. return os.path.join(os.path.dirname(sys.executable), "sysconfig")
  209. lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
  210. return os.path.join(lib_dir, "config", "sysconfig")
  211. def parse_config_h(fp, g=None):
  212. """Parse a config.h-style file.
  213. A dictionary containing name/value pairs is returned. If an
  214. optional dictionary is passed in as the second argument, it is
  215. used instead of a new dictionary.
  216. """
  217. if g is None:
  218. g = {}
  219. define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
  220. undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
  221. #
  222. while 1:
  223. line = fp.readline()
  224. if not line:
  225. break
  226. m = define_rx.match(line)
  227. if m:
  228. n, v = m.group(1, 2)
  229. try: v = int(v)
  230. except ValueError: pass
  231. g[n] = v
  232. else:
  233. m = undef_rx.match(line)
  234. if m:
  235. g[m.group(1)] = 0
  236. return g
  237. # There's almost certainly something out there that expects parse_config_h() to
  238. # take a file-like object. Sigh. Create a simple wrapper for our own nefarious
  239. # purposes.
  240. def _parse_config_h_filename(filename, g=None):
  241. with open(filename) as fp:
  242. return parse_config_h(fp, g)
  243. # Regexes needed for parsing Makefile (and similar syntaxes,
  244. # like old-style Setup files).
  245. _variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
  246. _findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
  247. _findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
  248. def parse_makefile(fn, g=None):
  249. """Parse a Makefile-style file.
  250. A dictionary containing name/value pairs is returned. If an
  251. optional dictionary is passed in as the second argument, it is
  252. used instead of a new dictionary.
  253. """
  254. from distutils.text_file import TextFile
  255. fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1)
  256. if g is None:
  257. g = {}
  258. done = {}
  259. notdone = {}
  260. while 1:
  261. line = fp.readline()
  262. if line is None: # eof
  263. break
  264. m = _variable_rx.match(line)
  265. if m:
  266. n, v = m.group(1, 2)
  267. v = v.strip()
  268. # `$$' is a literal `$' in make
  269. tmpv = v.replace('$$', '')
  270. if "$" in tmpv:
  271. notdone[n] = v
  272. else:
  273. try:
  274. v = int(v)
  275. except ValueError:
  276. # insert literal `$'
  277. done[n] = v.replace('$$', '$')
  278. else:
  279. done[n] = v
  280. # do variable interpolation here
  281. while notdone:
  282. for name in notdone.keys():
  283. value = notdone[name]
  284. m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
  285. if m:
  286. n = m.group(1)
  287. found = True
  288. if n in done:
  289. item = str(done[n])
  290. elif n in notdone:
  291. # get it on a subsequent round
  292. found = False
  293. elif n in os.environ:
  294. # do it like make: fall back to environment
  295. item = os.environ[n]
  296. else:
  297. done[n] = item = ""
  298. if found:
  299. after = value[m.end():]
  300. value = value[:m.start()] + item + after
  301. if "$" in after:
  302. notdone[name] = value
  303. else:
  304. try: value = int(value)
  305. except ValueError:
  306. done[name] = value.strip()
  307. else:
  308. done[name] = value
  309. del notdone[name]
  310. else:
  311. # bogus variable reference; just drop it since we can't deal
  312. del notdone[name]
  313. fp.close()
  314. # save the results in the global dictionary
  315. g.update(done)
  316. return g
  317. def expand_makefile_vars(s, vars):
  318. """Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in
  319. 'string' according to 'vars' (a dictionary mapping variable names to
  320. values). Variables not present in 'vars' are silently expanded to the
  321. empty string. The variable values in 'vars' should not contain further
  322. variable expansions; if 'vars' is the output of 'parse_makefile()',
  323. you're fine. Returns a variable-expanded version of 's'.
  324. """
  325. # This algorithm does multiple expansion, so if vars['foo'] contains
  326. # "${bar}", it will expand ${foo} to ${bar}, and then expand
  327. # ${bar}... and so forth. This is fine as long as 'vars' comes from
  328. # 'parse_makefile()', which takes care of such expansions eagerly,
  329. # according to make's variable expansion semantics.
  330. while 1:
  331. m = _findvar1_rx.search(s) or _findvar2_rx.search(s)
  332. if m:
  333. (beg, end) = m.span()
  334. s = s[0:beg] + vars.get(m.group(1)) + s[end:]
  335. else:
  336. break
  337. return s
  338. def _parse_config_file(filename, parse_func, config_dict):
  339. """Parse a config file into a common dict.
  340. Args:
  341. filename: name of the config file.
  342. parse_func: function to use to parse the file. This will be given
  343. `filename` and `config_dict` as arguments, and should update
  344. `config_dict` in-place.
  345. config_dict: dictionary to update in-place.
  346. Raises:
  347. DistutilsPlatformError: if the file could not be opened.
  348. """
  349. try:
  350. parse_func(filename, config_dict)
  351. except IOError, msg:
  352. my_msg = "invalid Python installation: unable to open %s" % filename
  353. if hasattr(msg, "strerror"):
  354. my_msg = my_msg + " (%s)" % msg.strerror
  355. # Delay import to improve interpreter-startup time.
  356. from distutils.errors import DistutilsPlatformError
  357. raise DistutilsPlatformError(my_msg)
  358. _config_vars = None
  359. def _init_posix():
  360. """Initialize the module as appropriate for POSIX systems."""
  361. g = {}
  362. # load the installed Makefile:
  363. _parse_config_file(get_makefile_filename(), parse_makefile, g)
  364. # load the installed pyconfig.h:
  365. _parse_config_file(get_config_h_filename(), _parse_config_h_filename, g)
  366. # Load the sysconfig config file; this contains variables that are
  367. # calculated while building Python.
  368. _parse_config_file(get_sysconfig_filename(), parse_makefile, g)
  369. # On MacOSX we need to check the setting of the environment variable
  370. # MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so
  371. # it needs to be compatible.
  372. # If it isn't set we set it to the configure-time value
  373. if sys.platform == 'darwin' and 'MACOSX_DEPLOYMENT_TARGET' in g:
  374. cfg_target = g['MACOSX_DEPLOYMENT_TARGET']
  375. cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '')
  376. if cur_target == '':
  377. cur_target = cfg_target
  378. os.putenv('MACOSX_DEPLOYMENT_TARGET', cfg_target)
  379. elif map(int, cfg_target.split('.')) > map(int, cur_target.split('.')):
  380. my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure'
  381. % (cur_target, cfg_target))
  382. # Delay import to improve interpreter-startup time.
  383. from distutils.errors import DistutilsPlatformError
  384. raise DistutilsPlatformError(my_msg)
  385. # On AIX, there are wrong paths to the linker scripts in the Makefile
  386. # -- these paths are relative to the Python source, but when installed
  387. # the scripts are in another directory.
  388. if python_build:
  389. g['LDSHARED'] = g['BLDSHARED']
  390. elif get_python_version() < '2.1':
  391. # The following two branches are for 1.5.2 compatibility.
  392. if sys.platform == 'aix4': # what about AIX 3.x ?
  393. # Linker script is in the config directory, not in Modules as the
  394. # Makefile says.
  395. python_lib = get_python_lib(standard_lib=1)
  396. ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix')
  397. python_exp = os.path.join(python_lib, 'config', 'python.exp')
  398. g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp)
  399. elif sys.platform == 'beos':
  400. # Linker script is in the config directory. In the Makefile it is
  401. # relative to the srcdir, which after installation no longer makes
  402. # sense.
  403. python_lib = get_python_lib(standard_lib=1)
  404. linkerscript_path = g['LDSHARED'].split()[0]
  405. linkerscript_name = os.path.basename(linkerscript_path)
  406. linkerscript = os.path.join(python_lib, 'config',
  407. linkerscript_name)
  408. # XXX this isn't the right place to do this: adding the Python
  409. # library to the link, if needed, should be in the "build_ext"
  410. # command. (It's also needed for non-MS compilers on Windows, and
  411. # it's taken care of for them by the 'build_ext.get_libraries()'
  412. # method.)
  413. g['LDSHARED'] = ("%s -L%s/lib -lpython%s" %
  414. (linkerscript, PREFIX, get_python_version()))
  415. global _config_vars
  416. _config_vars = g
  417. def _init_nt():
  418. """Initialize the module as appropriate for NT"""
  419. g = {}
  420. # set basic install directories
  421. g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
  422. g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1)
  423. # XXX hmmm.. a normal install puts include files here
  424. g['INCLUDEPY'] = get_python_inc(plat_specific=0)
  425. g['SO'] = '.pyd'
  426. g['EXE'] = ".exe"
  427. g['VERSION'] = get_python_version().replace(".", "")
  428. g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable))
  429. global _config_vars
  430. _config_vars = g
  431. def _init_mac():
  432. """Initialize the module as appropriate for Macintosh systems"""
  433. g = {}
  434. # set basic install directories
  435. g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
  436. g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1)
  437. # XXX hmmm.. a normal install puts include files here
  438. g['INCLUDEPY'] = get_python_inc(plat_specific=0)
  439. import MacOS
  440. if not hasattr(MacOS, 'runtimemodel'):
  441. g['SO'] = '.ppc.slb'
  442. else:
  443. g['SO'] = '.%s.slb' % MacOS.runtimemodel
  444. # XXX are these used anywhere?
  445. g['install_lib'] = os.path.join(EXEC_PREFIX, "Lib")
  446. g['install_platlib'] = os.path.join(EXEC_PREFIX, "Mac", "Lib")
  447. # These are used by the extension module build
  448. g['srcdir'] = ':'
  449. global _config_vars
  450. _config_vars = g
  451. def _init_os2():
  452. """Initialize the module as appropriate for OS/2"""
  453. g = {}
  454. # set basic install directories
  455. g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
  456. g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1)
  457. # XXX hmmm.. a normal install puts include files here
  458. g['INCLUDEPY'] = get_python_inc(plat_specific=0)
  459. g['SO'] = '.pyd'
  460. g['EXE'] = ".exe"
  461. global _config_vars
  462. _config_vars = g
  463. def get_config_vars(*args):
  464. """With no arguments, return a dictionary of all configuration
  465. variables relevant for the current platform. Generally this includes
  466. everything needed to build extensions and install both pure modules and
  467. extensions. On Unix, this means every variable defined in Python's
  468. installed Makefile; on Windows and Mac OS it's a much smaller set.
  469. With arguments, return a list of values that result from looking up
  470. each argument in the configuration variable dictionary.
  471. """
  472. global _config_vars
  473. if _config_vars is None:
  474. func = globals().get("_init_" + os.name)
  475. if func:
  476. func()
  477. else:
  478. _config_vars = {}
  479. # Normalized versions of prefix and exec_prefix are handy to have;
  480. # in fact, these are the standard versions used most places in the
  481. # Distutils.
  482. _config_vars['prefix'] = PREFIX
  483. _config_vars['exec_prefix'] = EXEC_PREFIX
  484. if 'srcdir' not in _config_vars:
  485. _config_vars['srcdir'] = project_base
  486. if sys.platform == 'darwin':
  487. kernel_version = os.uname()[2] # Kernel version (8.4.3)
  488. major_version = int(kernel_version.split('.')[0])
  489. if major_version < 8:
  490. # On Mac OS X before 10.4, check if -arch and -isysroot
  491. # are in CFLAGS or LDFLAGS and remove them if they are.
  492. # This is needed when building extensions on a 10.3 system
  493. # using a universal build of python.
  494. for key in ('LDFLAGS', 'BASECFLAGS',
  495. # a number of derived variables. These need to be
  496. # patched up as well.
  497. 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
  498. flags = _config_vars[key]
  499. flags = re.sub('-arch\s+\w+\s', ' ', flags)
  500. flags = re.sub('-isysroot [^ \t]*', ' ', flags)
  501. _config_vars[key] = flags
  502. else:
  503. # Allow the user to override the architecture flags using
  504. # an environment variable.
  505. # NOTE: This name was introduced by Apple in OSX 10.5 and
  506. # is used by several scripting languages distributed with
  507. # that OS release.
  508. if 'ARCHFLAGS' in os.environ:
  509. arch = os.environ['ARCHFLAGS']
  510. for key in ('LDFLAGS', 'BASECFLAGS',
  511. # a number of derived variables. These need to be
  512. # patched up as well.
  513. 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
  514. flags = _config_vars[key]
  515. flags = re.sub('-arch\s+\w+\s', ' ', flags)
  516. flags = flags + ' ' + arch
  517. _config_vars[key] = flags
  518. # If we're on OSX 10.5 or later and the user tries to
  519. # compiles an extension using an SDK that is not present
  520. # on the current machine it is better to not use an SDK
  521. # than to fail.
  522. #
  523. # The major usecase for this is users using a Python.org
  524. # binary installer on OSX 10.6: that installer uses
  525. # the 10.4u SDK, but that SDK is not installed by default
  526. # when you install Xcode.
  527. #
  528. m = re.search('-isysroot\s+(\S+)', _config_vars['CFLAGS'])
  529. if m is not None:
  530. sdk = m.group(1)
  531. if not os.path.exists(sdk):
  532. for key in ('LDFLAGS', 'BASECFLAGS',
  533. # a number of derived variables. These need to be
  534. # patched up as well.
  535. 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
  536. flags = _config_vars[key]
  537. flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags)
  538. _config_vars[key] = flags
  539. if args:
  540. vals = []
  541. for name in args:
  542. vals.append(_config_vars.get(name))
  543. return vals
  544. else:
  545. return _config_vars
  546. def get_config_var(name):
  547. """Return the value of a single variable using the dictionary
  548. returned by 'get_config_vars()'. Equivalent to
  549. get_config_vars().get(name)
  550. """
  551. return get_config_vars().get(name)