[Commits] (vajda) Improved epydoc to log output to hardhat.log

commits at osafoundation.org commits at osafoundation.org
Tue Jan 27 17:41:38 PST 2004


Commit by: vajda
Modified files:
osaf/hardhat/hardhat.py 1.36 1.37
osaf/hardhat/hardhatlib.py 1.66 1.67

Log message:
Improved epydoc to log output to hardhat.log


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/osaf/hardhat/hardhat.py.diff?r1=text&tr1=1.36&r2=text&tr2=1.37
http://cvs.osafoundation.org/index.cgi/osaf/hardhat/hardhatlib.py.diff?r1=text&tr1=1.66&r2=text&tr2=1.67

Index: osaf/hardhat/hardhat.py
diff -u osaf/hardhat/hardhat.py:1.36 osaf/hardhat/hardhat.py:1.37
--- osaf/hardhat/hardhat.py:1.36	Fri Jan 23 16:00:59 2004
+++ osaf/hardhat/hardhat.py	Tue Jan 27 17:41:03 2004
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
-__version__     = "$Revision: 1.36 $"
-__date__        = "$Date: 2004/01/24 00:00:59 $"
+__version__     = "$Revision: 1.37 $"
+__date__        = "$Date: 2004/01/28 01:41:03 $"
 __copyright__   = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__     = "GPL -- see LICENSE.txt"
 
@@ -184,7 +184,7 @@
              [py], "Interactive session")
 
         if opt == "-j":
-            hardhatlib.epydoc(buildenv, arg, *args)
+            hardhatlib.epydoc(buildenv, None, None, arg, *args)
 
         if opt == "-l":
             args_used = True  # we're going to be using the leftover args

Index: osaf/hardhat/hardhatlib.py
diff -u osaf/hardhat/hardhatlib.py:1.66 osaf/hardhat/hardhatlib.py:1.67
--- osaf/hardhat/hardhatlib.py:1.66	Fri Jan 23 16:00:59 2004
+++ osaf/hardhat/hardhatlib.py	Tue Jan 27 17:41:03 2004
@@ -1,5 +1,5 @@
-__version__     = "$Revision: 1.66 $"
-__date__        = "$Date: 2004/01/24 00:00:59 $"
+__version__     = "$Revision: 1.67 $"
+__date__        = "$Date: 2004/01/28 01:41:03 $"
 __copyright__   = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__     = "GPL -- see LICENSE.txt"
 
@@ -18,7 +18,7 @@
 
 """
 
-import os, sys, glob, errno, string, shutil, fileinput, re
+import os, sys, glob, errno, string, shutil, fileinput, re, popen2
 
 
 # Earlier versions of Python don't define these, so let's include them here:
@@ -728,24 +728,40 @@
      [python] + args, "Running" )
 
 
-def epydoc(buildenv, *args):
+def epydoc(buildenv, name, message, *args):
 
     if buildenv['version'] == 'debug':
         python = buildenv['python_d']
     elif buildenv['version'] == 'release':
         python = buildenv['python']
 
-    command = [ python, '-c', 'from epydoc.cli import cli\ncli()' ]
+    command = [ python, '-c', '"from epydoc.cli import cli\ncli()"' ]
     command.extend(args)
-    print command
 
-    exit_code = os.spawnv(os.P_WAIT, python, command)
+    if name is None:   # normal -j command line use, not from __hardhat__.py
+        buildlog = sys.stdout
+    else:
+        buildlog = file(buildenv['logfile'], 'a+', 0)
+        log(buildenv, HARDHAT_MESSAGE, name, message)
+
+    print >> buildlog, command
+    process = popen2.Popen4(' '.join(command), True)
 
+    while True:
+        output = process.fromchild.read(128)
+        if len(output) == 0:
+            break
+        print >> buildlog, output,
+
+    exit_code = process.wait()
+    if name is not None:
+        buildlog.close()
+    
     if exit_code == 0:
         log(buildenv, HARDHAT_MESSAGE, "HardHat", "OK")
     else:
         log(buildenv, HARDHAT_ERROR, "HardHat",
-            "Command exited with code = " + str(exit_code) )
+            "Command exited with code = %s" %(exit_code))
         raise HardHatExternalCommandError
     
     return exit_code



More information about the Commits mailing list