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


Python utils.system函数代码示例

本文整理汇总了Python中zest.releaser.utils.system函数的典型用法代码示例。如果您正苦于以下问题:Python system函数的具体用法?Python system怎么用?Python system使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_setup_py_name

 def get_setup_py_name(self):
     if os.path.exists('setup.py'):
         # First run egg_info, as that may get rid of some warnings
         # that otherwise end up in the extracted name, like
         # UserWarnings.
         system(utils.setup_py('egg_info'))
         return system(utils.setup_py('--name')).strip()
开发者ID:tomgross,项目名称:zest.releaser,代码行数:7,代码来源:vcs.py

示例2: _tags_name

    def _tags_name(self):
        """Return name for tags dir

        Normally the plural /tags, but some projects have the singular /tag.

        """
        default_plural = 'tags'
        fallback_singular = 'tag'
        # svn 1.7 introduced a slightly different message and a warning code.
        failure_messages = ["non-existent in that revision", "W160013"]
        base = self._base_from_svn()
        tag_info = system('svn list %s%s' % (base, default_plural))
        # Look for one of the failure messages:
        found = [1 for mess in failure_messages if mess in tag_info]
        if not found:
            return default_plural
        logger.debug("tags dir does not exist at %s%s", base, default_plural)

        tag_info = system('svn list %s%s' % (base, fallback_singular))
        # Look for one of the failure messages:
        found = [1 for mess in failure_messages if mess in tag_info]
        if not found:
            return fallback_singular
        logger.debug("tags dir does not exist at %s%s, either", base,
                     fallback_singular)
        return None
开发者ID:AlexisHuet,项目名称:zest.releaser,代码行数:26,代码来源:svn.py

示例3: version_control

def version_control():
    """Return an object that provides the version control interface based
    on the detected version control system."""
    curdir_contents = os.listdir('.')
    if '.svn' in curdir_contents:
        return svn.Subversion()
    elif '.hg' in curdir_contents:
        return hg.Hg()
    elif '.bzr' in curdir_contents:
        return bzr.Bzr()
    elif '.git' in curdir_contents:
        return git.Git()
    else:
        # Try finding an svn checkout *not* in the root.
        last_try = utils.system("svn info")
        if 'Repository' in last_try:
            return svn.Subversion()
        # true means that we are in the work tree, false that we are in the
        # .git tree. If we are not in a git repository, the answer will looks
        # like 'Not a git repository' or even 'git: not found'
        last_try = utils.system("git  rev-parse --is-inside-work-tree")
        if last_try == 'true\n':
            return git.Git()
        logger.critical('No version control system detected.')
        sys.exit(1)
开发者ID:pduval,项目名称:zest.releaser,代码行数:25,代码来源:choose.py

示例4: checkout_from_tag

 def checkout_from_tag(self, version):
     package = self.name
     prefix = '%s-%s-' % (package, version)
     tagdir = self.prepare_checkout_dir(prefix)
     os.chdir(tagdir)
     cmd = self.cmd_checkout_from_tag(version, tagdir)
     print system(cmd)
开发者ID:tomgross,项目名称:zest.releaser,代码行数:7,代码来源:vcs.py

示例5: available_tags

    def available_tags(self):
        base = self._base_from_svn()
        tags_name = self._tags_name
        if tags_name is None:
            # Suggest to create a tags dir with the default plural /tags name.
            print "tags dir does not exist at %s" % base + 'tags'
            if utils.ask("Shall I create it"):
                cmd = 'svn mkdir %stags -m "Creating tags directory."' % (base)
                logger.info("Running %r", cmd)
                print system(cmd)
                tags_name = self._tags_name
                assert tags_name == 'tags'
            else:
                sys.exit(0)

        tag_info = system('svn list %s%s' % (base, tags_name))
        if 'Could not resolve hostname' in tag_info or \
                'Repository moved' in tag_info:
            logger.error('Network problem: %s', tag_info)
            sys.exit()
        tags = [line.replace('/', '').strip()
                for line in tag_info.split('\n')]
        tags = [tag for tag in tags if tag]  # filter empty ones
        logger.debug("Available tags: %r", tags)
        return tags
开发者ID:AlexisHuet,项目名称:zest.releaser,代码行数:25,代码来源:svn.py

示例6: _upload_distributions

    def _upload_distributions(self, package, sdist_options, pypiconfig):
        # See if creating an egg actually works.
        logger.info("Making an egg of a fresh tag checkout.")
        print system(utils.setup_py('sdist ' + sdist_options))

        # First ask if we want to upload to pypi, which should always
        # work, also without collective.dist.
        use_pypi = package_in_pypi(package)
        if use_pypi:
            logger.info("This package is registered on PyPI.")
        else:
            logger.warn("This package is NOT registered on PyPI.")
        if pypiconfig.is_old_pypi_config():
            pypi_command = 'register sdist %s upload' % sdist_options
            shell_command = utils.setup_py(pypi_command)
            if use_pypi:
                default = True
                exact = False
            else:
                # We are not yet on pypi.  To avoid an 'Oops...,
                # sorry!' when registering and uploading an internal
                # package we default to False here.
                default = False
                exact = True
            if utils.ask("Register and upload to PyPI", default=default,
                         exact=exact):
                logger.info("Running: %s", shell_command)
                result = system(shell_command)
                utils.show_first_and_last_lines(result)

        # If collective.dist is installed (or we are using
        # python2.6 or higher), the user may have defined
        # other servers to upload to.
        for server in pypiconfig.distutils_servers():
            if pypi.new_distutils_available():
                commands = ('register', '-r', server, 'sdist',
                            sdist_options, 'upload', '-r', server)
            else:
                ## This would be logical, given the lines above:
                #commands = ('mregister', '-r', server, 'sdist',
                #            sdist_options, 'mupload', '-r', server)
                ## But according to the collective.dist documentation
                ## it should be this (with just one '-r'):
                commands = ('mregister', 'sdist',
                            sdist_options, 'mupload', '-r', server)
            shell_command = utils.setup_py(' '.join(commands))
            default = True
            exact = False
            if server == 'pypi' and not use_pypi:
                # We are not yet on pypi.  To avoid an 'Oops...,
                # sorry!' when registering and uploading an internal
                # package we default to False here.
                default = False
                exact = True
            if utils.ask("Register and upload to %s" % server,
                         default=default, exact=exact):
                logger.info("Running: %s", shell_command)
                result = system(shell_command)
                utils.show_first_and_last_lines(result)
开发者ID:Vinsurya,项目名称:Plone,代码行数:59,代码来源:release.py

示例7: get_setup_py_version

 def get_setup_py_version(self):
     if os.path.exists('setup.py'):
         # First run egg_info, as that may get rid of some warnings
         # that otherwise end up in the extracted version, like
         # UserWarnings.
         system(utils.setup_py('egg_info'))
         version = system(utils.setup_py('--version'))
         return utils.strip_version(version)
开发者ID:tomgross,项目名称:zest.releaser,代码行数:8,代码来源:vcs.py

示例8: checkout_from_tag

 def checkout_from_tag(self, version):
     package = self.name
     prefix = '%s-%s-' % (package, version)
     # Not all hg versions can do a checkout in an existing or even
     # just in the current directory.
     tagdir = tempfile.mktemp(prefix=prefix)
     cmd = self.cmd_checkout_from_tag(version, tagdir)
     print system(cmd)
     os.chdir(tagdir)
开发者ID:AlexisHuet,项目名称:zest.releaser,代码行数:9,代码来源:hg.py

示例9: _check_if_tag_already_exists

 def _check_if_tag_already_exists(self):
     """Check if tag already exists and show the difference if so"""
     version = self.data['version']
     if self.vcs.tag_exists(version):
         self.data['tag_already_exists'] = True
         q = ("There is already a tag %s, show "
              "if there are differences?" % version)
         if utils.ask(q):
             diff_command = self.vcs.cmd_diff_last_commit_against_tag(
                 version)
             print diff_command
             print system(diff_command)
     else:
         self.data['tag_already_exists'] = False
开发者ID:Vinsurya,项目名称:Plone,代码行数:14,代码来源:release.py

示例10: is_clean_checkout

 def is_clean_checkout(self):
     """Is this a clean checkout?
     """
     head = system('git symbolic-ref --quiet HEAD')
     # This returns something like 'refs/heads/maurits-warn-on-tag'
     # or nothing.  Nothing would be bad as that indicates a
     # detached head: likely a tag checkout
     if not head:
         # Greetings from Nearly Headless Nick.
         return False
     if system('git status --short --untracked-files=no'):
         # Uncommitted changes in files that are tracked.
         return False
     return True
开发者ID:do3cc,项目名称:zest.releaser,代码行数:14,代码来源:git.py

示例11: prepare_checkout_dir

 def prepare_checkout_dir(self, prefix):
     # Watch out: some git versions can't clone into an existing
     # directory, even when it is empty.
     temp = tempfile.mkdtemp(prefix=prefix)
     cwd = os.getcwd()
     os.chdir(temp)
     cmd = 'git clone %s %s' % (self.workingdir, 'gitclone')
     logger.debug(system(cmd))
     clonedir = os.path.join(temp, 'gitclone')
     os.chdir(clonedir)
     cmd = 'git submodule update --init --recursive'
     logger.debug(system(cmd))
     os.chdir(cwd)
     return clonedir
开发者ID:dnozay,项目名称:zest.releaser,代码行数:14,代码来源:git.py

示例12: get_setup_py_version

 def get_setup_py_version(self):
     if os.path.exists('setup.py'):
         # First run egg_info, as that may get rid of some warnings
         # that otherwise end up in the extracted version, like
         # UserWarnings.
         system(utils.setup_py('egg_info'))
         version = system(utils.setup_py('--version')).splitlines()[0]
         if version.startswith('Traceback'):
             # Likely cause is for example forgetting to 'import
             # os' when using 'os' in setup.py.
             logger.critical('The setup.py of this package has an error:')
             print version
             logger.critical('No version found.')
             sys.exit(1)
         return utils.strip_version(version)
开发者ID:mgedmin,项目名称:zest.releaser,代码行数:15,代码来源:vcs.py

示例13: get_setup_py_version

 def get_setup_py_version(self):
     if os.path.exists("setup.py"):
         # First run egg_info, as that may get rid of some warnings
         # that otherwise end up in the extracted version, like
         # UserWarnings.
         system(utils.setup_py("egg_info"))
         version = system(utils.setup_py("--version"))
         if version.startswith("Traceback"):
             # Likely cause is for example forgetting to 'import
             # os' when using 'os' in setup.py.
             logger.critical("The setup.py of this package has an error:")
             print version
             logger.critical("No version found.")
             sys.exit(1)
         return utils.strip_version(version)
开发者ID:keul,项目名称:zest.releaser,代码行数:15,代码来源:vcs.py

示例14: available_tags

 def available_tags(self):
     tag_info = system('hg tags')
     tags = [line[:line.find(' ')] for line in tag_info.split('\n')]
     tags = [tag for tag in tags if tag]
     tags.remove('tip')  # Not functional for us
     logger.debug("Available tags: %r", tags)
     return tags
开发者ID:AlexisHuet,项目名称:zest.releaser,代码行数:7,代码来源:hg.py

示例15: _diff_and_commit

 def _diff_and_commit(self):
     diff_cmd = self.vcs.cmd_diff()
     diff = system(diff_cmd)
     if sys.version.startswith('2.6.2'):
         # python2.6.2 bug... http://bugs.python.org/issue5170 This is the
         # spot it can surface as we show a part of the changelog which can
         # contain every kind of character.  The rest is mostly ascii.
         print "Diff results:"
         print diff
     else:
         # Common case
         logger.info("The '%s':\n\n%s\n" % (diff_cmd, diff))
     if utils.ask("OK to commit this"):
         msg = self.data['commit_msg'] % self.data
         commit_cmd = self.vcs.cmd_commit(msg)
         commit = system(commit_cmd)
         logger.info(commit)
开发者ID:j-san,项目名称:zest.releaser,代码行数:17,代码来源:prerelease.py


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