You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by aj...@apache.org on 2003/10/19 00:20:27 UTC
cvs commit: jakarta-gump/python/gump context.py nag.py logic.py document.py
ajack 2003/10/18 15:20:27
Modified: python/gump context.py nag.py logic.py document.py
Log:
1) Various documentation tweaks [e.g. escaping]
2) ant/script -debug and -verbose on the XML object, e.g. debug='true'
Revision Changes Path
1.23 +5 -0 jakarta-gump/python/gump/context.py
Index: context.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/context.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- context.py 18 Oct 2003 01:42:45 -0000 1.22
+++ context.py 18 Oct 2003 22:20:27 -0000 1.23
@@ -662,6 +662,11 @@
#
self.debug=0
+ #
+ # Turns on ant '-verbose'
+ #
+ self.verbose=0
+
#
self.startdatetime=time.strftime(setting.datetimeformat, \
time.localtime())
1.18 +8 -7 jakarta-gump/python/gump/nag.py
Index: nag.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/nag.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- nag.py 17 Oct 2003 16:03:00 -0000 1.17
+++ nag.py 18 Oct 2003 22:20:27 -0000 1.18
@@ -170,7 +170,13 @@
if not context.reason == REASON_UNSET:
content += "Reason: " + reasonString(context.reason) + "\n"
-
+
+ #
+ # Link them back here...
+ #
+ url=getContextAbsoluteUrl(workspace.logurl,context)
+ content += "URL: " + url + "\n"
+
#
# Add an info/error/etc...
#
@@ -186,12 +192,7 @@
content+="\n\nWork Items:\n"
for workitem in context.worklist:
content+=workitem.overview()+"\n"
-
- #
- # Link them back here...
- #
- url=getContextAbsoluteUrl(workspace.logurl,context)
- content += "URL: " + url + "\n"
+
return content
1.30 +57 -15 jakarta-gump/python/gump/logic.py
Index: logic.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/logic.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- logic.py 17 Oct 2003 23:13:26 -0000 1.29
+++ logic.py 18 Oct 2003 22:20:27 -0000 1.30
@@ -247,6 +247,10 @@
# The ant build file (or none == build.xml)
buildfile = ant.buildfile or ''
+ # Optional 'verbose' or 'debug'
+ verbose=ant.verbose
+ debug=ant.debug
+
#
# Where to run this:
#
@@ -276,8 +280,10 @@
#
# Allow ant-level debugging...
#
- if context.debug:
+ if context.debug or debug:
cmd.addParameter('-debug')
+ if context.verbose or verbose:
+ cmd.addParameter('-verbose')
#
# This sets the *defaults*, a workspace could override them.
@@ -305,12 +311,26 @@
scriptfullname += '.sh'
else:
scriptfullname += '.bat'
-
+
+ # Optional 'verbose' or 'debug'
+ verbose=script.verbose
+ debug=script.debug
+
scriptfile=os.path.normpath(os.path.join(basedir, scriptfullname))
classpath=getClasspath(project,workspace,context)
- return Cmd(scriptfile,'buildscript_'+module.name+'_'+project.name,\
+ cmd=Cmd(scriptfile,'buildscript_'+module.name+'_'+project.name,\
basedir,{'CLASSPATH':classpath})
+
+ #
+ # Allow ant-level debugging...
+ #
+ if context.debug or debug:
+ cmd.addParameter('-debug')
+ if context.verbose or verbose:
+ cmd.addParameter('-verbose')
+
+ return cmd
#
# An annotated path has a path entry, plus the context
@@ -330,13 +350,21 @@
def __str__(self):
return self.path
+ # Equal if same string
def __eq__(self,other):
- return self.path == other.path \
- and self.context == other.context
+ if not isinstance(other,AnnotatedPath):
+ otherPath == other
+ else:
+ otherPath == other.path
+ return self.path = otherPath
+ # Equal if same string
def __cmp__(self,other):
- cmp = self.path < other.path
- if not cmp: cmp = self.context < other.context
+ if not isinstance(other,AnnotatedPath):
+ otherPath == other
+ else:
+ otherPath == other.path
+ cmp = self.path < otherPath
return cmp
#
@@ -464,27 +492,41 @@
#
dependStr=''
if inherit:
- if dependStr: dependStr += ','
- dependStr += 'Inherit='+str(inherit)
+ if dependStr: dependStr += ', '
+ dependStr += 'Inherit:'+str(inherit)
if runtime:
- if dependStr: dependStr += ','
- dependStr += ',Runtime'
- if ids: dependStr += ', IDs [' + ' '.join(ids) + ']'
+ if dependStr: dependStr += ', '
+ dependStr += 'Runtime'
+
+ #
+ # No need to show this, will show later
+ #if ids:
+ # if dependStr: dependStr += ', '
+ # dependStr += 'IDs [' + ', '.join(ids) + ']'
#
# Append JARS for this project
# (respect ids)
#
+ projectIds=[]
for jar in project.jar:
+ # Sote for double checking
+ if jar.id: projectIds.append(jar.id)
# If 'all' or in ids list:
if (not ids) or (jar.id in ids):
- if ids: dependStr += 'id = ' + jar.id
+ if ids: dependStr += ' Id = ' + jar.id
path=AnnotatedPath(jar.path,pctxt,parentctxt,dependStr)
if not path in classpath:
classpath.append(path)
- # :TODO: List all jar ids and check ones we asked for exists
- # and log if not as warning
+ #
+ # Double check
+ #
+ if ids:
+ for id in ids:
+ if not id in projectIds:
+ parentctxt.addWarning("Invalid ID [" + id \
+ + "] for dependency on [" + projectname + "]")
#
# Deep copy all/hard (or those for runtime)
1.84 +42 -19 jakarta-gump/python/gump/document.py
Index: document.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/document.py,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- document.py 18 Oct 2003 16:34:27 -0000 1.83
+++ document.py 18 Oct 2003 22:20:27 -0000 1.84
@@ -776,29 +776,19 @@
x.write(' </table>\n')
#
- # Do a tail on work that failed...
+ # Do a tail on all work that failed...
#
- shown=0
for work in worklist:
if isinstance(work,CommandWorkItem):
if not STATUS_SUCCESS == work.status:
tail=work.tail()
if tail:
#
- # Write the header once only...
- #
- if not shown:
- shown=1
- x.write(' <table>\n')
-
- #
# Write out the 'tail'
#
- x.write('<tr><td><strong>Name:</strong> %s</td></tr><tr><td>%s</td></tr>' %
- ( workTypeName(work.type), escapse(tail) ) )
-
- if shown:
- x.write(' </table>\n')
+ startSectionXDoc(x,workTypeName(work.type))
+ sourceXDoc(x,tail)
+ endSectionXDoc(x)
endSectionXDoc(x)
@@ -830,8 +820,14 @@
endListXDoc(x)
endSectionXDoc(x)
+ #
+ # Show parameters
+ #
if work.command.params:
- startSectionXDoc(x,'Parameter')
+ title='Parameter'
+ if len(work.command.params) > 1:
+ title += 's'
+ startSectionXDoc(x,title)
x.write('<table><tr><th>Prefix</th><th>Name</th><th>Value</th></tr>')
for param in work.command.params.items():
x.write('<tr><td>')
@@ -848,7 +844,10 @@
x.write('</td></tr>\n')
x.write('</table>\n')
endSectionXDoc(x)
-
+
+ #
+ # Show ENV overrides
+ #
if work.command.env:
startSectionXDoc(x,'Environment Overrides')
x.write('<table><tr><th>Name</th><th>Value</th></tr>')
@@ -859,7 +858,7 @@
if value:
# :TODO: Hack for CLASSPATH
if name == "CLASSPATH":
- value=': '.join(value.split(':'))
+ value=':\n'.join(value.split(':'))
x.write(escape(value))
else:
x.write('N/A')
@@ -867,10 +866,34 @@
x.write('</table>\n')
endSectionXDoc(x)
+ #
+ # Wrap the command line..
+ #
+ parts=work.command.formatCommandLine().split(' ')
+ line=''
+ commandLine=''
+ for part in parts:
+ if (len(line) + len(part)) > 80
+ commandLine += line
+ commandLine += '\n '
+ line=part
+ else:
+ if line: line+=' '
+ line+=part
+ if line:
+ commandLine += '\n '
+ commandLine += line
+
+ #
+ # Show the wrapped command line
+ #
startSectionXDoc(x,'Command Line')
- sourceXDoc(x,'\t\n'.join(work.command.formatCommandLine().split(' ')))
+ sourceXDoc(x,commandLine)
endSectionXDoc(x)
+ #
+ # Show the content...
+ #
startSectionXDoc(x,'Output')
output=work.result.output
x.write('<source>')
@@ -1409,7 +1432,7 @@
def sourceXDoc(f,text):
f.write('<source>\n')
- f.write(text)
+ f.write(escape(text))
f.write('</source>\n')