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


Python compat.samefile方法代碼示例

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


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

示例1: get_subdirectory

# 需要導入模塊: from pip._internal.utils import compat [as 別名]
# 或者: from pip._internal.utils.compat import samefile [as 別名]
def get_subdirectory(cls, location):
        # find the repo root
        git_dir = cls.run_command(['rev-parse', '--git-dir'],
                                  show_stdout=False, cwd=location).strip()
        if not os.path.isabs(git_dir):
            git_dir = os.path.join(location, git_dir)
        root_dir = os.path.join(git_dir, '..')
        # find setup.py
        orig_location = location
        while not os.path.exists(os.path.join(location, 'setup.py')):
            last_location = location
            location = os.path.dirname(location)
            if location == last_location:
                # We've traversed up to the root of the filesystem without
                # finding setup.py
                logger.warning(
                    "Could not find setup.py for directory %s (tried all "
                    "parent directories)",
                    orig_location,
                )
                return None
        # relative path of setup.py to repo root
        if samefile(root_dir, location):
            return None
        return os.path.relpath(location, root_dir) 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:27,代碼來源:git.py

示例2: find_path_to_setup_from_repo_root

# 需要導入模塊: from pip._internal.utils import compat [as 別名]
# 或者: from pip._internal.utils.compat import samefile [as 別名]
def find_path_to_setup_from_repo_root(location, repo_root):
    """
    Find the path to `setup.py` by searching up the filesystem from `location`.
    Return the path to `setup.py` relative to `repo_root`.
    Return None if `setup.py` is in `repo_root` or cannot be found.
    """
    # find setup.py
    orig_location = location
    while not os.path.exists(os.path.join(location, 'setup.py')):
        last_location = location
        location = os.path.dirname(location)
        if location == last_location:
            # We've traversed up to the root of the filesystem without
            # finding setup.py
            logger.warning(
                "Could not find setup.py for directory %s (tried all "
                "parent directories)",
                orig_location,
            )
            return None

    if samefile(repo_root, location):
        return None

    return os.path.relpath(location, repo_root) 
開發者ID:boris-kz,項目名稱:CogAlg,代碼行數:27,代碼來源:versioncontrol.py

示例3: find_path_to_setup_from_repo_root

# 需要導入模塊: from pip._internal.utils import compat [as 別名]
# 或者: from pip._internal.utils.compat import samefile [as 別名]
def find_path_to_setup_from_repo_root(location, repo_root):
    # type: (str, str) -> Optional[str]
    """
    Find the path to `setup.py` by searching up the filesystem from `location`.
    Return the path to `setup.py` relative to `repo_root`.
    Return None if `setup.py` is in `repo_root` or cannot be found.
    """
    # find setup.py
    orig_location = location
    while not os.path.exists(os.path.join(location, 'setup.py')):
        last_location = location
        location = os.path.dirname(location)
        if location == last_location:
            # We've traversed up to the root of the filesystem without
            # finding setup.py
            logger.warning(
                "Could not find setup.py for directory %s (tried all "
                "parent directories)",
                orig_location,
            )
            return None

    if samefile(repo_root, location):
        return None

    return os.path.relpath(location, repo_root) 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:28,代碼來源:versioncontrol.py

示例4: _get_subdirectory

# 需要導入模塊: from pip._internal.utils import compat [as 別名]
# 或者: from pip._internal.utils.compat import samefile [as 別名]
def _get_subdirectory(cls, location):
        """Return the relative path of setup.py to the git repo root."""
        # find the repo root
        git_dir = cls.run_command(['rev-parse', '--git-dir'],
                                  show_stdout=False, cwd=location).strip()
        if not os.path.isabs(git_dir):
            git_dir = os.path.join(location, git_dir)
        root_dir = os.path.join(git_dir, '..')
        # find setup.py
        orig_location = location
        while not os.path.exists(os.path.join(location, 'setup.py')):
            last_location = location
            location = os.path.dirname(location)
            if location == last_location:
                # We've traversed up to the root of the filesystem without
                # finding setup.py
                logger.warning(
                    "Could not find setup.py for directory %s (tried all "
                    "parent directories)",
                    orig_location,
                )
                return None
        # relative path of setup.py to repo root
        if samefile(root_dir, location):
            return None
        return os.path.relpath(location, root_dir) 
開發者ID:QData,項目名稱:deepWordBug,代碼行數:28,代碼來源:git.py

示例5: _get_subdirectory

# 需要導入模塊: from pip._internal.utils import compat [as 別名]
# 或者: from pip._internal.utils.compat import samefile [as 別名]
def _get_subdirectory(self, location):
        """Return the relative path of setup.py to the git repo root."""
        # find the repo root
        git_dir = self.run_command(['rev-parse', '--git-dir'],
                                   show_stdout=False, cwd=location).strip()
        if not os.path.isabs(git_dir):
            git_dir = os.path.join(location, git_dir)
        root_dir = os.path.join(git_dir, '..')
        # find setup.py
        orig_location = location
        while not os.path.exists(os.path.join(location, 'setup.py')):
            last_location = location
            location = os.path.dirname(location)
            if location == last_location:
                # We've traversed up to the root of the filesystem without
                # finding setup.py
                logger.warning(
                    "Could not find setup.py for directory %s (tried all "
                    "parent directories)",
                    orig_location,
                )
                return None
        # relative path of setup.py to repo root
        if samefile(root_dir, location):
            return None
        return os.path.relpath(location, root_dir) 
開發者ID:luckystarufo,項目名稱:pySINDy,代碼行數:28,代碼來源:git.py


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