From 31b176169a889e6700e752831334997af23d3d64 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 10 Apr 2025 17:45:21 +0000 Subject: [PATCH] contrib: mv locale-related scripts to contrib/locale/ --- .cirrus.yml | 2 +- README.md | 2 +- contrib/android/make_apk.sh | 2 +- contrib/build-linux/appimage/make_appimage.sh | 2 +- contrib/build-linux/sdist/README.md | 2 +- contrib/build-linux/sdist/make_sdist.sh | 2 +- contrib/build-wine/build-electrum-git.sh | 2 +- contrib/{ => locale}/build_cleanlocale.sh | 5 +++-- contrib/{ => locale}/build_locale.sh | 0 contrib/{push_locale => locale/push_locale.py} | 2 +- contrib/osx/make_osx.sh | 2 +- 11 files changed, 12 insertions(+), 11 deletions(-) rename contrib/{ => locale}/build_cleanlocale.sh (55%) rename contrib/{ => locale}/build_locale.sh (100%) rename contrib/{push_locale => locale/push_locale.py} (98%) diff --git a/.cirrus.yml b/.cirrus.yml index 409c28c21..7fdb9d6b3 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -81,7 +81,7 @@ task: - pip install -r $ELECTRUM_REQUIREMENTS_CI - pip install requests locale_script: - - contrib/push_locale + - contrib/locale/push_locale.py env: ELECTRUM_IMAGE: python:3.10 ELECTRUM_REQUIREMENTS_CI: contrib/requirements/requirements-ci.txt diff --git a/README.md b/README.md index 77b18c68d..d4e23a527 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ $ python3 -m pip install --user -e . Create translations (optional): ``` $ sudo apt-get install gettext -$ ./contrib/build_locale.sh electrum/locale/locale electrum/locale/locale +$ ./contrib/locale/build_locale.sh electrum/locale/locale electrum/locale/locale ``` Finally, to start Electrum: diff --git a/contrib/android/make_apk.sh b/contrib/android/make_apk.sh index 5d7348c8a..0eb245c91 100755 --- a/contrib/android/make_apk.sh +++ b/contrib/android/make_apk.sh @@ -22,7 +22,7 @@ fi # update locale info "preparing electrum-locale." ( - "$CONTRIB/build_cleanlocale.sh" + "$CONTRIB/locale/build_cleanlocale.sh" # we want the binary to have only compiled (.mo) locale files; not source (.po) files rm -r "$PROJECT_ROOT/electrum/locale/locale"/*/electrum.po ) diff --git a/contrib/build-linux/appimage/make_appimage.sh b/contrib/build-linux/appimage/make_appimage.sh index 540e363e8..25bcc7274 100755 --- a/contrib/build-linux/appimage/make_appimage.sh +++ b/contrib/build-linux/appimage/make_appimage.sh @@ -136,7 +136,7 @@ break_legacy_easy_install info "preparing electrum-locale." ( - "$CONTRIB/build_cleanlocale.sh" + "$CONTRIB/locale/build_cleanlocale.sh" # we want the binary to have only compiled (.mo) locale files; not source (.po) files rm -r "$PROJECT_ROOT/electrum/locale/locale"/*/electrum.po ) diff --git a/contrib/build-linux/sdist/README.md b/contrib/build-linux/sdist/README.md index a9fedd15f..1457b6a33 100644 --- a/contrib/build-linux/sdist/README.md +++ b/contrib/build-linux/sdist/README.md @@ -52,6 +52,6 @@ The differences are as follows: found and used at runtime. - the normal tarball includes compiled (.mo) locale files, the source-only tarball does not. Both tarballs contain (.po) source locale files. If you are packaging for a Linux distro, - you probably want to compile the .mo locale files yourself (see `contrib/build_locale.sh`). + you probably want to compile the .mo locale files yourself (see `contrib/locale/build_locale.sh`). - the normal tarball includes generated `*_pb2.py` files. These are created using `protobuf-compiler` from `.proto` files (see `contrib/generate_payreqpb2.sh`) diff --git a/contrib/build-linux/sdist/make_sdist.sh b/contrib/build-linux/sdist/make_sdist.sh index 0bde8ba00..ecdf5b8e5 100755 --- a/contrib/build-linux/sdist/make_sdist.sh +++ b/contrib/build-linux/sdist/make_sdist.sh @@ -26,7 +26,7 @@ fi info "preparing electrum-locale." ( - "$CONTRIB/build_cleanlocale.sh" + "$CONTRIB/locale/build_cleanlocale.sh" # By default, include both source (.po) and compiled (.mo) locale files in the source dist. # Set option OMIT_UNCLEAN_FILES=1 to exclude the compiled locale files # see https://askubuntu.com/a/144139 (also see MANIFEST.in) diff --git a/contrib/build-wine/build-electrum-git.sh b/contrib/build-wine/build-electrum-git.sh index a65e6fa9d..70dff7381 100755 --- a/contrib/build-wine/build-electrum-git.sh +++ b/contrib/build-wine/build-electrum-git.sh @@ -18,7 +18,7 @@ info "Last commit: $VERSION" info "preparing electrum-locale." ( - "$CONTRIB/build_cleanlocale.sh" + "$CONTRIB/locale/build_cleanlocale.sh" # we want the binary to have only compiled (.mo) locale files; not source (.po) files rm -r "$PROJECT_ROOT/electrum/locale/locale"/*/electrum.po ) diff --git a/contrib/build_cleanlocale.sh b/contrib/locale/build_cleanlocale.sh similarity index 55% rename from contrib/build_cleanlocale.sh rename to contrib/locale/build_cleanlocale.sh index 00d57a545..4d3c0e621 100755 --- a/contrib/build_cleanlocale.sh +++ b/contrib/locale/build_cleanlocale.sh @@ -2,7 +2,8 @@ set -e -CONTRIB="$(dirname "$(readlink -e "$0")")" +CONTRIB_LOCALE="$(dirname "$(readlink -e "$0")")" +CONTRIB="$CONTRIB_LOCALE"/.. PROJECT_ROOT="$CONTRIB"/.. cd "$PROJECT_ROOT" @@ -12,4 +13,4 @@ LOCALE="$PROJECT_ROOT/electrum/locale/" cd "$LOCALE" git clean -ffxd git reset --hard -"$CONTRIB/build_locale.sh" "$LOCALE/locale" "$LOCALE/locale" +"$CONTRIB_LOCALE/build_locale.sh" "$LOCALE/locale" "$LOCALE/locale" diff --git a/contrib/build_locale.sh b/contrib/locale/build_locale.sh similarity index 100% rename from contrib/build_locale.sh rename to contrib/locale/build_locale.sh diff --git a/contrib/push_locale b/contrib/locale/push_locale.py similarity index 98% rename from contrib/push_locale rename to contrib/locale/push_locale.py index bf1229a4b..86b855434 100755 --- a/contrib/push_locale +++ b/contrib/locale/push_locale.py @@ -16,7 +16,7 @@ except ImportError as e: sys.exit(f"Error: {str(e)}. Try 'python3 -m pip install --user '") # set cwd -project_root = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) +project_root = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) os.chdir(project_root) locale_dir = os.path.join(project_root, "electrum", "locale") diff --git a/contrib/osx/make_osx.sh b/contrib/osx/make_osx.sh index 25edc53a8..8d682a207 100755 --- a/contrib/osx/make_osx.sh +++ b/contrib/osx/make_osx.sh @@ -134,7 +134,7 @@ info "preparing electrum-locale." brew install gettext brew link --force gettext fi - "$CONTRIB/build_cleanlocale.sh" + "$CONTRIB/locale/build_cleanlocale.sh" # we want the binary to have only compiled (.mo) locale files; not source (.po) files rm -r "$PROJECT_ROOT/electrum/locale/locale"/*/electrum.po ) || fail "failed generating locale"