ajack 2004/03/11 18:50:53 Modified: python/gump/document forrest.py resolver.py xdoc.py python/gump/utils launcher.py __init__.py python/gump/test pyunit.py template/forrest/src/documentation skinconf.xml Added: template/forrest/src/documentation/content/images icon.png apache.png gump-logo.png python/gump/test unicode.py Removed: template/forrest/src/documentation/content/gump_images apache.png template/forrest/src/documentation/content/xdocs/images gump-logo.png icon.png apache-jakarta.png Log: Trying to get forrest working again... Revision Changes Path 1.100 +44 -22 gump/python/gump/document/forrest.py Index: forrest.py =================================================================== RCS file: /home/cvs/gump/python/gump/document/forrest.py,v retrieving revision 1.99 retrieving revision 1.100 diff -u -r1.99 -r1.100 --- forrest.py 11 Mar 2004 16:13:50 -0000 1.99 +++ forrest.py 12 Mar 2004 02:50:52 -0000 1.100 @@ -67,6 +67,7 @@ import os import sys import logging +import shutil from string import lower,replace from xml.sax.saxutils import escape @@ -111,8 +112,9 @@ gumpSet=run.getGumpSet() # Seed with default/site skins/etc. - self.seedForrest(workspace) + self.prepareForrest(workspace) + # Document... self.documentWorkspace(run,workspace,gumpSet) if gumpSet.isFull(): self.documentStatistics(run,workspace,gumpSet) @@ -139,24 +141,31 @@ fdir=os.path.abspath(os.path.join(dir.template,'site-forrest')) return fdir - def seedForrest(self,workspace): + def prepareForrest(self,workspace): """ - Copy the main template (perhaps with site tweaks) to seed + Copy the main template (perhaps with site tweaks) to prepare """ - + # + # First deleted the tree (if exists), then ensure created + # + forrestDir=self.getForrestDirectory(workspace) + if os.path.exists(forrestDir): + shutil.rmtree(forrestDir) + os.makedirs(forrestDir) + # Copy in the defaults forrestTemplate=self.getForrestTemplateDirectory() syncDirectories( forrestTemplate, \ - self.getForrestDirectory(workspace), \ + forrestDir, \ workspace) # Copy over the local site defaults (if any) forrestSiteTemplate=self.getForrestSiteTemplateDirectory() if os.path.exists(forrestSiteTemplate): copyDirectories(forrestSiteTemplate, \ - self.getForrestDirectory(workspace), \ + forrestDir, \ workspace) def executeForrest(self,workspace): @@ -164,6 +173,14 @@ xdocs=self.resolver.getDirectory(workspace) forrestDir=self.getForrestDirectory(workspace) + # + # First deleted the tree (if exists), then ensure created + # + logDirectory=workspace.getLogDirectory() + if os.path.exists(logDirectory): + shutil.rmtree(logDirectory) + os.makedirs(logDirectory) + # Then generate... forrest=Cmd('forrest','forrest',forrestDir) @@ -174,7 +191,7 @@ # xdocs, '=') forrest.addPrefixedParameter('-D','project.site-dir', \ - workspace.getLogDirectory(), '=') + logDirectory, '=') # # Do we just tweak forrest.properties? @@ -1213,17 +1230,17 @@ depees = 0 depens += self.documentDependenciesList(dependencySection, "Project Dependencies", \ - project.getDirectDependencies(), 0, project) + project.getDirectDependencies(), 0, 0, project) depees += self.documentDependenciesList(dependencySection, "Project Dependees", \ - project.getDirectDependees(), 1, project) + project.getDirectDependees(), 1, 0, project) if project.isVerboseOrDebug(): self.documentDependenciesList(dependencySection, "Full Project Dependencies", \ - project.getFullDependencies(), 0, project) + project.getFullDependencies(), 0, 1, project) self.documentDependenciesList(dependencySection, "Full Project Dependees", \ - project.getFullDependees(), 1, project) + project.getFullDependees(), 1, 1, project) deps = depees + depens @@ -1292,12 +1309,16 @@ if not paths: pathTable.createLine('No ' + title + ' entries') - def documentDependenciesList(self,xdocNode,title,dependencies,dependees,referencingObject): + def documentDependenciesList(self,xdocNode,title,dependencies,dependees,full,referencingObject): totalDeps=0 if dependencies: dependencySection=xdocNode.createSection(title) - dependencyTable=dependencySection.createTable(['Name','Type','Inheritence','Ids','State','Contributor','Notes']) + titles=['Name','Type','Inheritence','Ids','State'] + if full: + titles.append('Contributor') + titles.append('Notes') + dependencyTable=dependencySection.createTable(titles) for depend in dependencies: totalDeps += 1 @@ -1331,12 +1352,13 @@ # State Icon self.insertStateIcon(project,referencingObject,dependencyRow.createData()) - # Contributor - if not dependees: - contributor=depend.getOwnerProject() - else: - contributor=depend.getProject() - self.insertLink( contributor, referencingObject, dependencyRow.createData()) + if full: + # Contributor + if not dependees: + contributor=depend.getOwnerProject() + else: + contributor=depend.getProject() + self.insertLink( contributor, referencingObject, dependencyRow.createData()) # Dependency Annotations noteData=dependencyRow.createData() 1.17 +4 -4 gump/python/gump/document/resolver.py Index: resolver.py =================================================================== RCS file: /home/cvs/gump/python/gump/document/resolver.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- resolver.py 9 Mar 2004 23:20:32 -0000 1.16 +++ resolver.py 12 Mar 2004 02:50:52 -0000 1.17 @@ -425,4 +425,4 @@ return (url, description) def getImageUrl(self,name): - return self.getAbsoluteUrlForRelative('gump_images/'+name) \ No newline at end of file + return self.getAbsoluteUrlForRelative('images/'+name) \ No newline at end of file 1.17 +32 -8 gump/python/gump/document/xdoc.py Index: xdoc.py =================================================================== RCS file: /home/cvs/gump/python/gump/document/xdoc.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- xdoc.py 5 Mar 2004 23:42:22 -0000 1.16 +++ xdoc.py 12 Mar 2004 02:50:52 -0000 1.17 @@ -67,6 +67,8 @@ import os import sys import logging +import types + from types import NoneType from xml.sax.saxutils import escape @@ -76,6 +78,23 @@ from gump.utils.xmlutils import xmlize from gump.utils.owner import * +# +# MAP anything outside 32..128 to _ +# +MAP=[] +UMAP=[] +i=0 +while i<=255: + if i == 10 or i==13 or (i >= 32 and i < 128): + MAP.append(chr(i)) + UMAP.append(unicode(chr(i))) + else: + MAP.append(chr(95)) + UMAP.append(unicode(chr(95))) + i+=1 +STRING_MAP_TABLE=''.join(MAP) +UNICODE_MAP_TABLE=unicode('').join(UMAP) + class XDocContext(Ownable): def __init__(self,stream=None,pretty=1,depth=0): @@ -129,20 +148,20 @@ def writeRawLineIndented(self,raw): if self.pretty: self.performIO(getIndent(self.depth)) - self.performIO(escape(raw)) + self.performIO(self.map(raw)) self.performIO('\n') - def writeRawLine(self,raw): - self.performIO(escape(raw)) + def writeRawLine(self,raw): + self.performIO(self.map(raw)) self.performIO('\n') def writeRawIndented(self,raw): if self.pretty: self.performIO(getIndent(self.depth)) - self.performIO(escape(raw)) + self.performIO(self.map(raw)) def writeRaw(self,raw): - self.performIO(escape(raw)) + self.performIO(self.map(raw)) def isTransient(self): return isinstance(self.stream,StringIO.StringIO) @@ -170,6 +189,11 @@ self.stream.close() except: pass + def map(self,raw): + if isinstance(raw,types.UnicodeType): + return escape(raw.translate(UNICODE_MAP_TABLE)) + return escape(raw.translate(STRING_MAP_TABLE)) + class XDocPiece(Ownable): def __init__(self,context=XDocContext()): Ownable.__init__(self) 1.15 +24 -14 gump/python/gump/utils/launcher.py Index: launcher.py =================================================================== RCS file: /home/cvs/gump/python/gump/utils/launcher.py,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- launcher.py 11 Mar 2004 16:13:50 -0000 1.14 +++ launcher.py 12 Mar 2004 02:50:52 -0000 1.15 @@ -332,24 +332,34 @@ gumpid=default.gumpid log.warn('Kill all child processed (anything launched by Gumpy) [PID' + str(gumpid) + ']') pidsFile = dir.tmp + '/childPIDs.txt' + + # + # :TODO: + # This sucks, we need to get to *ALL* children, not + # just direct children. + # command='pgrep -P ' + str(gumpid) + ' -l > ' + pidsFile os.system(command) ids=None try: - ids=open(pidsFile,'r') + try: + ids=open(pidsFile,'r') - line=ids.readline() - while line: - parts=line.split() - childPID=int(parts[0]) - process=parts[1] - if not process=='python': - log.warn('Terminate PID [' + str(childPID) + '] Process: [' + process + ']') - os.kill(childPID,signal.SIGKILL) - - # Get next PID/process combination line=ids.readline() + while line: + parts=line.split() + childPID=int(parts[0]) + process=parts[1] + if not process=='python': + log.warn('Terminate PID [' + str(childPID) + '] Process: [' + process + ']') + os.kill(childPID,signal.SIGKILL) + + # Get next PID/process combination + line=ids.readline() + except Exception, details: + log.error('Failed to dispatch signal ' + str(details), exc_info=1) + finally: if ids: ids.close() 1.25 +43 -39 gump/python/gump/utils/__init__.py Index: __init__.py =================================================================== RCS file: /home/cvs/gump/python/gump/utils/__init__.py,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- __init__.py 24 Feb 2004 20:18:29 -0000 1.24 +++ __init__.py 12 Mar 2004 02:50:52 -0000 1.25 @@ -364,45 +364,49 @@ s = s[:-1] return s -def logResourceUtilization(message=None,): - try: - import resource - - if not message: - message='' - - myresources=resource.getrusage(resource.RUSAGE_SELF) - - # Extract the pieces - (my_ru_utime, my_ru_stime, my_ru_maxrss, \ - my_ru_ixrss, my_ru_idrss, my_ru_isrss, \ - my_ru_minflt, my_ru_majflt, my_ru_nswap, \ - my_ru_inblock, my_ru_oublock, my_ru_msgsnd, \ - my_ru_msgrcv, my_ru_nsignals, my_ru_nvcsw, \ - my_ru_nivcsw)=myresources - - kidresources=resource.getrusage(resource.RUSAGE_CHILDREN) - - # Extract the pieces - (kid_ru_utime, kid_ru_stime, kid_ru_maxrss, \ - kid_ru_ixrss, kid_ru_idrss, kid_ru_isrss, \ - kid_ru_minflt, kid_ru_majflt, kid_ru_nswap, \ - kid_ru_inblock, kid_ru_oublock, kid_ru_msgsnd, \ - kid_ru_msgrcv, kid_ru_nsignals, kid_ru_nvcsw, \ - kid_ru_nivcsw)=kidresources - - log.debug('My Memory ' + message + ' ' + `my_ru_maxrss`) - log.debug('My Resources ' + message + ' ' + `myresources`) - log.debug('Child Memory ' + message + ' ' + `kid_ru_maxrss`) - log.debug('Child Resources ' + message + ' ' + `kidresources`) - +def logResourceUtilization(message=None): pass + +# This doesn't appear fully implemented in Python (2.2/2.3) so +# is simply a waste of cycles to call/display + +# try: + #import resource + # + #if not message: + # message='' + # + #myresources=resource.getrusage(resource.RUSAGE_SELF) + # + ## Extract the pieces + #(my_ru_utime, my_ru_stime, my_ru_maxrss, \ + # my_ru_ixrss, my_ru_idrss, my_ru_isrss, \ + # my_ru_minflt, my_ru_majflt, my_ru_nswap, \ + # my_ru_inblock, my_ru_oublock, my_ru_msgsnd, \ + # my_ru_msgrcv, my_ru_nsignals, my_ru_nvcsw, \ + # my_ru_nivcsw)=myresources +# +# kidresources=resource.getrusage(resource.RUSAGE_CHILDREN) +# +# # Extract the pieces +# (kid_ru_utime, kid_ru_stime, kid_ru_maxrss, \ +# kid_ru_ixrss, kid_ru_idrss, kid_ru_isrss, \ +# kid_ru_minflt, kid_ru_majflt, kid_ru_nswap, \ +# kid_ru_inblock, kid_ru_oublock, kid_ru_msgsnd, \ +# kid_ru_msgrcv, kid_ru_nsignals, kid_ru_nvcsw, \ +# kid_ru_nivcsw)=kidresources +# +# log.debug('My Memory ' + message + ' ' + `my_ru_maxrss`) +# log.debug('My Resources ' + message + ' ' + `myresources`) +# log.debug('Child Memory ' + message + ' ' + `kid_ru_maxrss`) +# log.debug('Child Resources ' + message + ' ' + `kidresources`) +# #resources=resource.getrusage(resource.RUSAGE_BOTH) #log.debug('All Resources ' + message + ' ' + `resources`) - except Exception, details: - if not os.name == 'dos' and not os.name == 'nt': - log.error("Failed get resource utilization." \ - + " : " + str(details), exc_info=1) +# except Exception, details: +# if not os.name == 'dos' and not os.name == 'nt': +# log.error("Failed get resource utilization." \ +# + " : " + str(details), exc_info=1) if __name__=='__main__': 1.1 gump/template/forrest/src/documentation/content/images/icon.png <<Binary file>> 1.1 gump/template/forrest/src/documentation/content/images/apache.png <<Binary file>> 1.1 gump/template/forrest/src/documentation/content/images/gump-logo.png <<Binary file>> 1.23 +6 -3 gump/python/gump/test/pyunit.py Index: pyunit.py =================================================================== RCS file: /home/cvs/gump/python/gump/test/pyunit.py,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- pyunit.py 4 Mar 2004 21:38:47 -0000 1.22 +++ pyunit.py 12 Mar 2004 02:50:52 -0000 1.23 @@ -373,6 +373,9 @@ from gump.test.resulting import ResultingTestSuite runner.addSuite(ResultingTestSuite()) + from gump.test.unicode import UnicodeTestSuite + runner.addSuite(UnicodeTestSuite()) + # Any args are pattern matches patterns=list(sys.argv) del patterns[0:1] 1.1 gump/python/gump/test/unicode.py Index: unicode.py =================================================================== #!/usr/bin/env python
# $Header: 1.7 2003/05/10 18:20:36 nicolaken Exp $ # $Revision: 1.7 $ # $Date: 2003/05/10 18:20:36 $ # # ==================================================================== # # The Apache Software License, Version 1.1 # # Copyright (c) 2003 The Apache Software Foundation. All rights # reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # # 3. The end-user documentation included with the redistribution, if # any, must include the following acknowlegement: # "This product includes software developed by the # Apache Software Foundation (http://www.apache.org/)." # Alternately, this acknowlegement may appear in the software itself, # if and wherever such third-party acknowlegements normally appear. # # 4. The names "The Jakarta Project", "Alexandria", and "Apache Software # Foundation" must not be used to endorse or promote products derived # from this software without prior written permission. For written # permission, please contact [EMAIL PROTECTED] # # 5. Products derived from this software may not be called "Apache" # nor may "Apache" appear in their names without prior written # permission of the Apache Group. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR # ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # ==================================================================== # # This software consists of voluntary contributions made by many # individuals on behalf of the Apache Software Foundation. For more # information on the Apache Software Foundation, please see # <http://www.apache.org/>. """ Model Testing """ import os import logging import types, StringIO from xml.sax.saxutils import escape from gump import log from gump.test.pyunit import UnitTestSuite import xml.dom.minidom class UnicodeTestSuite(UnitTestSuite): def __init__(self): UnitTestSuite.__init__(self) def setUp(self): self.map=[] i=0 while i<32: self.map.append(chr(95)) i+=1 while i<128: self.map.append(chr(i)) i+=1 while i<=255: self.map.append(chr(95)) i+=1 self.maps=''.join(self.map) def testUnicodeSerialization(self): data='' i=0 while i < 128: data+=chr(i) i+=1 edata=data.translate(self.maps) xmld='<xml>'+escape(edata)+'</xml>' print xmld dom=xml.dom.minidom.parseString(xmld) 1.7 +2 -2 gump/template/forrest/src/documentation/skinconf.xml Index: skinconf.xml =================================================================== RCS file: /home/cvs/gump/template/forrest/src/documentation/skinconf.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- skinconf.xml 29 Feb 2004 19:16:19 -0000 1.6 +++ skinconf.xml 12 Mar 2004 02:50:52 -0000 1.7 @@ -90,8 +90,8 @@ want these, set the attributes to blank. The DTD purposefully requires them. --> <trail> - <link1 name="Jakarta" href="http://jakarta.apache.org/"/> - <link2 name="Jakarta Gump" href="http://jakarta.apache.org/gump/"/> + <link1 name="Gump" href="http://gump.apache.org/"/> + <link2 name="" href=""/> <link3 name="" href=""/> </trail> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]