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


Python util.call_subprocess方法代码示例

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


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

示例1: switch

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def switch(self, dest, url, rev_options):
        repo_config = os.path.join(dest, self.dirname, 'hgrc')
        config = ConfigParser.SafeConfigParser()
        try:
            config.read(repo_config)
            config.set('paths', 'default', url)
            config_file = open(repo_config, 'w')
            config.write(config_file)
            config_file.close()
        except (OSError, ConfigParser.NoSectionError):
            e = sys.exc_info()[1]
            logger.warn(
                'Could not switch Mercurial repository to %s: %s'
                % (url, e))
        else:
            call_subprocess([self.cmd, 'update', '-q'] + rev_options, cwd=dest) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:18,代码来源:mercurial.py

示例2: obtain

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def obtain(self, dest):
        url, rev = self.get_url_rev()
        if rev:
            rev_options = [rev]
            rev_display = ' (to %s)' % rev
        else:
            rev_options = ['origin/master']
            rev_display = ''
        if self.check_destination(dest, url, rev_options, rev_display):
            logger.notify('Cloning %s%s to %s' % (url, rev_display, display_path(dest)))
            call_subprocess([self.cmd, 'clone', '-q', url, dest])
            #: repo may contain submodules
            self.update_submodules(dest)
            if rev:
                rev_options = self.check_rev_options(rev, dest, rev_options)
                # Only do a checkout if rev_options differs from HEAD
                if not self.get_revision(dest).startswith(rev_options[0]):
                    call_subprocess([self.cmd, 'checkout', '-q'] + rev_options, cwd=dest) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:20,代码来源:git.py

示例3: get_refs

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def get_refs(self, location):
        """Return map of named refs (branches or tags) to commit hashes."""
        output = call_subprocess([self.cmd, 'show-ref'],
                                 show_stdout=False, cwd=location)
        rv = {}
        for line in output.strip().splitlines():
            commit, ref = line.split(' ', 1)
            ref = ref.strip()
            ref_name = None
            if ref.startswith('refs/remotes/'):
                ref_name = ref[len('refs/remotes/'):]
            elif ref.startswith('refs/heads/'):
                ref_name = ref[len('refs/heads/'):]
            elif ref.startswith('refs/tags/'):
                ref_name = ref[len('refs/tags/'):]
            if ref_name is not None:
                rv[ref_name] = commit.strip()
        return rv 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:20,代码来源:git.py

示例4: get_info

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def get_info(self, location):
        """Returns (url, revision), where both are strings"""
        assert not location.rstrip('/').endswith(self.dirname), 'Bad directory: %s' % location
        output = call_subprocess(
            [self.cmd, 'info', location], show_stdout=False, extra_environ={'LANG': 'C'})
        match = _svn_url_re.search(output)
        if not match:
            logger.warn('Cannot determine URL of svn checkout %s' % display_path(location))
            logger.info('Output that cannot be parsed: \n%s' % output)
            return None, None
        url = match.group(1).strip()
        match = _svn_revision_re.search(output)
        if not match:
            logger.warn('Cannot determine revision of svn checkout %s' % display_path(location))
            logger.info('Output that cannot be parsed: \n%s' % output)
            return url, None
        return url, match.group(1) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:19,代码来源:subversion.py

示例5: export

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def export(self, location):
        """Export the svn repository at the url to the destination location"""
        url, rev = self.get_url_rev()
        rev_options = get_rev_options(url, rev)
        logger.notify('Exporting svn repository %s to %s' % (url, location))
        logger.indent += 2
        try:
            if os.path.exists(location):
                # Subversion doesn't like to check out over an existing directory
                # --force fixes this, but was only added in svn 1.5
                rmtree(location)
            call_subprocess(
                [self.cmd, 'export'] + rev_options + [url, location],
                filter_stdout=self._filter, show_stdout=False)
        finally:
            logger.indent -= 2 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:18,代码来源:subversion.py

示例6: export

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def export(self, location):
        """Export the Bazaar repository at the url to the destination location"""
        temp_dir = tempfile.mkdtemp('-export', 'pip-')
        self.unpack(temp_dir)
        if os.path.exists(location):
            # Remove the location to make sure Bazaar can export it correctly
            rmtree(location)
        try:
            call_subprocess([self.cmd, 'export', location], cwd=temp_dir,
                            filter_stdout=self._filter, show_stdout=False)
        finally:
            rmtree(temp_dir) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:14,代码来源:bazaar.py

示例7: switch

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def switch(self, dest, url, rev_options):
        call_subprocess([self.cmd, 'switch', url], cwd=dest) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:4,代码来源:bazaar.py

示例8: update

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def update(self, dest, rev_options):
        call_subprocess(
            [self.cmd, 'pull', '-q'] + rev_options, cwd=dest) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:5,代码来源:bazaar.py

示例9: obtain

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def obtain(self, dest):
        url, rev = self.get_url_rev()
        if rev:
            rev_options = ['-r', rev]
            rev_display = ' (to revision %s)' % rev
        else:
            rev_options = []
            rev_display = ''
        if self.check_destination(dest, url, rev_options, rev_display):
            logger.notify('Checking out %s%s to %s'
                          % (url, rev_display, display_path(dest)))
            call_subprocess(
                [self.cmd, 'branch', '-q'] + rev_options + [url, dest]) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:15,代码来源:bazaar.py

示例10: get_url

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def get_url(self, location):
        urls = call_subprocess(
            [self.cmd, 'info'], show_stdout=False, cwd=location)
        for line in urls.splitlines():
            line = line.strip()
            for x in ('checkout of branch: ',
                      'parent branch: '):
                if line.startswith(x):
                    repo = line.split(x)[1]
                    if self._is_local_repository(repo):
                        return path_to_url(repo)
                    return repo
        return None 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:15,代码来源:bazaar.py

示例11: get_tag_revs

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def get_tag_revs(self, location):
        tags = call_subprocess(
            [self.cmd, 'tags'], show_stdout=False, cwd=location)
        tag_revs = []
        for line in tags.splitlines():
            tags_match = re.search(r'([.\w-]+)\s*(.*)$', line)
            if tags_match:
                tag = tags_match.group(1)
                rev = tags_match.group(2)
                tag_revs.append((rev.strip(), tag.strip()))
        return dict(tag_revs) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:13,代码来源:bazaar.py

示例12: export

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def export(self, location):
        """Export the Hg repository at the url to the destination location"""
        temp_dir = tempfile.mkdtemp('-export', 'pip-')
        self.unpack(temp_dir)
        try:
            call_subprocess(
                [self.cmd, 'archive', location],
                filter_stdout=self._filter, show_stdout=False, cwd=temp_dir)
        finally:
            rmtree(temp_dir) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:12,代码来源:mercurial.py

示例13: update

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def update(self, dest, rev_options):
        call_subprocess([self.cmd, 'pull', '-q'], cwd=dest)
        call_subprocess(
            [self.cmd, 'update', '-q'] + rev_options, cwd=dest) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:6,代码来源:mercurial.py

示例14: obtain

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def obtain(self, dest):
        url, rev = self.get_url_rev()
        if rev:
            rev_options = [rev]
            rev_display = ' (to revision %s)' % rev
        else:
            rev_options = []
            rev_display = ''
        if self.check_destination(dest, url, rev_options, rev_display):
            logger.notify('Cloning hg %s%s to %s'
                          % (url, rev_display, display_path(dest)))
            call_subprocess([self.cmd, 'clone', '--noupdate', '-q', url, dest])
            call_subprocess([self.cmd, 'update', '-q'] + rev_options, cwd=dest) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:15,代码来源:mercurial.py

示例15: get_tag_revs

# 需要导入模块: from pip import util [as 别名]
# 或者: from pip.util import call_subprocess [as 别名]
def get_tag_revs(self, location):
        tags = call_subprocess(
            [self.cmd, 'tags'], show_stdout=False, cwd=location)
        tag_revs = []
        for line in tags.splitlines():
            tags_match = re.search(r'([\w\d\.-]+)\s*([\d]+):.*$', line)
            if tags_match:
                tag = tags_match.group(1)
                rev = tags_match.group(2)
                if "tip" != tag:
                    tag_revs.append((rev.strip(), tag.strip()))
        return dict(tag_revs) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:14,代码来源:mercurial.py


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