# HG changeset patch # User Pierre-Yves David # Date 1730907135 -3600 # Node ID 2c4283c9fa93d7f825bb220c7ae01d77058d6d39 # Parent c32b17e8f414470662c0b999264cd7f8e7d789b0 setup: add a way to force the setup to translate (or fail) we add the `MERCURIAL_SETUP_FORCE_TRANSLATIONS` variable that is intended to make sure we don't stop building the translation silently. diff -r c32b17e8f414 -r 2c4283c9fa93 contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml Wed Nov 06 16:37:10 2024 +0100 +++ b/contrib/heptapod-ci.yml Wed Nov 06 16:32:15 2024 +0100 @@ -47,6 +47,7 @@ variables: WHEEL_TYPE: "" FLAVOR: "" + MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1" before_script: - echo "python used, $PYTHON" - $PYTHON --version diff -r c32b17e8f414 -r 2c4283c9fa93 setup.py --- a/setup.py Wed Nov 06 16:37:10 2024 +0100 +++ b/setup.py Wed Nov 06 16:32:15 2024 +0100 @@ -464,6 +464,14 @@ description = "build translations (.mo files)" def run(self): + result = self._run() + if ( + not result + and os.environ.get('MERCURIAL_SETUP_FORCE_TRANSLATIONS') == '1' + ): + raise DistutilsExecError("failed to build translations") + + def _run(self): try: from shutil import which as find_executable except ImportError: @@ -475,12 +483,12 @@ "could not find msgfmt executable, no translations " "will be built" ) - return + return False podir = 'i18n' if not os.path.isdir(podir): self.warn("could not find %s/ directory" % podir) - return + return False join = os.path.join for po in os.listdir(podir): @@ -496,6 +504,7 @@ cmd.append('-c') self.mkpath(join('mercurial', modir)) self.make_file([pofile], mobuildfile, spawn, (cmd,)) + return True class hgdist(Distribution):