本文整理汇总了Python中sysconfig.get_config_vars函数的典型用法代码示例。如果您正苦于以下问题:Python get_config_vars函数的具体用法?Python get_config_vars怎么用?Python get_config_vars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_config_vars函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: python_is_optimized
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')
开发者ID:49476291,项目名称:android-plus-plus,代码行数:7,代码来源:test_gdb.py
示例2: python_is_optimized
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")
开发者ID:cimarieta,项目名称:usp,代码行数:7,代码来源:test_gdb.py
示例3: get_tag
def get_tag(self):
supported_tags = pep425tags.get_supported()
purity = self.distribution.is_pure()
impl_ver = get_impl_ver()
abi_tag = 'none'
plat_name = 'any'
impl_name = 'py'
if purity:
wheel = self.distribution.get_option_dict('wheel')
if 'universal' in wheel:
# please don't define this in your global configs
val = wheel['universal'][1].strip()
if val.lower() in ('1', 'true', 'yes'):
impl_name = 'py2.py3'
impl_ver = ''
tag = (impl_name + impl_ver, abi_tag, plat_name)
else:
plat_name = self.plat_name
if plat_name is None:
plat_name = get_platform()
plat_name = plat_name.replace('-', '_').replace('.', '_')
impl_name = get_abbr_impl()
# PEP 3149 -- no SOABI in Py 2
# For PyPy?
# "pp%s%s" % (sys.pypy_version_info.major,
# sys.pypy_version_info.minor)
abi_tag = sysconfig.get_config_vars().get('SOABI', abi_tag)
if abi_tag.startswith('cpython-'):
abi_tag = 'cp' + abi_tag.rsplit('-', 1)[-1]
tag = (impl_name + impl_ver, abi_tag, plat_name)
# XXX switch to this alternate implementation for non-pure:
assert tag == supported_tags[0]
return tag
开发者ID:IsCoolEntertainment,项目名称:debpkg_python-wheel,代码行数:35,代码来源:bdist_wheel.py
示例4: test_version_int
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)
开发者ID:321boom,项目名称:The-Powder-Toy,代码行数:27,代码来源:test_build_scripts.py
示例5: get_tag
def get_tag(self):
supported_tags = pep425tags.get_supported()
if self.distribution.is_pure():
if self.universal:
impl = 'py2.py3'
else:
impl = self.python_tag
tag = (impl, 'none', 'any')
else:
plat_name = self.plat_name
if plat_name is None:
plat_name = get_platform()
plat_name = plat_name.replace('-', '_').replace('.', '_')
impl_name = get_abbr_impl()
impl_ver = get_impl_ver()
# PEP 3149 -- no SOABI in Py 2
# For PyPy?
# "pp%s%s" % (sys.pypy_version_info.major,
# sys.pypy_version_info.minor)
abi_tag = sysconfig.get_config_vars().get('SOABI', 'none')
if abi_tag.startswith('cpython-'):
abi_tag = 'cp' + abi_tag.rsplit('-', 1)[-1]
tag = (impl_name + impl_ver, abi_tag, plat_name)
# XXX switch to this alternate implementation for non-pure:
assert tag == supported_tags[0]
return tag
开发者ID:sherrycherish,项目名称:qiubai,代码行数:28,代码来源:bdist_wheel.py
示例6: test_main
def test_main():
cflags = sysconfig.get_config_vars()["PY_CFLAGS"]
final_opt = ""
for opt in cflags.split():
if opt.startswith("-O"):
final_opt = opt
if final_opt and final_opt != "-O0":
raise unittest.SkipTest("Python was built with compiler optimizations, " "tests can't reliably succeed")
run_unittest(PrettyPrintTests, PyListTests, StackNavigationTests, PyBtTests, PyPrintTests, PyLocalsTests)
开发者ID:idgy,项目名称:edk2,代码行数:10,代码来源:test_gdb.py
示例7: customize_compiler
def customize_compiler(compiler):
"""Do any platform-specific customization of a CCompiler instance.
Mainly needed on Unix, so we can plug in the information that
varies across Unices and is stored in Python's Makefile.
"""
if compiler.compiler_type == "unix":
(cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
'CCSHARED', 'LDSHARED', 'SO', 'AR',
'ARFLAGS')
if 'CC' in os.environ:
cc = os.environ['CC']
if 'CXX' in os.environ:
cxx = os.environ['CXX']
if 'LDSHARED' in os.environ:
ldshared = os.environ['LDSHARED']
if 'CPP' in os.environ:
cpp = os.environ['CPP']
else:
cpp = cc + " -E" # not always
if 'LDFLAGS' in os.environ:
ldshared = ldshared + ' ' + os.environ['LDFLAGS']
if 'CFLAGS' in os.environ:
cflags = opt + ' ' + os.environ['CFLAGS']
ldshared = ldshared + ' ' + os.environ['CFLAGS']
if 'CPPFLAGS' in os.environ:
cpp = cpp + ' ' + os.environ['CPPFLAGS']
cflags = cflags + ' ' + os.environ['CPPFLAGS']
ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
if 'AR' in os.environ:
ar = os.environ['AR']
if 'ARFLAGS' in os.environ:
archiver = ar + ' ' + os.environ['ARFLAGS']
else:
if ar_flags is not None:
archiver = ar + ' ' + ar_flags
else:
# see if its the proper default value
# mmm I don't want to backport the makefile
archiver = ar + ' rc'
cc_cmd = cc + ' ' + cflags
compiler.set_executables(
preprocessor=cpp,
compiler=cc_cmd,
compiler_so=cc_cmd + ' ' + ccshared,
compiler_cxx=cxx,
linker_so=ldshared,
linker_exe=cc,
archiver=archiver)
compiler.shared_lib_extension = so_ext
开发者ID:francescog,项目名称:distutils2,代码行数:54,代码来源:ccompiler.py
示例8: get_context
def get_context(self):
ret = {}
try:
ret['sysconfig'] = sysconfig.get_config_vars()
except:
pass
try:
ret['paths'] = sysconfig.get_paths()
except:
pass
return ret
开发者ID:Kewpie007,项目名称:clastic,代码行数:11,代码来源:meta.py
示例9: build_extensions
def build_extensions(self):
if sys.platform.startswith("linux"):
# Allow a custom C compiler through the environment variables. This
# allows Komodo to build using a gcc compiler that's not first on
# the path.
compiler = os.environ.get('CC')
if compiler is not None:
import sysconfig
(ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
args = {}
args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
self.compiler.set_executables(**args)
elif sys.platform == "darwin":
compiler = os.environ.get('CC')
if compiler is not None:
import sysconfig
(ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
args = {}
# clang does not support the '-std=gnu99' option - so remove it.
cflags = cflags.replace('-std=gnu99', '')
args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
self.compiler.set_executables(**args)
build_ext.build_extensions(self)
开发者ID:Acidburn0zzz,项目名称:KomodoEdit,代码行数:24,代码来源:setup.py
示例10: run
def run(args):
assert len(args) == 0
import_modules()
import time
t_start = time.time()
from libtbx import introspection
import os
import sysconfig
print "After script imports:"
print " wall clock time: %.2f" % (time.time() - t_start)
print
mb = 1024 * 1024
lib = os.path.join(
os.environ["LIBTBX_BUILD"], # intentionally not using libtbx.env for speed
"lib")
ext_so = []
for node in os.listdir(lib):
pylibext = sysconfig.get_config_vars("SO")[0]
if (node.endswith("_ext" + pylibext)):
ext_so.append(node.split(".")[0])
ext_so.sort(cmp_so)
print "Before importing extensions:"
vmi = introspection.virtual_memory_info()
vmi.show(prefix=" ")
prev_vms = vmi.get_bytes('VmSize:')
prev_rss = vmi.get_bytes('VmRSS:')
print " wall clock time: %.2f" % (time.time() - t_start)
print
for so in ext_so:
t0 = time.time()
exec("import %s" % so)
vmi = introspection.virtual_memory_info()
vms = vmi.get_bytes('VmSize:')
rss = vmi.get_bytes('VmRSS:')
if (vms is not None) : # won't work on Mac
print "%.2f %3.0f %3.0f %s" % (
time.time()-t0, (vms-prev_vms)/mb, (rss-prev_rss)/mb, so)
else :
assert (sys.platform in ["darwin", "win32"])
print "%.2f %s" % (time.time()-t0, so)
prev_vms = vms
prev_rss = rss
print
print "After importing all extensions:"
introspection.virtual_memory_info().show(prefix=" ")
print " wall clock time: %.2f" % (time.time() - t_start)
print
开发者ID:cctbx,项目名称:cctbx-playground,代码行数:47,代码来源:import_all_ext.py
示例11: find_boost_cflags
def find_boost_cflags():
# Get Boost dir (code copied from ufc/src/utils/python/ufc_utils/build.py)
# Set a default directory for the boost installation
if sys.platform == "darwin":
# Use Brew as default
default = os.path.join(os.path.sep, "usr", "local")
else:
default = os.path.join(os.path.sep, "usr")
# If BOOST_DIR is not set use default directory
boost_inc_dir = ""
boost_lib_dir = ""
boost_math_tr1_lib = "boost_math_tr1"
boost_dir = os.getenv("BOOST_DIR", default)
boost_is_found = False
for inc_dir in ["", "include"]:
if os.path.isfile(os.path.join(boost_dir, inc_dir, "boost",
"version.hpp")):
boost_inc_dir = os.path.join(boost_dir, inc_dir)
break
libdir_multiarch = "lib/" + sysconfig.get_config_vars().get("MULTIARCH", "")
for lib_dir in ["", "lib", libdir_multiarch, "lib64"]:
for ext in [".so", "-mt.so", ".dylib", "-mt.dylib"]:
_lib = os.path.join(boost_dir, lib_dir, "lib" + boost_math_tr1_lib
+ ext)
if os.path.isfile(_lib):
if "-mt" in _lib:
boost_math_tr1_lib += "-mt"
boost_lib_dir = os.path.join(boost_dir, lib_dir)
break
if boost_inc_dir != "" and boost_lib_dir != "":
boost_is_found = True
if boost_is_found:
boost_cflags = " -I%s -L%s" % (boost_inc_dir, boost_lib_dir)
boost_linkflags = "-l%s" % boost_math_tr1_lib
else:
boost_cflags = ""
boost_linkflags = ""
info_red("""The Boost library was not found.
If Boost is installed in a nonstandard location,
set the environment variable BOOST_DIR.
Forms using bessel functions will fail to build.
""")
return boost_cflags, boost_linkflags
开发者ID:FEniCS,项目名称:ffc,代码行数:45,代码来源:test.py
示例12: test_version_int
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()
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)
return
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:19,代码来源:test_build_scripts.py
示例13: get_python_dynlib
def get_python_dynlib():
"""
python -c "import utool; print(utool.get_python_dynlib())"
get_python_dynlib
Returns:
?: dynlib
Example:
>>> # DOCTEST_DISABLE
>>> from utool.util_cplat import * # NOQA
>>> dynlib = get_python_dynlib()
>>> print(dynlib)
/usr/lib/x86_64-linux-gnu/libpython2.7.so
"""
import sysconfig
cfgvars = sysconfig.get_config_vars()
dynlib = os.path.join(cfgvars['LIBDIR'], cfgvars['MULTIARCH'], cfgvars['LDLIBRARY'])
if not exists(dynlib):
dynlib = os.path.join(cfgvars['LIBDIR'], cfgvars['LDLIBRARY'])
assert exists(dynlib)
return dynlib
开发者ID:Erotemic,项目名称:utool,代码行数:23,代码来源:util_cplat.py
示例14: test_ext_fullpath
def test_ext_fullpath(self):
ext = sysconfig.get_config_vars()['SO']
# building lxml.etree inplace
#etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c')
#etree_ext = Extension('lxml.etree', [etree_c])
#dist = Distribution({'name': 'lxml', 'ext_modules': [etree_ext]})
dist = Distribution()
cmd = build_ext(dist)
cmd.inplace = True
cmd.distribution.package_dir = 'src'
cmd.distribution.packages = ['lxml', 'lxml.html']
curdir = os.getcwd()
wanted = os.path.join(curdir, 'src', 'lxml', 'etree' + ext)
path = cmd.get_ext_fullpath('lxml.etree')
self.assertEqual(wanted, path)
# building lxml.etree not inplace
cmd.inplace = False
cmd.build_lib = os.path.join(curdir, 'tmpdir')
wanted = os.path.join(curdir, 'tmpdir', 'lxml', 'etree' + ext)
path = cmd.get_ext_fullpath('lxml.etree')
self.assertEqual(wanted, path)
# building twisted.runner.portmap not inplace
build_py = cmd.get_finalized_command('build_py')
build_py.package_dir = None
cmd.distribution.packages = ['twisted', 'twisted.runner.portmap']
path = cmd.get_ext_fullpath('twisted.runner.portmap')
wanted = os.path.join(curdir, 'tmpdir', 'twisted', 'runner',
'portmap' + ext)
self.assertEqual(wanted, path)
# building twisted.runner.portmap inplace
cmd.inplace = True
path = cmd.get_ext_fullpath('twisted.runner.portmap')
wanted = os.path.join(curdir, 'twisted', 'runner', 'portmap' + ext)
self.assertEqual(wanted, path)
开发者ID:Naddiseo,项目名称:cpython,代码行数:37,代码来源:test_command_build_ext.py
示例15: hasattr
import unittest
from attic.helpers import st_mtime_ns
from attic.xattr import get_all
try:
import llfuse
# Does this version of llfuse support ns precision?
have_fuse_mtime_ns = hasattr(llfuse.EntryAttributes, 'st_mtime_ns')
except ImportError:
have_fuse_mtime_ns = False
# The mtime get/set precison varies on different OS and Python versions
if 'HAVE_FUTIMENS' in getattr(posix, '_have_functions', []):
st_mtime_ns_round = 0
elif 'HAVE_UTIMES' in sysconfig.get_config_vars():
st_mtime_ns_round = -6
else:
st_mtime_ns_round = -9
has_mtime_ns = sys.version >= '3.3'
utime_supports_fd = os.utime in getattr(os, 'supports_fd', {})
class AtticTestCase(unittest.TestCase):
"""
"""
assert_in = unittest.TestCase.assertIn
assert_not_in = unittest.TestCase.assertNotIn
assert_equal = unittest.TestCase.assertEqual
开发者ID:Ernest0x,项目名称:attic,代码行数:31,代码来源:__init__.py
示例16: len
# sysconfig_get_config_vars.py
import sysconfig
config_values = sysconfig.get_config_vars()
print('Trovate {} impostazioni di configurazione'.format(
len(config_values.keys())))
print('\nAlcune salienti:\n')
print(' Prefissi di installazione:')
print(' prefix={prefix}'.format(**config_values))
print(' exec_prefix={exec_prefix}'.format(**config_values))
print('\n Info di versione:')
print(' py_version={py_version}'.format(**config_values))
print(' py_version_short={py_version_short}'.format(
**config_values))
print(' py_version_nodot={py_version_nodot}'.format(
**config_values))
print('\n Directory base:')
print(' base={base}'.format(**config_values))
print(' platbase={platbase}'.format(**config_values))
print(' userbase={userbase}'.format(**config_values))
print(' srcdir={srcdir}'.format(**config_values))
print('\n Flag di Compilatore e linker:')
print(' LDFLAGS={LDFLAGS}'.format(**config_values))
print(' BASECFLAGS={BASECFLAGS}'.format(**config_values))
print(' Py_ENABLE_SHARED={Py_ENABLE_SHARED}'.format(
开发者ID:robertopauletto,项目名称:PyMOTW-it_3.0,代码行数:31,代码来源:sysconfig_get_config_vars.py
示例17: print
# sysconfig_get_config_vars_by_name.py
import sysconfig
bases = sysconfig.get_config_vars('base', 'platbase', 'userbase')
print('Directory base:')
for b in bases:
print(' ', b)
开发者ID:robertopauletto,项目名称:PyMOTW-it_3.0,代码行数:8,代码来源:sysconfig_get_config_vars_by_name.py
示例18: test_get_platform
def test_get_platform(self):
# windows XP, 32bits
os.name = 'nt'
sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) '
'[MSC v.1310 32 bit (Intel)]')
sys.platform = 'win32'
self.assertEqual(get_platform(), 'win32')
# windows XP, amd64
os.name = 'nt'
sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) '
'[MSC v.1310 32 bit (Amd64)]')
sys.platform = 'win32'
self.assertEqual(get_platform(), 'win-amd64')
# windows XP, itanium
os.name = 'nt'
sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) '
'[MSC v.1310 32 bit (Itanium)]')
sys.platform = 'win32'
self.assertEqual(get_platform(), 'win-ia64')
# macbook
os.name = 'posix'
sys.version = ('2.5 (r25:51918, Sep 19 2006, 08:49:13) '
'\n[GCC 4.0.1 (Apple Computer, Inc. build 5341)]')
sys.platform = 'darwin'
self._set_uname(('Darwin', 'macziade', '8.11.1',
('Darwin Kernel Version 8.11.1: '
'Wed Oct 10 18:23:28 PDT 2007; '
'root:xnu-792.25.20~1/RELEASE_I386'), 'PowerPC'))
get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.3'
get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g '
'-fwrapv -O3 -Wall -Wstrict-prototypes')
maxint = sys.maxint
try:
sys.maxint = 2147483647
self.assertEqual(get_platform(), 'macosx-10.3-ppc')
sys.maxint = 9223372036854775807
self.assertEqual(get_platform(), 'macosx-10.3-ppc64')
finally:
sys.maxint = maxint
self._set_uname(('Darwin', 'macziade', '8.11.1',
('Darwin Kernel Version 8.11.1: '
'Wed Oct 10 18:23:28 PDT 2007; '
'root:xnu-792.25.20~1/RELEASE_I386'), 'i386'))
get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.3'
get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g '
'-fwrapv -O3 -Wall -Wstrict-prototypes')
maxint = sys.maxint
try:
sys.maxint = 2147483647
self.assertEqual(get_platform(), 'macosx-10.3-i386')
sys.maxint = 9223372036854775807
self.assertEqual(get_platform(), 'macosx-10.3-x86_64')
finally:
sys.maxint = maxint
# macbook with fat binaries (fat, universal or fat64)
get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.4'
get_config_vars()['CFLAGS'] = ('-arch ppc -arch i386 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3')
self.assertEqual(get_platform(), 'macosx-10.4-fat')
get_config_vars()['CFLAGS'] = ('-arch x86_64 -arch i386 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3')
self.assertEqual(get_platform(), 'macosx-10.4-intel')
get_config_vars()['CFLAGS'] = ('-arch x86_64 -arch ppc -arch i386 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3')
self.assertEqual(get_platform(), 'macosx-10.4-fat3')
get_config_vars()['CFLAGS'] = ('-arch ppc64 -arch x86_64 -arch ppc -arch i386 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3')
self.assertEqual(get_platform(), 'macosx-10.4-universal')
get_config_vars()['CFLAGS'] = ('-arch x86_64 -arch ppc64 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3')
self.assertEqual(get_platform(), 'macosx-10.4-fat64')
for arch in ('ppc', 'i386', 'ppc64', 'x86_64'):
#.........这里部分代码省略.........
开发者ID:ArneBab,项目名称:pypyjs,代码行数:101,代码来源:test_sysconfig.py
示例19: Extension
suffix = sysconfig.get_config_var('EXT_SUFFIX')
if suffix is None:
suffix = ".so"
# Try to get git hash
try:
import subprocess
ghash = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii")
ghash_arg = "-DGITHASH="+ghash.strip()
except:
ghash_arg = "-DGITHASH=895c45a0ae3a8d0441688dbdd3201744614fffc3" #GITHASHAUTOUPDATE
extra_link_args=[]
if sys.platform == 'darwin':
from distutils import sysconfig
vars = sysconfig.get_config_vars()
vars['LDSHARED'] = vars['LDSHARED'].replace('-bundle', '-shared')
extra_link_args=['-Wl,-install_name,@rpath/librebound'+suffix]
libreboundmodule = Extension('librebound',
sources = [ 'src/rebound.c',
'src/integrator_ias15.c',
'src/integrator_whfast.c',
'src/integrator_hermes.c',
'src/integrator_mercurius.c',
'src/integrator_leapfrog.c',
'src/integrator_janus.c',
'src/integrator_sei.c',
'src/integrator.c',
'src/gravity.c',
'src/boundary.c',
开发者ID:afcarl,项目名称:rebound,代码行数:31,代码来源:setup.py
示例20: test_get_platform
def test_get_platform(self):
# windows XP, 32bits
os.name = "nt"
sys.version = "2.4.4 (#71, Oct 18 2006, 08:34:43) " "[MSC v.1310 32 bit (Intel)]"
sys.platform = "win32"
self.assertEqual(get_platform(), "win32")
# windows XP, amd64
os.name = "nt"
sys.version = "2.4.4 (#71, Oct 18 2006, 08:34:43) " "[MSC v.1310 32 bit (Amd64)]"
sys.platform = "win32"
self.assertEqual(get_platform(), "win-amd64")
# windows XP, itanium
os.name = "nt"
sys.version = "2.4.4 (#71, Oct 18 2006, 08:34:43) " "[MSC v.1310 32 bit (Itanium)]"
sys.platform = "win32"
self.assertEqual(get_platform(), "win-ia64")
# macbook
os.name = "posix"
sys.version = "2.5 (r25:51918, Sep 19 2006, 08:49:13) " "\n[GCC 4.0.1 (Apple Computer, Inc. build 5341)]"
sys.platform = "darwin"
self._set_uname(
(
"Darwin",
"macziade",
"8.11.1",
("Darwin Kernel Version 8.11.1: " "Wed Oct 10 18:23:28 PDT 2007; " "root:xnu-792.25.20~1/RELEASE_I386"),
"PowerPC",
)
)
_osx_support._remove_original_values(get_config_vars())
get_config_vars()["MACOSX_DEPLOYMENT_TARGET"] = "10.3"
get_config_vars()["CFLAGS"] = "-fno-strict-aliasing -DNDEBUG -g " "-fwrapv -O3 -Wall -Wstrict-prototypes"
maxint = sys.maxint
try:
sys.maxint = 2147483647
self.assertEqual(get_platform(), "macosx-10.3-ppc")
sys.maxint = 9223372036854775807
self.assertEqual(get_platform(), "macosx-10.3-ppc64")
finally:
sys.maxint = maxint
self._set_uname(
(
"Darwin",
"macziade",
"8.11.1",
("Darwin Kernel Version 8.11.1: " "Wed Oct 10 18:23:28 PDT 2007; " "root:xnu-792.25.20~1/RELEASE_I386"),
"i386",
)
)
_osx_support._remove_original_values(get_config_vars())
get_config_vars()["MACOSX_DEPLOYMENT_TARGET"] = "10.3"
get_config_vars()["CFLAGS"] = "-fno-strict-aliasing -DNDEBUG -g " "-fwrapv -O3 -Wall -Wstrict-prototypes"
maxint = sys.maxint
try:
sys.maxint = 2147483647
self.assertEqual(get_platform(), "macosx-10.3-i386")
sys.maxint = 9223372036854775807
self.assertEqual(get_platform(), "macosx-10.3-x86_64")
finally:
sys.maxint = maxint
# macbook with fat binaries (fat, universal or fat64)
_osx_support._remove_original_values(get_config_vars())
get_config_vars()["MACOSX_DEPLOYMENT_TARGET"] = "10.4"
get_config_vars()["CFLAGS"] = (
"-arch ppc -arch i386 -isysroot "
"/Developer/SDKs/MacOSX10.4u.sdk "
"-fno-strict-aliasing -fno-common "
"-dynamic -DNDEBUG -g -O3"
)
self.assertEqual(get_platform(), "macosx-10.4-fat")
_osx_support._remove_original_values(get_config_vars())
get_config_vars()["CFLAGS"] = (
"-arch x86_64 -arch i386 -isysroot "
"/Developer/SDKs/MacOSX10.4u.sdk "
"-fno-strict-aliasing -fno-common "
"-dynamic -DNDEBUG -g -O3"
)
self.assertEqual(get_platform(), "macosx-10.4-intel")
_osx_support._remove_original_values(get_config_vars())
get_config_vars()["CFLAGS"] = (
"-arch x86_64 -arch ppc -arch i386 -isysroot "
"/Developer/SDKs/MacOSX10.4u.sdk "
"-fno-strict-aliasing -fno-common "
"-dynamic -DNDEBUG -g -O3"
)
self.assertEqual(get_platform(), "macosx-10.4-fat3")
#.........这里部分代码省略.........
开发者ID:jythontools,项目名称:jython,代码行数:101,代码来源:test_sysconfig.py
注:本文中的sysconfig.get_config_vars函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论