fix installer
This commit is contained in:
@@ -1619,14 +1619,14 @@ def main(argv: Optional[list[str]] = None) -> int:
|
||||
break
|
||||
|
||||
script_dir = Path(__file__).resolve().parent
|
||||
ensure_run_client_helper(dest, script_dir)
|
||||
installed_helper = ensure_run_client_helper(dest, script_dir)
|
||||
|
||||
run_client_script = None
|
||||
if client_found:
|
||||
# Prefer run_client helper located in the cloned repo; if missing, fall back to top-level scripts folder helper.
|
||||
helper_candidates = [dest / "run_client.py", script_dir / "run_client.py"]
|
||||
# Prefer the helper installed directly into the Hydrus repository.
|
||||
helper_candidates = [installed_helper, dest / "run_client.py", script_dir / "run_client.py"]
|
||||
for cand in helper_candidates:
|
||||
if cand.exists():
|
||||
if cand and cand.exists():
|
||||
run_client_script = cand
|
||||
break
|
||||
if getattr(args,
|
||||
@@ -1830,20 +1830,22 @@ def main(argv: Optional[list[str]] = None) -> int:
|
||||
|
||||
# Helpful hint: show the new run_client helper and direct run example
|
||||
try:
|
||||
helper_to_show = (
|
||||
run_client_script if
|
||||
(run_client_script and run_client_script.exists()) else
|
||||
(script_dir / "run_client.py")
|
||||
)
|
||||
if venv_py:
|
||||
logging.info(
|
||||
"To run the Hydrus client using the repo venv (no activation needed):\n %s %s [args]\nOr use the helper: %s --help\nHelper examples:\n %s --install-deps --verify\n %s --headless --detached",
|
||||
venv_py,
|
||||
dest / "hydrus_client.py",
|
||||
helper_to_show,
|
||||
helper_to_show,
|
||||
helper_to_show,
|
||||
)
|
||||
if run_client_script and run_client_script.exists() and run_client_script.resolve().parent == dest.resolve():
|
||||
logging.info(
|
||||
"To run the Hydrus client using the repo venv (no activation needed):\n %s %s [args]\nOr use the helper: %s --help\nHelper examples:\n %s --install-deps --verify\n %s --no-update --headless --detached",
|
||||
venv_py,
|
||||
dest / "hydrus_client.py",
|
||||
run_client_script,
|
||||
run_client_script,
|
||||
run_client_script,
|
||||
)
|
||||
else:
|
||||
logging.info(
|
||||
"To run the Hydrus client using the repo venv (no activation needed):\n %s %s [args]",
|
||||
venv_py,
|
||||
dest / "hydrus_client.py",
|
||||
)
|
||||
else:
|
||||
logging.info(
|
||||
"To run the Hydrus client: python %s [args]",
|
||||
@@ -1875,14 +1877,11 @@ def ensure_run_client_helper(dest: Path, script_dir: Path) -> Optional[Path]:
|
||||
return None
|
||||
|
||||
helper_dest = dest / "run_client.py"
|
||||
if helper_dest.exists():
|
||||
return helper_dest
|
||||
|
||||
try:
|
||||
shutil.copy2(helper_src, helper_dest)
|
||||
if os.name != "nt":
|
||||
helper_dest.chmod(helper_dest.stat().st_mode | 0o111)
|
||||
logging.debug("Copied run_client helper to %s", helper_dest)
|
||||
logging.debug("Installed run_client helper to %s", helper_dest)
|
||||
return helper_dest
|
||||
except Exception as exc:
|
||||
logging.debug("Failed to copy run_client helper: %s", exc)
|
||||
|
||||
Reference in New Issue
Block a user