damned-lies r1314 - in trunk: . stats



Author: claudep
Date: Wed Jan  7 08:45:01 2009
New Revision: 1314
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1314&view=rev

Log:
2009-01-07  Claude Paroz  <claude 2xlibre net>

	* stats/models.py:
	* stats/utils.py: Don't mix stdout with stderr, return separate variables.

Modified:
   trunk/ChangeLog
   trunk/stats/models.py
   trunk/stats/utils.py

Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py	(original)
+++ trunk/stats/models.py	Wed Jan  7 08:45:01 2009
@@ -478,9 +478,9 @@
         self.checkout_lock.acquire()
         try:
             for command in commandList:
-                (status, output) = utils.run_shell_command(command)
+                (status, output, errs) = utils.run_shell_command(command)
                 if status != utils.STATUS_OK:
-                    raise OSError(status, output)
+                    raise OSError(status, errs)
         finally:
             self.checkout_lock.release()
         return 1
@@ -538,7 +538,7 @@
             "dir" : podir,
             "pot_command" : pot_command,
             }
-        (status, output) = utils.run_shell_command(command)
+        (status, output, errs) = utils.run_shell_command(command)
 
         potfile = os.path.join(vcs_path, self.potbase() + ".pot")
 
@@ -546,7 +546,7 @@
             return "", (("error", ugettext_noop("Error regenerating POT file for %(file)s:\n<pre>%(cmd)s\n%(output)s</pre>")
                                  % {'file': self.potbase(),
                                     'cmd': pot_command,
-                                    'output': output.decode('utf-8')}),
+                                    'output': errs.decode('utf-8')}),
                        )
         else:
             return potfile, ()

Modified: trunk/stats/utils.py
==============================================================================
--- trunk/stats/utils.py	(original)
+++ trunk/stats/utils.py	Wed Jan  7 08:45:01 2009
@@ -50,14 +50,14 @@
     stdin = None
     if input_data:
         stdin = PIPE
-    pipe = Popen(cmd, shell=True, env=env, stdin=stdin, stdout=PIPE, stderr=STDOUT)
+    pipe = Popen(cmd, shell=True, env=env, stdin=stdin, stdout=PIPE, stderr=PIPE)
     if input_data:
         pipe.stdin.write(input_data)
     (output, errout) = pipe.communicate()
     status = pipe.returncode
     
-    if settings.DEBUG: print >>sys.stderr, output
-    return (status, output)
+    if settings.DEBUG: print >>sys.stderr, output + errout
+    return (status, output, errout)
 
 
 def check_potfiles(po_path):
@@ -66,10 +66,9 @@
     errors = []
 
     command = "cd \"%(dir)s\" && rm -f missing notexist && intltool-update -m" % { "dir" : po_path, }
-    (status, output) = run_shell_command(command)
+    (status, output, errs) = run_shell_command(command)
 
     if status != STATUS_OK:
-        if settings.DEBUG: print >> sys.stderr, "Error running 'intltool-update -m' check."
         errors.append( ("error", ugettext_noop("Errors while running 'intltool-update -m' check.")) )
 
     missing = os.path.join(po_path, "missing")
@@ -114,14 +113,14 @@
     
     potfile = os.path.join(vcs_path, "C", potbase + ".pot")
     command = "cd \"%s\" && xml2po -o %s -e %s" % (vcs_path, potfile, files)
-    (status, output) = run_shell_command(command)
+    (status, output, errs) = run_shell_command(command)
     
     if status != STATUS_OK:
         errors.append(("error",
                        ugettext_noop("Error regenerating POT file for document %(file)s:\n<pre>%(cmd)s\n%(output)s</pre>")
                              % {'file': potbase,
                                 'cmd': command,
-                                'output': output})
+                                'output': errs})
                      )
         potfile = ""
 
@@ -193,7 +192,7 @@
     else:
         command = "msgfmt --statistics -o /dev/null %s" % input_file
 
-    (status, output) = run_shell_command(command, env=c_env, input_data=input_data)
+    (status, output, errs) = run_shell_command(command, env=c_env, input_data=input_data)
 
     if status != STATUS_OK:
         if msgfmt_checks:
@@ -226,7 +225,7 @@
         else:
             command = ("msgconv -t UTF-8 %s | diff -i -u %s - >/dev/null") % (pofile,
                                                                               pofile)
-            (status, output) = run_shell_command(command, env=c_env)
+            (status, output, errs) = run_shell_command(command, env=c_env)
         if status != STATUS_OK:
             res['errors'].append(("warn",
                               ugettext_noop("PO file '%s' is not UTF-8 encoded.") % (filename)))
@@ -295,7 +294,7 @@
     """ Extract image strings from pofile and return a list of figures dict {'path':, 'fuzzy':, 'translated':} """
     # Extract image strings: beforeline/msgid/msgstr/grep auto output a fourth line 
     command = "msgcat --no-wrap %(pofile)s| grep -A 1 -B 1 '^msgid \"@@image:'" % locals()
-    (status, output) = run_shell_command(command)
+    (status, output, errs) = run_shell_command(command)
     if status != STATUS_OK:
         # FIXME: something should be logged here
         return []



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]