update_manager: clarify web client git warning
When the parent folder of a web client is a git repo note the specific directory that contians a .git subdirectory. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
db27fef6f2
commit
4f785cfca0
|
@ -1219,17 +1219,20 @@ class WebClientDeploy(BaseDeploy):
|
|||
self._is_fallback = False
|
||||
eventloop = self.server.get_event_loop()
|
||||
self.warnings.clear()
|
||||
repo_parent = source_info.find_git_repo(self.path)
|
||||
homedir = pathlib.Path("~").expanduser()
|
||||
if not self._path_writable:
|
||||
self.warnings.append(
|
||||
f"Location at option 'path: {self.path}' is not writable."
|
||||
)
|
||||
elif not self.path.is_dir():
|
||||
self.warnings.append(
|
||||
f"Location at option 'path: {self.path}' does not exist."
|
||||
f"Location at option 'path: {self.path}' is not a directory."
|
||||
)
|
||||
elif source_info.within_git_repo(self.path):
|
||||
elif repo_parent is not None and repo_parent != homedir:
|
||||
self.warnings.append(
|
||||
f"Location at option 'path: {self.path}' is a git repo."
|
||||
f"Location at option 'path: {self.path}' is within a git repo. Found "
|
||||
f".git folder at '{repo_parent.joinpath('.git')}'"
|
||||
)
|
||||
else:
|
||||
rinfo = self.path.joinpath("release_info.json")
|
||||
|
|
|
@ -26,15 +26,15 @@ def is_git_repo(src_path: Optional[pathlib.Path] = None) -> bool:
|
|||
src_path = source_path()
|
||||
return src_path.joinpath(".git").is_dir()
|
||||
|
||||
def within_git_repo(src_path: Optional[pathlib.Path] = None) -> bool:
|
||||
def find_git_repo(src_path: Optional[pathlib.Path] = None) -> Optional[pathlib.Path]:
|
||||
if src_path is None:
|
||||
src_path = source_path()
|
||||
if src_path.joinpath(".git").is_dir():
|
||||
return True
|
||||
return src_path
|
||||
for parent in src_path.parents:
|
||||
if parent.joinpath(".git").is_dir():
|
||||
return True
|
||||
return False
|
||||
return parent
|
||||
return None
|
||||
|
||||
def is_dist_package(src_path: Optional[pathlib.Path] = None) -> bool:
|
||||
if src_path is None:
|
||||
|
|
Loading…
Reference in New Issue