]> git.lyx.org Git - lyx.git/blobdiff - development/autotests/keytest.py
PrefLanguageUi.ui: this string was forgotten in r39449
[lyx.git] / development / autotests / keytest.py
index 1122e6e7b64ba09dc575b0f4cd82d079b55a800d..1753f1460b16b3bda05ab7d231dc3edceb65b8d5 100755 (executable)
@@ -321,9 +321,9 @@ while not failed:
         lyx_pid=os.popen("pidof lyx").read()
         if lyx_pid != "":
             print "Found running instance(s) of LyX: " + lyx_pid + ": killing them all\n"
-            intr_system("killall lyx")
+            intr_system("killall lyx", True)
             time.sleep(0.5)
-            intr_system("killall -KILL lyx")
+            intr_system("killall -KILL lyx", True)
         time.sleep(0.2)
         print "Starting LyX . . ."
         if lyx_userdir is None:
@@ -375,11 +375,15 @@ while not failed:
         print "result=" + str(result) + ", failed=" + str(failed)
     elif c[0:7] == 'TestEnd':
         time.sleep(0.5)
-        print "Terminating lyx instance: " + str(lyx_pid) + "\n"
-        intr_system("kill -9 " + str(lyx_pid));
-        while lyx_exists():
-            print "Waiting for lyx to die...\n"
-            time.sleep(0.5)
+        if not lyx_exists():
+            print "LyX instance not found because of crash or assert !\n"
+            failed = true
+        else:
+            print "Terminating lyx instance: " + str(lyx_pid) + "\n"
+            intr_system("kill -9 " + str(lyx_pid), True);
+            while lyx_exists():
+                print "Waiting for lyx to die...\n"
+                time.sleep(0.5)
         cmd = c[8:].rstrip()
         print "Executing " + cmd
         result = intr_system(cmd)
@@ -389,6 +393,9 @@ while not failed:
         lang = c[5:].rstrip()
         print "Setting LANG=" + lang + "\n"
         os.environ['LANG'] = lang
+# If it doesn't exist, create a link <locale_dir>/<country-code>/LC_MESSAGES/lyx<version-suffix>.mo
+# pointing to the corresponding .gmo file. Needed to let lyx find the right translation files.
+# See http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg165613.html
         idx = lang.rfind(".")
         if idx != -1:
             ccode = lang[0:idx]
@@ -400,14 +407,15 @@ while not failed:
         else:
             short_code = ccode
         lyx_dir = os.popen("dirname \"" + lyx_exe + "\"").read().rstrip()
+        print "Executing: grep 'PACKAGE =' " + lyx_dir + "/Makefile | sed -e 's/PACKAGE = \(.*\)/\\1/'"
+        lyx_name = os.popen("grep 'PACKAGE =' " + lyx_dir + "/Makefile | sed -e 's/PACKAGE = \(.*\)/\\1/'").read().rstrip()
         intr_system("mkdir -p " + locale_dir + "/" + ccode + "/LC_MESSAGES")
-# Append version suffix ?
         if lyx_dir[0:3] == "../":
             rel_dir = "../../" + lyx_dir
         else:
             rel_dir = lyx_dir
-        intr_system("rm -f " + locale_dir + "/" + ccode + "/LC_MESSAGES/lyx.mo")
-        intr_system("ln -s " + rel_dir + "/../po/" + short_code + ".gmo " +  locale_dir + "/" + ccode + "/LC_MESSAGES/lyx.mo")
+        intr_system("rm -f " + locale_dir + "/" + ccode + "/LC_MESSAGES/" + lyx_name + ".mo")
+        intr_system("ln -s " + rel_dir + "/../po/" + short_code + ".gmo " + locale_dir + "/" + ccode + "/LC_MESSAGES/" + lyx_name + ".mo")
     else:
         print "Unrecognised Command '" + c + "'\n"
         failed = True