@classmethod def get_subdirectory(cls, location: str) -> Optional[str]: """ Return the path to Python project root, relative to the repo root. ReturnNoneif the project root isin the repo root. """ # find the repo root
repo_root = cls.run_command(
["root"], show_stdout=False, stdout_only=True, cwd=location
).strip() ifnot os.path.isabs(repo_root):
repo_root = os.path.abspath(os.path.join(location, repo_root)) return find_path_to_project_root_from_repo_root(location, repo_root)
@classmethod def get_repository_root(cls, location: str) -> Optional[str]:
loc = super().get_repository_root(location) if loc: return loc try:
r = cls.run_command(
["root"],
cwd=location,
show_stdout=False,
stdout_only=True,
on_returncode="raise",
log_failed_cmd=False,
) except BadCommand:
logger.debug( "could not determine if %s is under hg control " "because hg is not available",
location,
) returnNone except InstallationError: returnNone return os.path.normpath(r.rstrip("\r\n"))
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.