From 15b678b56e8a71b335ef37a49c675638e3eef2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> Date: Sat, 25 Mar 2023 19:40:14 +0100 Subject: [PATCH] convert the update-sources script to python MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-No챘l Avila <jn.avila@free.fr> --- Makefile | 2 +- scripts/update-sources | 15 +++++++++++++++ scripts/update-sources.sh | 8 -------- 3 files changed, 16 insertions(+), 9 deletions(-) create mode 100755 scripts/update-sources delete mode 100755 scripts/update-sources.sh diff --git a/Makefile b/Makefile index 5eb482b..a18ac85 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ po4a-stamp: po4a.conf $(EN_SOURCES) $(LANGUAGE_PO) Makefile @touch $@ update-sources: - @./scripts/update-sources.sh + @./scripts/update-sources $(QUIET_PO4A)PERL5LIB=./po4a/lib po4a/po4a -v --no-translations po4a.conf @for f in po/documentation.*.po; do ./scripts/pre-translate-po $$f; done @./scripts/set-priorities po/documentation.*.po diff --git a/scripts/update-sources b/scripts/update-sources new file mode 100755 index 0000000..70ea629 --- /dev/null +++ b/scripts/update-sources @@ -0,0 +1,15 @@ +#!/usr/bin/python + +import shutil + +with open('sources.txt') as f: + sources = f.read().splitlines() + for source in sources: + try: + shutil.copy2(f"../{source}", f"en/{source}") + except FileNotFoundError: + print(f"File not found: {source}") + except shutil.SameFileError: + print(f"File is the same: {source}") + +shutil.copy2("../../GIT-VERSION-FILE", ".") diff --git a/scripts/update-sources.sh b/scripts/update-sources.sh deleted file mode 100755 index 247207e..0000000 --- a/scripts/update-sources.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -for f in $(cat sources.txt) -do - ln -f ../$f en/$f -done - -cp ../../GIT-VERSION-FILE . -- GitLab