[rkward] scripts: Fix message extraction with scripty

Luigi Toscano null at kde.org
Sun Oct 7 15:14:37 BST 2018


Git commit d29ef67edc442383450d139e590b6f654437aa00 by Luigi Toscano.
Committed on 07/10/2018 at 14:13.
Pushed by ltoscano into branch 'master'.

Fix message extraction with scripty

subprocess.Popen and bash -c are now used because the default value
of XGETTEXT set by scripty is an function defined in the environment.
Using subprocess.call with shell=True uses sh, which does not pass
the function defined with export -f, so let's be explicit
and depend on bash.

M  +6    -1    scripts/update_plugin_messages.py

https://commits.kde.org/rkward/d29ef67edc442383450d139e590b6f654437aa00

diff --git a/scripts/update_plugin_messages.py b/scripts/update_plugin_messages.py
index 3b0c63d5..24a1b3e9 100755
--- a/scripts/update_plugin_messages.py
+++ b/scripts/update_plugin_messages.py
@@ -535,7 +535,12 @@ for po_id in initialized_pot_files:
   templatename = "rkward__" + po_id
   finalpotfile = os.path.join (p_outdir, templatename + ".pot")
   # NOTE: using --no-location, as that just adds meaningless references to the temporary .pot.cpp-file.
-  res = subprocess.call (XGETTEXT_CALL.split () + ["--no-location", "-o", finalpotfile, potcppfile])
+  # subprocess.Popen and bash -c are used here because the default value
+  # of XGETTEXT set by scripty is an function defined in the environment.
+  # Using subprocess.call with shell=True uses sh, which does not pass
+  # the function defined with export -f, so let's be explicit
+  # and depend on bash.
+  res = subprocess.Popen (['bash', '-c', ' '.join(XGETTEXT_CALL.split () + ["--no-location", "-o", finalpotfile, potcppfile])]).wait()
   if (res):
     sys.stderr.write ("calling xgettext failed with exit code " + str (res))
   os.remove (potcppfile)



More information about the rkward-tracker mailing list