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 2004/06/17 21:23:27 UTC
cvs commit: gump/python/gump/model misc.py
ajack 2004/06/17 12:23:27
Modified: python/gump/document/xdocs Tag: CleanUp xdoc.py
documenter.py
python/gump/document/text Tag: CleanUp documenter.py
python/gump/core Tag: CleanUp gumprun.py
python/gump/syndication Tag: CleanUp atom.py
template/forrest/content/xdocs Tag: CleanUp site.xml
python/gump/model Tag: CleanUp misc.py
Log:
Attempted Optimizations...
Revision Changes Path
No revision
No revision
1.2.2.7 +21 -11 gump/python/gump/document/xdocs/xdoc.py
Index: xdoc.py
===================================================================
RCS file: /home/cvs/gump/python/gump/document/xdocs/xdoc.py,v
retrieving revision 1.2.2.6
retrieving revision 1.2.2.7
diff -u -r1.2.2.6 -r1.2.2.7
--- xdoc.py 16 Jun 2004 23:38:31 -0000 1.2.2.6
+++ xdoc.py 17 Jun 2004 19:23:26 -0000 1.2.2.7
@@ -64,7 +64,7 @@
if stream:
self.stream=stream
else:
- # log.debug('Create transient stream ['+`self.depth`+']...')
+ log.debug('Create transient stream ['+`self.depth`+']...')
self.stream=StringIO.StringIO()
def __del__(self):
@@ -73,12 +73,12 @@
def createSubContext(self,transient=False):
if not transient:
- sub = XDocContext(self.stream,self.pretty,self.depth+1)
- else:
- if not isinstance(transient,int):
- raise RuntimeError, 'Create transient w/ non-int flag ['+`transient`+']'
+ # sub = XDocContext(self.stream,self.pretty,self.depth+1)
+ # Allow sharing
+ sub = self
+ else:
sub = XDocContext(None,self.pretty,self.depth+1)
- sub.setOwner(self)
+ sub.setOwner(self)
return sub
def performIO(self,stuff):
@@ -159,9 +159,15 @@
Ownable.__init__(self)
if not context:
context=XDocContext()
+
+ # Stream context...
self.context=context
- self.subpieces=[]
+
+ #
+ self.subpieces=None
+
self.style=style
+
self.keeper=True
self.emptyOk=False
@@ -186,6 +192,9 @@
#
# Store it for later
#
+ if not self.subpieces:
+ self.subpieces=[]
+
self.subpieces.append(piece)
# Capture Ownership
@@ -194,9 +203,11 @@
return piece
def serialize(self):
- self.callStart()
- self.middle()
- self.callEnd()
+
+ if self.isKeeper():
+ self.callStart()
+ self.middle()
+ self.callEnd()
def callStart(self,piece=None):
if not piece: piece = self
@@ -282,7 +293,6 @@
self.context.writeLineIndented('<section><title>%s</title>' % (self.title))
else:
self.context.writeLineIndented('<h3>%s</h3>' % (self.title))
-
def end(self):
if not self.config.isXhtml():
1.9.2.13 +48 -110 gump/python/gump/document/xdocs/documenter.py
Index: documenter.py
===================================================================
RCS file: /home/cvs/gump/python/gump/document/xdocs/documenter.py,v
retrieving revision 1.9.2.12
retrieving revision 1.9.2.13
diff -u -r1.9.2.12 -r1.9.2.13
--- documenter.py 17 Jun 2004 05:03:08 -0000 1.9.2.12
+++ documenter.py 17 Jun 2004 19:23:26 -0000 1.9.2.13
@@ -81,16 +81,20 @@
def processModule(self,module):
verbose=self.run.getOptions().isVerbose()
debug=self.run.getOptions().isDebug()
- self.documentModule(module,True)
- self.documentBuildLog(True)
+ self.documentModule(module,True)
self.syncObject(module)
def processProject(self,project):
verbose=self.run.getOptions().isVerbose()
debug=self.run.getOptions().isDebug()
- self.documentProject(project,True)
- self.documentBuildLog(True)
+ self.documentProject(project,True)
+
self.syncObject(project)
+
+ # Do once every 5...
+ if 0 == (project.getPositionIndex() % 5):
+ self.documentBuildLog(True)
+ self.syncBuildLog()
def documentRun(self):
@@ -189,28 +193,34 @@
success=True
try:
# Sync over public pages...
- syncDirectories(workContents,logContents)
-
+ syncDirectories(workContents,logContents)
except:
log.error('--- Failed to sync work->log ', exc_info=1)
success=False
- if success:
- logSpec=self.resolver.getFileSpec(self.workspace, 'buildLog')
-
- # Current status
- logSource=os.path.abspath(
- os.path.join(xdocWorkDir,logSpec.getDocument()))
- logTarget=os.path.abspath(
- os.path.join(logDirectory,logSpec.getDocument()))
+ return success
+
+ def syncBuildLog(self):
+
+ logSpec=self.resolver.getFileSpec(self.workspace, 'buildLog')
+
+ xdocWorkDir=self.getXDocWorkDirectory()
+ logDirectory=self.workspace.getLogDirectory()
+
+ # Current status
+ logSource=os.path.abspath(
+ os.path.join(xdocWorkDir,logSpec.getDocument()))
+ logTarget=os.path.abspath(
+ os.path.join(logDirectory,logSpec.getDocument()))
- # Do the transfer..
- try:
- log.debug('Copy %s to %s' % ( logSource, logTarget))
- copyfile(logSource,logTarget)
- except:
- log.error('--- Failed to sync buildLog work->log', exc_info=1)
- success=False
+ # Do the transfer..
+ success=True
+ try:
+ log.debug('Copy %s to %s' % ( logSource, logTarget))
+ copyfile(logSource,logTarget)
+ except:
+ log.error('--- Failed to sync buildLog work->log', exc_info=1)
+ success=False
return success
@@ -440,8 +450,7 @@
self.documentTracker(tracker)
# Document individual modules
- for module in self.workspace.getModules():
- if not self.gumpSet.inModuleSequence(module): continue
+ for module in self.gumpSet.getCompletedModules():
self.documentModule(module)
# Document workspace 'Text'
@@ -820,8 +829,7 @@
"""This page displays entities with errors and/or warning annotations.""")
ncount=0
- for module in self.gumpSet.getModuleSequence():
- if not self.gumpSet.inModuleSequence(module): continue
+ for module in self.gumpSet.getCompletedModules():
moduleSection=None
@@ -872,8 +880,7 @@
"""This page displays entities with different states on different servers.""")
dcount=0
- for module in self.gumpSet.getModuleSequence():
- if not self.gumpSet.inModuleSequence(module): continue
+ for module in self.gumpSet.getCompletedModules():
moduleSection=None
if module.hasServerResults() \
@@ -912,38 +919,7 @@
def documentProjects(self):
sortedProjectList=createOrderedList(self.gumpSet.getProjectSequence())
-
- #
- # ----------------------------------------------------------------------
- #
- # projects.xml -- Projects in aphanumeric order
- #
- spec=self.resolver.getFileSpec(self.workspace, 'projects')
- document=XDocDocument('All Projects',
- spec.getFile() ,
- self.config,
- spec.getRootPath())
- self.documentSummary(document, self.workspace.getProjectSummary())
-
- projectsSection=document.createSection('Projects')
- projectsTable=projectsSection.createTable(['Name','Project State','Elapsed Time','FOG Factor'])
- pcount=0
- for project in sortedProjectList:
- if not self.gumpSet.inProjectSequence(project): continue
-
- pcount+=1
-
- projectRow=projectsTable.createRow()
- projectRow.createComment(project.getName())
- self.insertLink(project,self.workspace,projectRow.createData())
- self.insertStateIcon(project,self.workspace,projectRow.createData())
- projectRow.createData(secsToElapsedTimeString(project.getElapsedSecs()))
-
- projectRow.createData('%02.2f' % project.getFOGFactor())
-
- if not pcount: projectsTable.createLine('None')
- document.serialize()
-
+
#
# ----------------------------------------------------------------------
#
@@ -1059,9 +1035,7 @@
document.serialize()
- def documentModules(self):
-
- sortedModuleList=createOrderedList(self.gumpSet.getModuleSequence())
+ def documentModules(self):
#
# ----------------------------------------------------------------------
@@ -1082,8 +1056,7 @@
'Project State(s)','Elapsed'])
mcount=0
- for module in sortedModuleList:
- if not self.gumpSet.inModuleSequence(module): continue
+ for module in self.gumpSet.getCompletedModules():
#
# Determine if there are todos, otherwise continue
@@ -1148,8 +1121,7 @@
'Project State(s)','Elapsed'])
mcount=0
- for module in sortedModuleList:
- if not self.gumpSet.inModuleSequence(module): continue
+ for module in self.gumpSet.getCompletedModules():
#
# Determine if there are mcount, otherwise continue
@@ -1188,40 +1160,7 @@
if not mcount: modulesTable.createLine('None')
document.serialize()
-
- #
- # ----------------------------------------------------------------------
- #
- # Modules.xml
- #
- spec=self.resolver.getFileSpec(self.workspace, 'modules')
- document=XDocDocument( 'All Modules',
- spec.getFile() ,
- self.config,
- spec.getRootPath())
-
- modulesSection=document.createSection('All Modules')
- modulesTable=modulesSection.createTable(['Name','Module State','Project State(s)','Elapsed','FOG Factor'])
-
- mcount=0
- for module in sortedModuleList:
- if not self.gumpSet.inModuleSequence(module): continue
-
- mcount+=1
-
- moduleRow=modulesTable.createRow()
- moduleRow.createComment(module.getName())
-
- self.insertLink( module, self.workspace, moduleRow.createData())
- self.insertStateIcon(module,self.workspace,moduleRow.createData())
- self.insertStateIcons(module,self.workspace,moduleRow.createData())
-
- moduleRow.createData(secsToElapsedTimeString(module.getElapsedSecs()))
- moduleRow.createData('%02.2f' % module.getFOGFactor())
-
- if not mcount: modulesTable.createLine('None')
-
- document.serialize()
+
def documentPackages(self):
@@ -1239,8 +1178,7 @@
mpkgSection=document.createSection('Packaged Modules')
mpkgTable=mpkgSection.createTable(['Name','State','Project State(s)'])
mcount=0
- for module in self.gumpSet.getModuleSequence():
- if not self.gumpSet.inModuleSequence(module): continue
+ for module in self.gumpSet.getCompletedModules():
packaged=0
#
@@ -1487,7 +1425,7 @@
document.serialize()
- def documentModule(self,module,realtime=0):
+ def documentModule(self,module,realTime=False):
spec=self.resolver.getFileSpec(module)
document=XDocDocument( 'Module : ' + module.getName(),
@@ -1534,7 +1472,7 @@
self.documentAnnotations(document,module)
self.documentServerLinks(document,module)
- if not realtime:
+ if not realTime:
projectsSection=document.createSection('Projects')
if (len(module.getProjects()) > 1):
self.documentSummary(projectsSection,module.getProjectSummary())
@@ -1641,7 +1579,7 @@
document.serialize()
document=None
- if not realtime:
+ if not realTime:
# Document Projects
for project in module.getProjects():
if not self.run.getGumpSet().inProjectSequence(project): continue
@@ -1658,7 +1596,7 @@
# footerXDoc(x)
# endXDoc(x)
- def documentProject(self,project,realtime=0):
+ def documentProject(self,project,realTime=0):
spec=self.resolver.getFileSpec(project)
document=XDocDocument('Project : ' + project.getName(),
@@ -1802,9 +1740,9 @@
document.serialize()
- self.documentProjectDetails(project,realtime)
+ self.documentProjectDetails(project,realTime)
- def documentProjectDetails(self,project,realtime=0):
+ def documentProjectDetails(self,project,realTime=0):
spec=self.resolver.getFileSpec(project,'details')
document=XDocDocument('Project Details : ' + project.getName(),
@@ -1880,7 +1818,7 @@
depees += self.documentDependenciesList(dependencySection, 'Project Dependees', \
project.getDirectDependees(), 1, 0, project)
- if not realtime and project.isVerboseOrDebug():
+ if not realTime and project.isVerboseOrDebug():
self.documentDependenciesList(dependencySection, 'Full Project Dependencies', \
project.getFullDependencies(), 0, 1, project)
@@ -1893,7 +1831,7 @@
dependencySection.createNote( \
"""This project depends upon no others, and no others depend upon it. This project is an island...""")
else:
- if realtime and not depees:
+ if realTime and not depees:
dependencySection.createNote('No projects depend upon this project.')
if not depens:
dependencySection.createNote('This project depends upon no others.')
No revision
No revision
1.6.2.1 +0 -1 gump/python/gump/document/text/documenter.py
Index: documenter.py
===================================================================
RCS file: /home/cvs/gump/python/gump/document/text/documenter.py,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- documenter.py 21 May 2004 23:15:07 -0000 1.6
+++ documenter.py 17 Jun 2004 19:23:26 -0000 1.6.2.1
@@ -47,7 +47,6 @@
self.output=output
self.setResolver(TextResolver(dirBase,urlBase))
-
def processModule(self,module):
verbose=self.run.getOptions().isVerbose()
debug=self.run.getOptions().isDebug()
No revision
No revision
1.9.2.6 +6 -0 gump/python/gump/core/gumprun.py
Index: gumprun.py
===================================================================
RCS file: /home/cvs/gump/python/gump/core/gumprun.py,v
retrieving revision 1.9.2.5
retrieving revision 1.9.2.6
diff -u -r1.9.2.5 -r1.9.2.6
--- gumprun.py 17 Jun 2004 02:35:44 -0000 1.9.2.5
+++ gumprun.py 17 Jun 2004 19:23:26 -0000 1.9.2.6
@@ -152,6 +152,9 @@
self.completedModules.append(module)
def inModuleSequence(self,module):
+ # Optimization
+ if self.isFull(): return True
+ # Go look
return module in self.moduleSequence
def getRepositories(self):
@@ -180,6 +183,9 @@
return self.projectSequence
def inProjectSequence(self,project):
+ # Optimization
+ if self.isFull(): return True
+ # Go look...
return project in self.projectSequence
def getModuleNamesForProjectExpression(self,expr):
No revision
No revision
1.17.2.2 +2 -2 gump/python/gump/syndication/atom.py
Index: atom.py
===================================================================
RCS file: /home/cvs/gump/python/gump/syndication/atom.py,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -u -r1.17.2.1 -r1.17.2.2
--- atom.py 16 Jun 2004 17:50:39 -0000 1.17.2.1
+++ atom.py 17 Jun 2004 19:23:26 -0000 1.17.2.2
@@ -158,7 +158,7 @@
'module', \
'Gump : Module ' + escape(module.getName()), \
moduleUrl, \
- escape(module.getDescription()))
+ escape(module.getDescription() or ''))
#
@@ -202,7 +202,7 @@
'project', \
'Gump : Project ' + escape(project.getName()), \
projectUrl, \
- escape(project.getDescription()))
+ escape(project.getDescription() or ''))
#
# Get a decent description
No revision
No revision
1.4.2.1 +1 -3 gump/template/forrest/content/xdocs/site.xml
Index: site.xml
===================================================================
RCS file: /home/cvs/gump/template/forrest/content/xdocs/site.xml,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- site.xml 21 May 2004 23:15:09 -0000 1.4
+++ site.xml 17 Jun 2004 19:23:27 -0000 1.4.2.1
@@ -21,13 +21,11 @@
<work label="Projects" tab="home">
<index label="Issues" href="project_todos.html"/>
<index label="Fixes" href="project_fixes.html"/>
- <index label="All" href="projects.html"/>
</work>
<work label="Modules" tab="home">
<index label="Issues" href="module_todos.html"/>
- <index label="Fixes" href="module_fixes.html"/>
- <index label="All" href="modules.html"/>
+ <index label="Fixes" href="module_fixes.html"/>
</work>
<work label="Misc" tab="home">
No revision
No revision
1.1.2.2 +3 -0 gump/python/gump/model/Attic/misc.py
Index: misc.py
===================================================================
RCS file: /home/cvs/gump/python/gump/model/Attic/misc.py,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- misc.py 11 Jun 2004 17:09:50 -0000 1.1.2.1
+++ misc.py 17 Jun 2004 19:23:27 -0000 1.1.2.2
@@ -46,6 +46,9 @@
return (self.posn,self.total)
if -1 != self.posn:
return self.posn
+
+ def getPositionIndex(self):
+ return self.posn
class Resultable:
def __init__(self):
---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org