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


Python py31compat.TemporaryDirectory方法代码示例

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


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

示例1: get_svn_version

# 需要导入模块: from setuptools import py31compat [as 别名]
# 或者: from setuptools.py31compat import TemporaryDirectory [as 别名]
def get_svn_version():
        # Temp config directory should be enough to check for repository
        # This is needed because .svn always creates .subversion and 
        # some operating systems do not handle dot directory correctly.
        # Real queries in real svn repos with be concerned with it creation
        with TemporaryDirectory() as tempdir:
            code, data = _run_command(['svn', 
                                       '--config-dir', tempdir,
                                       '--version', 
                                       '--quiet'])

        if code == 0 and data:
            return data.strip()
        else:
            return ''

    #svnversion return values (previous implementations return max revision)
    #   4123:4168     mixed revision working copy
    #   4168M         modified working copy
    #   4123S         switched working copy
    #   4123:4168MS   mixed revision, modified, switched working copy 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:23,代码来源:svn_utils.py

示例2: _build_with_temp_dir

# 需要导入模块: from setuptools import py31compat [as 别名]
# 或者: from setuptools.py31compat import TemporaryDirectory [as 别名]
def _build_with_temp_dir(self, setup_command, result_extension,
                             result_directory, config_settings):
        config_settings = self._fix_config(config_settings)
        result_directory = os.path.abspath(result_directory)

        # Build in a temporary directory, then copy to the target.
        makedirs(result_directory, exist_ok=True)
        with TemporaryDirectory(dir=result_directory) as tmp_dist_dir:
            sys.argv = (sys.argv[:1] + setup_command +
                        ['--dist-dir', tmp_dist_dir] +
                        config_settings["--global-option"])
            self.run_setup()

            result_basename = _file_with_extension(tmp_dist_dir, result_extension)
            result_path = os.path.join(result_directory, result_basename)
            if os.path.exists(result_path):
                # os.rename will fail overwriting on non-Unix.
                os.remove(result_path)
            os.rename(os.path.join(tmp_dist_dir, result_basename), result_path)

        return result_basename 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:23,代码来源:build_meta.py

示例3: get_svn_version

# 需要导入模块: from setuptools import py31compat [as 别名]
# 或者: from setuptools.py31compat import TemporaryDirectory [as 别名]
def get_svn_version():
        # Temp config directory should be enough to check for repository
        # This is needed because .svn always creates .subversion and
        # some operating systems do not handle dot directory correctly.
        # Real queries in real svn repos with be concerned with it creation
        with TemporaryDirectory() as tempdir:
            code, data = _run_command(['svn',
                                       '--config-dir', tempdir,
                                       '--version',
                                       '--quiet'])

        if code == 0 and data:
            return data.strip()
        else:
            return ''

    #svnversion return values (previous implementations return max revision)
    #   4123:4168     mixed revision working copy
    #   4168M         modified working copy
    #   4123S         switched working copy
    #   4123:4168MS   mixed revision, modified, switched working copy 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:23,代码来源:svn_utils.py

示例4: build_wheel

# 需要导入模块: from setuptools import py31compat [as 别名]
# 或者: from setuptools.py31compat import TemporaryDirectory [as 别名]
def build_wheel(self, wheel_directory, config_settings=None,
                    metadata_directory=None):
        config_settings = self._fix_config(config_settings)
        wheel_directory = os.path.abspath(wheel_directory)

        # Build the wheel in a temporary directory, then copy to the target
        with TemporaryDirectory(dir=wheel_directory) as tmp_dist_dir:
            sys.argv = (sys.argv[:1] +
                        ['bdist_wheel', '--dist-dir', tmp_dist_dir] +
                        config_settings["--global-option"])
            self.run_setup()

            wheel_basename = _file_with_extension(tmp_dist_dir, '.whl')
            wheel_path = os.path.join(wheel_directory, wheel_basename)
            if os.path.exists(wheel_path):
                # os.rename will fail overwriting on non-unix env
                os.remove(wheel_path)
            os.rename(os.path.join(tmp_dist_dir, wheel_basename), wheel_path)

        return wheel_basename 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:22,代码来源:build_meta.py

示例5: test_http_upload

# 需要导入模块: from setuptools import py31compat [as 别名]
# 或者: from setuptools.py31compat import TemporaryDirectory [as 别名]
def test_http_upload(self, client):
        """
        :type client: django.test.Client
        """

        with TemporaryDirectory() as tmpdir:
            for filename in [self.TEST_FILE_NAME, self.TEST_FILE_NAME_UNICODE]:
                with open(os.path.join(tmpdir, filename), 'w+b') as testfile:
                    testfile.write(self.TEST_FILE_CONTENT)
                    testfile.seek(0)

                    r = client.post('/upload', {'file': testfile})

                    assert 302 == r.status_code

        assert ModelWithFileField.objects.count() == 2 
开发者ID:Strayer,项目名称:django-gcloud-storage,代码行数:18,代码来源:test_django.py

示例6: _build_with_temp_dir

# 需要导入模块: from setuptools import py31compat [as 别名]
# 或者: from setuptools.py31compat import TemporaryDirectory [as 别名]
def _build_with_temp_dir(self, setup_command, result_extension,
                             result_directory, config_settings):
        config_settings = self._fix_config(config_settings)
        result_directory = os.path.abspath(result_directory)

        # Build in a temporary directory, then copy to the target.
        os.makedirs(result_directory, exist_ok=True)
        with TemporaryDirectory(dir=result_directory) as tmp_dist_dir:
            sys.argv = (sys.argv[:1] + setup_command +
                        ['--dist-dir', tmp_dist_dir] +
                        config_settings["--global-option"])
            self.run_setup()

            result_basename = _file_with_extension(
                tmp_dist_dir, result_extension)
            result_path = os.path.join(result_directory, result_basename)
            if os.path.exists(result_path):
                # os.rename will fail overwriting on non-Unix.
                os.remove(result_path)
            os.rename(os.path.join(tmp_dist_dir, result_basename), result_path)

        return result_basename 
开发者ID:pypa,项目名称:setuptools,代码行数:24,代码来源:build_meta.py

示例7: load

# 需要导入模块: from setuptools import py31compat [as 别名]
# 或者: from setuptools.py31compat import TemporaryDirectory [as 别名]
def load(cls, dirname=''):
        normdir = os.path.normpath(dirname)

        # Temp config directory should be enough to check for repository
        # This is needed because .svn always creates .subversion and 
        # some operating systems do not handle dot directory correctly.
        # Real queries in real svn repos with be concerned with it creation
        with TemporaryDirectory() as tempdir:
            code, data = _run_command(['svn', 
                                       '--config-dir', tempdir,
                                       'info', normdir])

        # Must check for some contents, as some use empty directories
        # in testcases, however only enteries is needed also the info
        # command above MUST have worked
        svn_dir = os.path.join(normdir, '.svn')
        is_svn_wd = (not code or
                     os.path.isfile(os.path.join(svn_dir, 'entries')))

        svn_version = tuple(cls.get_svn_version().split('.'))

        try:
            base_svn_version = tuple(int(x) for x in svn_version[:2])
        except ValueError:
            base_svn_version = tuple()

        if not is_svn_wd:
            #return an instance of this NO-OP class
            return SvnInfo(dirname)

        if code or not base_svn_version or base_svn_version < (1, 3):
            warnings.warn(("No SVN 1.3+ command found: falling back "
                           "on pre 1.7 .svn parsing"), DeprecationWarning)
            return SvnFileInfo(dirname)

        if base_svn_version < (1, 5):
            return Svn13Info(dirname)

        return Svn15Info(dirname) 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:41,代码来源:svn_utils.py

示例8: load

# 需要导入模块: from setuptools import py31compat [as 别名]
# 或者: from setuptools.py31compat import TemporaryDirectory [as 别名]
def load(cls, dirname=''):
        normdir = os.path.normpath(dirname)

        # Temp config directory should be enough to check for repository
        # This is needed because .svn always creates .subversion and
        # some operating systems do not handle dot directory correctly.
        # Real queries in real svn repos with be concerned with it creation
        with TemporaryDirectory() as tempdir:
            code, data = _run_command(['svn',
                                       '--config-dir', tempdir,
                                       'info', normdir])

        # Must check for some contents, as some use empty directories
        # in testcases, however only enteries is needed also the info
        # command above MUST have worked
        svn_dir = os.path.join(normdir, '.svn')
        is_svn_wd = (not code or
                     os.path.isfile(os.path.join(svn_dir, 'entries')))

        svn_version = tuple(cls.get_svn_version().split('.'))

        try:
            base_svn_version = tuple(int(x) for x in svn_version[:2])
        except ValueError:
            base_svn_version = tuple()

        if not is_svn_wd:
            #return an instance of this NO-OP class
            return SvnInfo(dirname)

        if code or not base_svn_version or base_svn_version < (1, 3):
            warnings.warn(("No SVN 1.3+ command found: falling back "
                           "on pre 1.7 .svn parsing"), DeprecationWarning)
            return SvnFileInfo(dirname)

        if base_svn_version < (1, 5):
            return Svn13Info(dirname)

        return Svn15Info(dirname) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:41,代码来源:svn_utils.py


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