コード例 #1
0
ファイル: conftest.py プロジェクト: sailfishos-mirror/pip
def install_egg_link(
    venv: VirtualEnvironment, project_name: str, egg_info_dir: Path
) -> None:
    with open(venv.site / "easy-install.pth", "a") as fp:
        fp.write(str(egg_info_dir.resolve()) + "\n")
    with open(venv.site / (project_name + ".egg-link"), "w") as fp:
        fp.write(str(egg_info_dir) + "\n.")
コード例 #2
0
ファイル: conftest.py プロジェクト: mwchase/pip
def pip_src(tmpdir_factory):
    def not_code_files_and_folders(path, names):
        # In the root directory...
        if path == SRC_DIR:
            # ignore all folders except "src"
            folders = {name for name in names if os.path.isdir(path / name)}
            to_ignore = folders - {"src"}
            # and ignore ".git" if present (which may be a file if in a linked
            # worktree).
            if ".git" in names:
                to_ignore.add(".git")
            return to_ignore

        # Ignore all compiled files and egg-info.
        ignored = set()
        for pattern in ("__pycache__", "*.pyc", "pip.egg-info"):
            ignored.update(fnmatch.filter(names, pattern))
        return ignored

    pip_src = Path(str(tmpdir_factory.mktemp('pip_src'))).joinpath('pip_src')
    # Copy over our source tree so that each use is self contained
    shutil.copytree(
        SRC_DIR,
        pip_src.resolve(),
        ignore=not_code_files_and_folders,
    )
    return pip_src
コード例 #3
0
ファイル: __init__.py プロジェクト: sailfishos-mirror/pip
def _test_path_to_file_url(path: Path) -> str:
    """
    Convert a test Path to a "file://" URL.

    Args:
      path: a tests.lib.path.Path object.
    """
    return "file://" + path.resolve().replace("\\", "/")