当前位置: 首页>>代码示例>>Python>>正文


Python sysconfig._CONFIG_VARS属性代码示例

本文整理汇总了Python中sysconfig._CONFIG_VARS属性的典型用法代码示例。如果您正苦于以下问题:Python sysconfig._CONFIG_VARS属性的具体用法?Python sysconfig._CONFIG_VARS怎么用?Python sysconfig._CONFIG_VARS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在sysconfig的用法示例。


在下文中一共展示了sysconfig._CONFIG_VARS属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _CONFIG_VARS [as 别名]
def setUp(self):
        """Make a copy of sys.path"""
        super(TestSysConfig, self).setUp()
        self.sys_path = sys.path[:]
        self.makefile = None
        # patching os.uname
        if hasattr(os, 'uname'):
            self.uname = os.uname
            self._uname = os.uname()
        else:
            self.uname = None
            self._uname = None
        os.uname = self._get_uname
        # saving the environment
        self.name = os.name
        self.platform = sys.platform
        self.version = sys.version
        self.sep = os.sep
        self.join = os.path.join
        self.isabs = os.path.isabs
        self.splitdrive = os.path.splitdrive
        self._config_vars = copy(sysconfig._CONFIG_VARS)
        self.old_environ = deepcopy(os.environ) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:25,代码来源:test_sysconfig.py

示例2: test_getuserbase

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _CONFIG_VARS [as 别名]
def test_getuserbase(self):
        site.USER_BASE = None
        user_base = site.getuserbase()

        # the call sets site.USER_BASE
        self.assertEqual(site.USER_BASE, user_base)

        # let's set PYTHONUSERBASE and see if it uses it
        site.USER_BASE = None
        import sysconfig
        sysconfig._CONFIG_VARS = None

        with EnvironmentVarGuard() as environ:
            environ['PYTHONUSERBASE'] = 'xoxo'
            self.assertTrue(site.getuserbase().startswith('xoxo'),
                            site.getuserbase()) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:18,代码来源:test_site.py

示例3: tearDown

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _CONFIG_VARS [as 别名]
def tearDown(self):
        sys.path[:] = self.sys_path
        self._cleanup_testfn()
        if self.uname is not None:
            os.uname = self.uname
        else:
            del os.uname
        os.name = self.name
        sys.platform = self.platform
        sys.version = self.version
        os.sep = self.sep
        os.path.join = self.join
        os.path.isabs = self.isabs
        os.path.splitdrive = self.splitdrive
        sysconfig._CONFIG_VARS = self._config_vars[0]
        sysconfig._CONFIG_VARS.clear()
        sysconfig._CONFIG_VARS.update(self._config_vars[1])
        for var, value in self._changed_envvars:
            os.environ[var] = value
        for var in self._added_envvars:
            os.environ.pop(var, None)

        super(TestSysConfig, self).tearDown() 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:25,代码来源:test_sysconfig.py

示例4: setUp

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _CONFIG_VARS [as 别名]
def setUp(self):
        """Make a copy of sys.path"""
        super(TestSysConfig, self).setUp()
        self.sys_path = sys.path[:]
        self.makefile = None
        # patching os.uname
        if hasattr(os, 'uname'):
            self.uname = os.uname
            self._uname = os.uname()
        else:
            self.uname = None
            self._uname = None
        os.uname = self._get_uname
        # saving the environment
        self.name = os.name
        self.platform = sys.platform
        if not is_jython:
            self.version = sys.version
        self.sep = os.sep
        self.join = os.path.join
        self.isabs = os.path.isabs
        self.splitdrive = os.path.splitdrive
        self._config_vars = copy(sysconfig._CONFIG_VARS)
        self.old_environ = deepcopy(os.environ) 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:26,代码来源:test_sysconfig.py

示例5: get_sysconfig__CONFIG_VARS

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _CONFIG_VARS [as 别名]
def get_sysconfig__CONFIG_VARS(self):
        # make sure the dict is initialized
        sysconfig.get_config_var('prefix')
        return (id(sysconfig._CONFIG_VARS), sysconfig._CONFIG_VARS,
                dict(sysconfig._CONFIG_VARS)) 
开发者ID:war-and-code,项目名称:jawfish,代码行数:7,代码来源:regrtest.py

示例6: restore_sysconfig__CONFIG_VARS

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _CONFIG_VARS [as 别名]
def restore_sysconfig__CONFIG_VARS(self, saved):
        sysconfig._CONFIG_VARS = saved[1]
        sysconfig._CONFIG_VARS.clear()
        sysconfig._CONFIG_VARS.update(saved[2]) 
开发者ID:war-and-code,项目名称:jawfish,代码行数:6,代码来源:regrtest.py

示例7: test_version_int

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _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

示例8: tearDown

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _CONFIG_VARS [as 别名]
def tearDown(self):
        """Restore sys.path"""
        sys.path[:] = self.sys_path
        if self.makefile is not None:
            os.unlink(self.makefile)
        self._cleanup_testfn()
        if self.uname is not None:
            os.uname = self.uname
        else:
            del os.uname
        os.name = self.name
        sys.platform = self.platform
        sys.version = self.version
        os.sep = self.sep
        os.path.join = self.join
        os.path.isabs = self.isabs
        os.path.splitdrive = self.splitdrive
        sysconfig._CONFIG_VARS = copy(self._config_vars)
        for key, value in self.old_environ.items():
            if os.environ.get(key) != value:
                os.environ[key] = value

        for key in os.environ.keys():
            if key not in self.old_environ:
                del os.environ[key]

        super(TestSysConfig, self).tearDown() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:29,代码来源:test_sysconfig.py

示例9: setUp

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _CONFIG_VARS [as 别名]
def setUp(self):
        """Save a copy of sys.path"""
        self.sys_path = sys.path[:]
        self.old_base = site.USER_BASE
        self.old_site = site.USER_SITE
        self.old_prefixes = site.PREFIXES
        self.old_vars = copy(sysconfig._CONFIG_VARS) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:test_site.py

示例10: tearDown

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _CONFIG_VARS [as 别名]
def tearDown(self):
        """Restore sys.path"""
        sys.path[:] = self.sys_path
        site.USER_BASE = self.old_base
        site.USER_SITE = self.old_site
        site.PREFIXES = self.old_prefixes
        sysconfig._CONFIG_VARS = self.old_vars 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:test_site.py

示例11: test_no_home_directory

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _CONFIG_VARS [as 别名]
def test_no_home_directory(self):
        # bpo-10496: getuserbase() and getusersitepackages() must not fail if
        # the current user has no home directory (if expanduser() returns the
        # path unchanged).
        site.USER_SITE = None
        site.USER_BASE = None
        sysconfig._CONFIG_VARS = None

        with EnvironmentVarGuard() as environ, \
             support.swap_attr(os.path, 'expanduser', lambda path: path):

            del environ['PYTHONUSERBASE']
            del environ['APPDATA']

            user_base = site.getuserbase()
            self.assertTrue(user_base.startswith('~' + os.sep),
                            user_base)

            user_site = site.getusersitepackages()
            self.assertTrue(user_site.startswith(user_base), user_site)

        def fake_isdir(path):
            fake_isdir.arg = path
            return False
        fake_isdir.arg = None

        def must_not_be_called(*args):
            raise AssertionError

        with support.swap_attr(os.path, 'isdir', fake_isdir), \
             support.swap_attr(site, 'addsitedir', must_not_be_called), \
             support.swap_attr(site, 'ENABLE_USER_SITE', True):

            # addusersitepackages() must not add user_site to sys.path
            # if it is not an existing directory
            known_paths = set()
            site.addusersitepackages(known_paths)

            self.assertEqual(fake_isdir.arg, user_site)
            self.assertFalse(known_paths) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:42,代码来源:test_site.py

示例12: test_version_int

# 需要导入模块: import sysconfig [as 别名]
# 或者: from sysconfig import _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


注:本文中的sysconfig._CONFIG_VARS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。