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/04/06 19:27:12 UTC

cvs commit: gump/python/gump gumprun.py engine.py

ajack       2004/04/06 10:27:12

  Modified:    python/gump/test/resources/simple2 workspace.xml
               python/gump/test/resources/full1 workspace.xml
               python/gump/test/resources/simple1 standalone_workspace.xml
               python/gump/test documenter.py
               python/gump/document __init__.py
               python/gump/test/resources/circular1 workspace.xml
               python/gump/test/resources/broken1 broken_workspace.xml
               python/gump gumprun.py engine.py
  Added:       python/gump/document template.py
  Log:
  Starting work on a TemplateDocumenter for Nicola.
  Some cleanups (from IM'ing w/ Nicola)
  
  Revision  Changes    Path
  1.3       +1 -1      gump/python/gump/test/resources/simple2/workspace.xml
  
  Index: workspace.xml
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/test/resources/simple2/workspace.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- workspace.xml	17 Feb 2004 21:54:22 -0000	1.2
  +++ workspace.xml	6 Apr 2004 17:27:12 -0000	1.3
  @@ -4,7 +4,7 @@
              jardir="/data/gump/jars/latest"
              logdir="/data/gump/log"
              pkgdir="/data/package"
  -           sync="rsync -r -a --delete" version="0.3">
  +           version="0.4">
   
     <property name="build.sysclasspath" value="only"/>
   
  
  
  
  1.7       +1 -1      gump/python/gump/test/resources/full1/workspace.xml
  
  Index: workspace.xml
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/test/resources/full1/workspace.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- workspace.xml	28 Mar 2004 18:58:05 -0000	1.6
  +++ workspace.xml	6 Apr 2004 17:27:12 -0000	1.7
  @@ -4,7 +4,7 @@
              jardir="./test/gump/jars"
              logdir="./test/gump/log"
              pkgdir="./test/package"
  -           sync="rsync -r -a --delete" version="0.3">
  +           version="0.4">
   
     <property name="build.sysclasspath" value="only"/>
     <sysproperty name="build.clonevm" value="true"/>
  
  
  
  1.3       +1 -1      gump/python/gump/test/resources/simple1/standalone_workspace.xml
  
  Index: standalone_workspace.xml
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/test/resources/simple1/standalone_workspace.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- standalone_workspace.xml	17 Feb 2004 21:54:21 -0000	1.2
  +++ standalone_workspace.xml	6 Apr 2004 17:27:12 -0000	1.3
  @@ -4,7 +4,7 @@
              jardir="/data/gump/jars/latest"
              logdir="/data/gump/log"
              pkgdir="/data/package"
  -           sync="rsync -r -a --delete" version="0.3">
  +           version="0.4">
   
     <property name="build.sysclasspath" value="only"/>
   
  
  
  
  1.4       +7 -0      gump/python/gump/test/documenter.py
  
  Index: documenter.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/test/documenter.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- documenter.py	2 Apr 2004 16:48:06 -0000	1.3
  +++ documenter.py	6 Apr 2004 17:27:12 -0000	1.4
  @@ -25,6 +25,7 @@
   from gump.gumprun import GumpRun
   from gump.document.documenter import Documenter
   from gump.document.text import TextDocumenter
  +from gump.document.template import TemplateDocumenter
   from gump.document.forrest import ForrestDocumenter
   from gump.output.statsdb import *
   from gump.test import getWorkedTestWorkspace
  @@ -45,6 +46,12 @@
       def testText(self):
           out=StringIO.StringIO()
           documenter=TextDocumenter(out)
  +        documenter.document(self.run)
  +        out.close()
  +        
  +    def testTemplate(self):
  +        out=StringIO.StringIO()
  +        documenter=TemplateDocumenter(out)
           documenter.document(self.run)
           out.close()
           
  
  
  
  1.4       +1 -1      gump/python/gump/document/__init__.py
  
  Index: __init__.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/document/__init__.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- __init__.py	5 Apr 2004 13:38:00 -0000	1.3
  +++ __init__.py	6 Apr 2004 17:27:12 -0000	1.4
  @@ -17,4 +17,4 @@
   
   
   # tell Python what modules make up the gump.document package
  -__all__ = ["documenter", "forrest","text"]
  +__all__ = ["documenter","resolver", "forrest","text","template"]
  
  
  
  1.1                  gump/python/gump/document/template.py
  
  Index: template.py
  ===================================================================
  #!/usr/bin/env python
  
  # Copyright 2003-2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  # 
  #     http://www.apache.org/licenses/LICENSE-2.0
  # 
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  
  """
     Text documentation...
     
  """
  
  import socket
  import time
  import os
  import sys
  import logging
  
  from gump import log
  
  from gump.utils.work import *
  
  from gump.model.state import *
  
  from gump.document.documenter import Documenter
  from gump.document.resolver import *
  
  class TemplateDocumenter(Documenter):
      
      def __init__(self,output=sys.stdout, dirBase='.', urlBase='.'):
          Documenter.__init__(self)
          self.output=output
          
          # Hack, ought return a non-hierarchical one
          self.resolver=Resolver(dirBase,urlBase)
          
      def getResolverForRun(self,run):
          return self.resolver
      
      def documentRun(self, run):    
          indent=' '
          
          workspace = run.getWorkspace()
          gumpSet = run.getGumpSet()
          gumpEnv = run.getEnvironment()
          
          #
          #
          #
          quick=run.getOptions().isQuick()
          verbose=run.getOptions().isVerbose()
          debug=run.getOptions().isDebug()
          
          #
          # Where to write this.
          #
          output=self.output
              
          # Pretty sorting...
          sortedModuleList=createOrderedList(gumpSet.getModuleSequence())
          sortedProjectList=createOrderedList(gumpSet.getProjectSequence())
          sortedRepositoryList=createOrderedList(gumpSet.getRepositories())        
          sortedServerList=createOrderedList(workspace.getServers())     
          sortedTrackerList=createOrderedList(workspace.getTrackers())
          
          output.write(indent + "Workspace State : " + workspace.getStateDescription() + "\n")
          output.write(indent + "Workspace Secs : " + str(workspace.getElapsedSecs()) + "\n")
      
          self.documentEnvironment(indent,gumpEnv,debug,verbose)    
      
          output.write(indent + "Modules: " + str(len(workspace.getModules())) + "\n")
      
          self.documentAnnotations(indent,workspace)
          self.documentWork(indent,workspace)
              
          indent += ' '
          for module in sortedModuleList:
              if quick:
                  if not gumpSet.inModules(module): continue       
              else:
                  if not gumpSet.inModuleSequence(module): continue       
              
              output.write(indent + "Module [" + module.getName() + "] State: " + module.getStateDescription() + "\n")
              output.write(indent + "Projects: " + str(len(module.getProjects())) + "\n")
  
              self.documentWork(indent,module)
          
              #
              # Document all the annotations
              #
              self.documentAnnotations(indent,module)
                      
              for project in module.getProjects():                
                  if quick:
                      if not gumpSet.inProjects(project): continue
                  else:
                      if not gumpSet.inProjectSequence(project): continue
              
                  self.documentProject(indent,project,debug,verbose)
                  
      def documentEnvironment(self, indent, environment, debug, verbose):
          indent += ' '
          output=self.output    
          output.write(indent + "Gump Environment\n")
          
          self.documentAnnotations(indent,environment)
          self.documentWork(indent,environment)
                   
      def documentProject(self, indent, project, debug, verbose):
          indent += ' '
          output=self.output    
          output.write(indent + "Project [" + project.getName() 	\
                      + "] State: " + project.getStateDescription() + "\n")
          
          if verbose:
              self.documentDependenciesList(indent, "Project Dependees",		\
                      project.getDirectDependees(), 1, project)
              
              self.documentDependenciesList(indent, "Project Dependencies",	\
                      project.getDirectDependencies(), 0, project)
          
          self.documentAnnotations(indent,project)
          self.documentWork(indent,project)
  
      def documentWork(self, indent, workable):
          
          if not workable or not workable.worklist: return
          
          indent += ' '
          output=self.output    
          output.write(indent+"Work [" + str(len(workable.worklist)) \
                  + "] [" + str(workable.getElapsedSecs()) + "] secs."  + "\n")
      
          for work in workable.worklist:
              output.write(indent+"Work : " + stateDescription(work.state) + "\n")
              if isinstance(work,CommandWorkItem):
                  output.write(indent+"Work Name : " + work.command.name + "\n")
                  output.write(indent+"Work Cmd  : " + work.command.formatCommandLine() + "\n")
                  if work.command.cwd:
                      output.write(indent+"Work Cwd  : " + work.command.cwd + "\n")
                  if work.result.signal:
                      output.write(indent+"Work Signal  : " + `work.result.signal` + "\n")
                  output.write(indent+"Work Exit : " + str(work.result.exit_code) + "\n")
          
  
      def documentAnnotations(self, indent, annotatable): 
          indent += ' '
          output=self.output       
          for note in annotatable.getAnnotations():
              output.write(indent+" - " + str(note) + "\n")
          
          
      def documentDependenciesList(self,indent,title,dependencies,dependees,referencingObject):
        if dependencies:
              indent += ' '    
              output=self.output       
              output.write(indent+title+'\n')            
              indent += ' '    
              for depend in dependencies:
                  
                  # Project/Owner
                  if not dependees:
                      project=depend.getProject()
                  else:
                      project=depend.getOwnerProject()
                  output.write(indent+project.getName())
  
                  # Type
                  type=''
                  if depend.isRuntime():
                      if type: type += ' '    
                      type+='Runtime'              
                  if depend.isOptional():
                      if type: type += ' '
                      type+='Optional'                
                  output.write('   '+type)
                  
                  # Inheritence
                  output.write('   '+depend.getInheritenceDescription())
                  
                  # Ids
                  ids = depend.getIds() or 'All'
                  output.write('   '+ids)
                  
                  # State Icon
                  output.write('   '+referencingObject.getStateDescription()+'\n')
                  
                  self.documentAnnotations(indent,depend)                    
          
  
  
  1.3       +1 -1      gump/python/gump/test/resources/circular1/workspace.xml
  
  Index: workspace.xml
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/test/resources/circular1/workspace.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- workspace.xml	17 Feb 2004 21:54:22 -0000	1.2
  +++ workspace.xml	6 Apr 2004 17:27:12 -0000	1.3
  @@ -3,7 +3,7 @@
   	       basedir="/data/gump" 
              jardir="/data/gump/jars/latest"
              pkgdir="/data/package"
  -           sync="rsync -r -a --delete" version="0.3">
  +           version="0.4">
   
     <property name="build.sysclasspath" value="only"/>
   
  
  
  
  1.3       +1 -1      gump/python/gump/test/resources/broken1/broken_workspace.xml
  
  Index: broken_workspace.xml
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/test/resources/broken1/broken_workspace.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- broken_workspace.xml	17 Feb 2004 21:54:21 -0000	1.2
  +++ broken_workspace.xml	6 Apr 2004 17:27:12 -0000	1.3
  @@ -3,7 +3,7 @@
   	       basedir="/data/gump" 
              jardir="/data/gump/jars/latest"
              pkgdir="/data/package"
  -           sync="rsync -r -a --delete" version="0.3">
  +           version="0.4">
     <property name="build.sysclasspath" value="only"/>
     <profile href="no_such_profile.xml"/>
   </workspace>
  
  
  
  1.19      +9 -0      gump/python/gump/gumprun.py
  
  Index: gumprun.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/gumprun.py,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- gumprun.py	5 Apr 2004 18:21:00 -0000	1.18
  +++ gumprun.py	6 Apr 2004 17:27:12 -0000	1.19
  @@ -356,6 +356,9 @@
           # Default is Text unless Forrest is in the environment,
           # but can also force text with --text 
           self.text=0      
  +        # A new alternative is Template --template
  +        self.template=0      
  +        
           # If using Forrest, this say leave xdocs, do NOT run
           # the 'forrest' build inlined.
           self.xdoc=0
  @@ -391,6 +394,12 @@
           
       def setText(self,text):
           self.text=text
  +        
  +    def isTemplate(self):
  +        return self.template
  +        
  +    def setTemplate(self,template):
  +        self.template=template
           
       def isXDoc(self):
           return self.xdoc
  
  
  
  1.96      +8 -2      gump/python/gump/engine.py
  
  Index: engine.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/engine.py,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- engine.py	31 Mar 2004 17:41:41 -0000	1.95
  +++ engine.py	6 Apr 2004 17:27:12 -0000	1.96
  @@ -44,6 +44,7 @@
   from gump.net.cvs import *
   
   from gump.document.text import TextDocumenter
  +from gump.document.template import TemplateDocumenter
   from gump.document.forrest import ForrestDocumenter
   
   from gump.output.statsdb import *
  @@ -135,8 +136,13 @@
           #
           # Use forrest if available & not overridden...
           #
  -        if run.getOptions().isText() or run.getEnvironment().noForrest:
  -            documenter=TextDocumenter()
  +        if run.getEnvironment().noForrest \
  +            or run.getOptions().isTemplate() \
  +            or run.getOptions().isText() :
  +            if run.getOptions().isTemaplate():
  +                documenter=TemplateDocumenter()
  +            else:
  +                documenter=TextDocumenter()
           else:
               documenter=ForrestDocumenter(workspace.getBaseDirectory(), \
                                            workspace.getLogUrl())                        
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org