當前位置: 首頁>>代碼示例>>Python>>正文


Python sysconfig.get_config_vars方法代碼示例

本文整理匯總了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 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:19,代碼來源:__init__.py

示例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) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:29,代碼來源:test_build_scripts.py

示例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') 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:9,代碼來源:test_gdb.py

示例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') 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:9,代碼來源:test_gdb.py

示例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) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:29,代碼來源:test_build_scripts.py

示例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) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:6,代碼來源:test_sysconfig.py

示例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']) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:6,代碼來源:test_sysconfig.py

示例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"]) 
開發者ID:chaquo,項目名稱:chaquopy,代碼行數:8,代碼來源:test_android.py


注:本文中的sysconfig.get_config_vars方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。