本文整理汇总了Python中distutils.sysconfig.parse_makefile方法的典型用法代码示例。如果您正苦于以下问题:Python sysconfig.parse_makefile方法的具体用法?Python sysconfig.parse_makefile怎么用?Python sysconfig.parse_makefile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.sysconfig
的用法示例。
在下文中一共展示了sysconfig.parse_makefile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _extras_paths
# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import parse_makefile [as 别名]
def _extras_paths(cls):
standard_lib = sysconfig.get_python_lib(standard_lib=True)
try:
makefile = sysconfig.parse_makefile(sysconfig.get_makefile_filename())
except (AttributeError, IOError):
# This is not available by default in PyPy's distutils.sysconfig or it simply is
# no longer available on the system (IOError ENOENT)
makefile = {}
extras_paths = filter(None, makefile.get('EXTRASPATH', '').split(':'))
for path in extras_paths:
yield os.path.join(standard_lib, path)
# Handle .pth injected paths as extras.
sitedirs = cls._get_site_packages()
for pth_path in cls._scan_pth_files(sitedirs):
TRACER.log('Found .pth file: %s' % pth_path, V=3)
for extras_path in iter_pth_paths(pth_path):
yield extras_path
示例2: test_parse_makefile_base
# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import parse_makefile [as 别名]
def test_parse_makefile_base(self):
self.makefile = test.test_support.TESTFN
fd = open(self.makefile, 'w')
try:
fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'" '\n')
fd.write('VAR=$OTHER\nOTHER=foo')
finally:
fd.close()
d = sysconfig.parse_makefile(self.makefile)
self.assertEqual(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'",
'OTHER': 'foo'})
示例3: test_parse_makefile_literal_dollar
# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import parse_makefile [as 别名]
def test_parse_makefile_literal_dollar(self):
self.makefile = test.test_support.TESTFN
fd = open(self.makefile, 'w')
try:
fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n')
fd.write('VAR=$OTHER\nOTHER=foo')
finally:
fd.close()
d = sysconfig.parse_makefile(self.makefile)
self.assertEqual(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'",
'OTHER': 'foo'})
示例4: get_flags_linker_so
# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import parse_makefile [as 别名]
def get_flags_linker_so(self):
opt = self.linker_so[1:]
if sys.platform == 'darwin':
target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None)
# If MACOSX_DEPLOYMENT_TARGET is set, we simply trust the value
# and leave it alone. But, distutils will complain if the
# environment's value is different from the one in the Python
# Makefile used to build Python. We let disutils handle this
# error checking.
if not target:
# If MACOSX_DEPLOYMENT_TARGET is not set in the environment,
# we try to get it first from the Python Makefile and then we
# fall back to setting it to 10.3 to maximize the set of
# versions we can work with. This is a reasonable default
# even when using the official Python dist and those derived
# from it.
import distutils.sysconfig as sc
g = {}
filename = sc.get_makefile_filename()
sc.parse_makefile(filename, g)
target = g.get('MACOSX_DEPLOYMENT_TARGET', '10.3')
os.environ['MACOSX_DEPLOYMENT_TARGET'] = target
if target == '10.3':
s = 'Env. variable MACOSX_DEPLOYMENT_TARGET set to 10.3'
warnings.warn(s)
opt.extend(['-undefined', 'dynamic_lookup', '-bundle'])
else:
opt.append("-shared")
if sys.platform.startswith('sunos'):
# SunOS often has dynamically loaded symbols defined in the
# static library libg2c.a The linker doesn't like this. To
# ignore the problem, use the -mimpure-text flag. It isn't
# the safest thing, but seems to work. 'man gcc' says:
# ".. Instead of using -mimpure-text, you should compile all
# source code with -fpic or -fPIC."
opt.append('-mimpure-text')
return opt
示例5: get_flags_linker_so
# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import parse_makefile [as 别名]
def get_flags_linker_so(self):
opt = self.linker_so[1:]
if sys.platform=='darwin':
target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None)
# If MACOSX_DEPLOYMENT_TARGET is set, we simply trust the value
# and leave it alone. But, distutils will complain if the
# environment's value is different from the one in the Python
# Makefile used to build Python. We let disutils handle this
# error checking.
if not target:
# If MACOSX_DEPLOYMENT_TARGET is not set in the environment,
# we try to get it first from the Python Makefile and then we
# fall back to setting it to 10.3 to maximize the set of
# versions we can work with. This is a reasonable default
# even when using the official Python dist and those derived
# from it.
import distutils.sysconfig as sc
g = {}
filename = sc.get_makefile_filename()
sc.parse_makefile(filename, g)
target = g.get('MACOSX_DEPLOYMENT_TARGET', '10.3')
os.environ['MACOSX_DEPLOYMENT_TARGET'] = target
if target == '10.3':
s = 'Env. variable MACOSX_DEPLOYMENT_TARGET set to 10.3'
warnings.warn(s)
opt.extend(['-undefined', 'dynamic_lookup', '-bundle'])
else:
opt.append("-shared")
if sys.platform.startswith('sunos'):
# SunOS often has dynamically loaded symbols defined in the
# static library libg2c.a The linker doesn't like this. To
# ignore the problem, use the -mimpure-text flag. It isn't
# the safest thing, but seems to work. 'man gcc' says:
# ".. Instead of using -mimpure-text, you should compile all
# source code with -fpic or -fPIC."
opt.append('-mimpure-text')
return opt
示例6: test_parse_makefile_base
# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import parse_makefile [as 别名]
def test_parse_makefile_base(self):
self.makefile = TESTFN
fd = open(self.makefile, 'w')
try:
fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'" '\n')
fd.write('VAR=$OTHER\nOTHER=foo')
finally:
fd.close()
d = sysconfig.parse_makefile(self.makefile)
self.assertEqual(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'",
'OTHER': 'foo'})
示例7: test_parse_makefile_literal_dollar
# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import parse_makefile [as 别名]
def test_parse_makefile_literal_dollar(self):
self.makefile = TESTFN
fd = open(self.makefile, 'w')
try:
fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n')
fd.write('VAR=$OTHER\nOTHER=foo')
finally:
fd.close()
d = sysconfig.parse_makefile(self.makefile)
self.assertEqual(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'",
'OTHER': 'foo'})