From 0fee8f533a08884754d9e8cb25d7cd6a2afffc55 Mon Sep 17 00:00:00 2001 From: Krosus777 <38509947+Krosus777@users.noreply.github.com> Date: Thu, 18 Sep 2025 10:12:57 +0200 Subject: [PATCH] UpdateTranslationScript (#3396) --- Tools/ss14_ru/requirements.txt | 2 +- Tools/ss14_ru/translation.sh | 37 ++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 9 deletions(-) mode change 100644 => 100755 Tools/ss14_ru/translation.sh diff --git a/Tools/ss14_ru/requirements.txt b/Tools/ss14_ru/requirements.txt index de09258db4..239f44ef46 100644 --- a/Tools/ss14_ru/requirements.txt +++ b/Tools/ss14_ru/requirements.txt @@ -1,5 +1,5 @@ chardet==5.2.0 fluent==0.10.0 pydash==8.0.5 -typing_extensions==4.9.0 +typing_extensions==4.12.2 PyYAML==6.0.2 diff --git a/Tools/ss14_ru/translation.sh b/Tools/ss14_ru/translation.sh old mode 100644 new mode 100755 index db231c7d4c..e3b0254c95 --- a/Tools/ss14_ru/translation.sh +++ b/Tools/ss14_ru/translation.sh @@ -1,12 +1,33 @@ -#!/usr/bin/env sh +#!/usr/bin/env sh # make sure to start from script dir -if [ "$(dirname $0)" != "." ]; then - cd "$(dirname $0)" +if [ "$(dirname "$0")" != "." ]; then + cd "$(dirname "$0")" fi -pip install -r requirements.txt --no-warn-script-location -python3 ./yamlextractor.py -python3 ./keyfinder.py -python3 ./clean_duplicates.py -python3 ./clean_empty.py +# pick Python and Pip in a way that respects a venv if active +if command -v python3 >/dev/null 2>&1; then + PY=python3 +else + PY=python +fi + +if "$PY" -m pip --version >/dev/null 2>&1; then + PIP="$PY -m pip" +elif command -v pip >/dev/null 2>&1; then + PIP=pip +elif command -v pip3 >/dev/null 2>&1; then + PIP=pip3 +else + echo "Warning: pip not found; skipping dependency install" >&2 + PIP="" +fi + +if [ -n "$PIP" ]; then + $PIP install -r requirements.txt --no-warn-script-location +fi + +$PY ./yamlextractor.py +$PY ./keyfinder.py +$PY ./clean_duplicates.py +$PY ./clean_empty.py