Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._internal.vcs.versioncontrol Namespace Reference

Data Structures

class  RemoteNotFoundError
 
class  RemoteNotValidError
 
class  RevOptions
 
class  VcsSupport
 
class  VersionControl
 

Functions

bool is_url (str name)
 
str make_vcs_requirement_url (str repo_url, str rev, str project_name, Optional[str] subdir=None)
 
Optional[str] find_path_to_project_root_from_repo_root (str location, str repo_root)
 

Variables

 logger = logging.getLogger(__name__)
 
 AuthInfo = Tuple[Optional[str], Optional[str]]
 
 vcs = VcsSupport()
 

Detailed Description

Handles all VCS (version control) support

Function Documentation

◆ find_path_to_project_root_from_repo_root()

Optional[str] find_path_to_project_root_from_repo_root ( str  location,
str   repo_root 
)
Find the the Python project's root by searching up the filesystem from
`location`. Return the path to project root relative to `repo_root`.
Return None if the project root is `repo_root`, or cannot be found.

Definition at line 85 of file versioncontrol.py.

87) -> Optional[str]:
88 """
89 Find the the Python project's root by searching up the filesystem from
90 `location`. Return the path to project root relative to `repo_root`.
91 Return None if the project root is `repo_root`, or cannot be found.
92 """
93 # find project root.
94 orig_location = location
95 while not is_installable_dir(location):
96 last_location = location
97 location = os.path.dirname(location)
98 if location == last_location:
99 # We've traversed up to the root of the filesystem without
100 # finding a Python project.
102 "Could not find a Python project for directory %s (tried all "
103 "parent directories)",
104 orig_location,
105 )
106 return None
107
108 if os.path.samefile(repo_root, location):
109 return None
110
111 return os.path.relpath(location, repo_root)
112
113
for i

References i.

◆ is_url()

bool is_url ( str  name)
Return true if the name looks like a URL.

Definition at line 57 of file versioncontrol.py.

57def is_url(name: str) -> bool:
58 """
59 Return true if the name looks like a URL.
60 """
61 scheme = get_url_scheme(name)
62 if scheme is None:
63 return False
64 return scheme in ["http", "https", "file", "ftp"] + vcs.all_schemes
65
66

References i.

◆ make_vcs_requirement_url()

str make_vcs_requirement_url ( str  repo_url,
str  rev,
str  project_name,
Optional[str]   subdir = None 
)
Return the URL for a VCS requirement.

Args:
  repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
  project_name: the (unescaped) project name.

Definition at line 67 of file versioncontrol.py.

69) -> str:
70 """
71 Return the URL for a VCS requirement.
72
73 Args:
74 repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
75 project_name: the (unescaped) project name.
76 """
77 egg_project_name = project_name.replace("-", "_")
78 req = f"{repo_url}@{rev}#egg={egg_project_name}"
79 if subdir:
80 req += f"&subdirectory={subdir}"
81
82 return req
83
84

References i.

Referenced by VersionControl.get_src_requirement().

Here is the caller graph for this function:

Variable Documentation

◆ AuthInfo

AuthInfo = Tuple[Optional[str], Optional[str]]

Definition at line 54 of file versioncontrol.py.

◆ logger

logger = logging.getLogger(__name__)

Definition at line 52 of file versioncontrol.py.

◆ vcs

vcs = VcsSupport()

Definition at line 271 of file versioncontrol.py.