本文整理汇总了Python中sysconfig.get_config_vars方法的典型用法代码示例。如果您正苦于以下问题:Python sysconfig.get_config_vars方法的具体用法?Python sysconfig.get_config_vars怎么用?Python sysconfig.get_config_vars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sysconfig
的用法示例。
在下文中一共展示了sysconfig.get_config_vars方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: expanduser
# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import get_config_vars [as 别名]
def expanduser(path):
"""
Expand ~ and ~user constructions.
Includes a workaround for http://bugs.python.org/issue14768
"""
expanded = os.path.expanduser(path)
if path.startswith('~/') and expanded.startswith('//'):
expanded = expanded[1:]
return expanded
# packages in the stdlib that may have installation metadata, but should not be
# considered 'installed'. this theoretically could be determined based on
# dist.location (py27:`sysconfig.get_paths()['stdlib']`,
# py26:sysconfig.get_config_vars('LIBDEST')), but fear platform variation may
# make this ineffective, so hard-coding
示例2: test_version_int
# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import get_config_vars [as 别名]
def test_version_int(self):
source = self.mkdtemp()
target = self.mkdtemp()
expected = self.write_sample_scripts(source)
cmd = self.get_build_scripts_cmd(target,
[os.path.join(source, fn)
for fn in expected])
cmd.finalize_options()
# http://bugs.python.org/issue4524
#
# On linux-g++-32 with command line `./configure --enable-ipv6
# --with-suffix=3`, python is compiled okay but the build scripts
# failed when writing the name of the executable
old = sysconfig.get_config_vars().get('VERSION')
sysconfig._CONFIG_VARS['VERSION'] = 4
try:
cmd.run()
finally:
if old is not None:
sysconfig._CONFIG_VARS['VERSION'] = old
built = os.listdir(target)
for name in expected:
self.assertIn(name, built)
示例3: python_is_optimized
# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import get_config_vars [as 别名]
def python_is_optimized():
cflags = sysconfig.get_config_vars()['PY_CFLAGS']
final_opt = ""
for opt in cflags.split():
if opt.startswith('-O'):
final_opt = opt
return final_opt not in ('', '-O0', '-Og')
示例4: python_is_optimized
# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import get_config_vars [as 别名]
def python_is_optimized():
cflags = sysconfig.get_config_vars()['PY_CFLAGS']
final_opt = ""
for opt in cflags.split():
if opt.startswith('-O'):
final_opt = opt
return (final_opt and final_opt != '-O0')
示例5: test_version_int
# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import get_config_vars [as 别名]
def test_version_int(self):
source = self.mkdtemp()
target = self.mkdtemp()
expected = self.write_sample_scripts(source)
cmd = self.get_build_scripts_cmd(target,
[os.path.join(source, fn)
for fn in expected])
cmd.finalize_options()
# http://bugs.python.org/issue4524
#
# On linux-g++-32 with command line `./configure --enable-ipv6
# --with-suffix=3`, python is compiled okay but the build scripts
# failed when writing the name of the executable
old = sysconfig.get_config_vars().get('VERSION')
sysconfig._CONFIG_VARS['VERSION'] = 4
try:
cmd.run()
finally:
if old is not None:
sysconfig._CONFIG_VARS['VERSION'] = old
built = os.listdir(target)
for name in expected:
self.assertTrue(name in built)
示例6: test_get_config_vars
# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import get_config_vars [as 别名]
def test_get_config_vars(self):
cvars = get_config_vars()
self.assertIsInstance(cvars, dict)
self.assertTrue(cvars)
示例7: test_SO_in_vars
# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import get_config_vars [as 别名]
def test_SO_in_vars(self):
vars = sysconfig.get_config_vars()
self.assertIsNotNone(vars['SO'])
self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
示例8: test_sysconfig
# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import get_config_vars [as 别名]
def test_sysconfig(self):
import distutils.sysconfig
import sysconfig
ldlibrary = "libpython{}.{}{}.so".format(*sys.version_info[:2], ABI_FLAGS)
self.assertEqual(ldlibrary, sysconfig.get_config_vars()["LDLIBRARY"])
self.assertEqual(ldlibrary, distutils.sysconfig.get_config_vars()["LDLIBRARY"])