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


Python util.display_path方法代碼示例

本文整理匯總了Python中pip.util.display_path方法的典型用法代碼示例。如果您正苦於以下問題:Python util.display_path方法的具體用法?Python util.display_path怎麽用?Python util.display_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pip.util的用法示例。


在下文中一共展示了util.display_path方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: obtain

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import display_path [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

示例2: get_info

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import display_path [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

示例3: remove_filename_from_pth

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import display_path [as 別名]
def remove_filename_from_pth(self, filename):
        for pth in self.pth_files():
            f = open(pth, 'r')
            lines = f.readlines()
            f.close()
            new_lines = [
                l for l in lines if l.strip() != filename]
            if lines != new_lines:
                logger.info('Removing reference to %s from .pth file %s'
                            % (display_path(filename), display_path(pth)))
                if not [line for line in new_lines if line]:
                    logger.info('%s file would be empty: deleting' % display_path(pth))
                    if not self.simulate:
                        os.unlink(pth)
                else:
                    if not self.simulate:
                        f = open(pth, 'wb')
                        f.writelines(new_lines)
                        f.close()
                return
        logger.warn('Cannot find a reference to %s in any .pth file' % display_path(filename)) 
開發者ID:sugarguo,項目名稱:Flask_Blog,代碼行數:23,代碼來源:zip.py

示例4: add_filename_to_pth

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import display_path [as 別名]
def add_filename_to_pth(self, filename):
        path = os.path.dirname(filename)
        dest = filename + '.pth'
        if path not in self.paths():
            logger.warn('Adding .pth file %s, but it is not on sys.path' % display_path(dest))
        if not self.simulate:
            if os.path.exists(dest):
                f = open(dest)
                lines = f.readlines()
                f.close()
                if lines and not lines[-1].endswith('\n'):
                    lines[-1] += '\n'
                lines.append(filename + '\n')
            else:
                lines = [filename + '\n']
            f = open(dest, 'wb')
            f.writelines(lines)
            f.close() 
開發者ID:sugarguo,項目名稱:Flask_Blog,代碼行數:20,代碼來源:zip.py

示例5: run

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import display_path [as 別名]
def run(self, options, args):

        deprecation = textwrap.dedent("""

            ###############################################
            ##                                           ##
            ##  Due to lack of interest and maintenance, ##
            ##  'pip bundle' and support for installing  ##
            ##  from *.pybundle files is now deprecated, ##
            ##  and will be removed in pip v1.5.         ##
            ##                                           ##
            ###############################################

        """)
        logger.notify(deprecation)

        if not args:
            raise InstallationError('You must give a bundle filename')
        # We have to get everything when creating a bundle:
        options.ignore_installed = True
        logger.notify('Putting temporary build files in %s and source/develop files in %s'
                      % (display_path(options.build_dir), display_path(options.src_dir)))
        self.bundle_filename = args.pop(0)
        requirement_set = super(BundleCommand, self).run(options, args)
        return requirement_set 
開發者ID:pbrf,項目名稱:dymo-m10-python,代碼行數:27,代碼來源:bundle.py


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