Fix animdl discovery in Docker runtime
This commit is contained in:
+18
-3
@@ -22,9 +22,24 @@ from uuid import uuid4
|
||||
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parent
|
||||
ANI_CLI = os.environ.get("ANI_CLI_BIN") or shutil.which("ani-cli") or "ani-cli"
|
||||
ANIPY_CLI = os.environ.get("ANIPY_CLI_BIN") or shutil.which("anipy-cli") or "anipy-cli"
|
||||
ANIMDL = os.environ.get("ANIMDL_BIN") or shutil.which("animdl") or "animdl"
|
||||
|
||||
|
||||
def configured_cli_command(env_name, executable_name):
|
||||
configured = str(os.environ.get(env_name) or "").strip()
|
||||
if configured:
|
||||
return configured
|
||||
resolved = shutil.which(executable_name)
|
||||
if resolved:
|
||||
return resolved
|
||||
for candidate in (Path("/usr/local/bin") / executable_name, Path("/usr/bin") / executable_name):
|
||||
if candidate.exists() and os.access(candidate, os.X_OK):
|
||||
return str(candidate)
|
||||
return executable_name
|
||||
|
||||
|
||||
ANI_CLI = configured_cli_command("ANI_CLI_BIN", "ani-cli")
|
||||
ANIPY_CLI = configured_cli_command("ANIPY_CLI_BIN", "anipy-cli")
|
||||
ANIMDL = configured_cli_command("ANIMDL_BIN", "animdl")
|
||||
APP_NAME = "ani-cli-web"
|
||||
VERSION_FILE = PROJECT_ROOT / "VERSION"
|
||||
CHANGELOG_FILE = PROJECT_ROOT / "CHANGELOG.md"
|
||||
|
||||
Reference in New Issue
Block a user