ajack       2004/03/24 07:19:22

  Modified:    python/gump/document forrest.py
               python/gump/model depend.py
               python/gump engine.py
  Log:
  1) Added 'depth' and 'total depth' to Dependable (a measure of how much stuff is 
'below' a given project).

  2) Documented these above (no Statistics pages comparing, yet).

  3) Create 'DependencyPath', and gather paths between two projects.

  4) Document the path from this project to it's "cause" project/module.
  
  Revision  Changes    Path
  1.114     +37 -8     gump/python/gump/document/forrest.py
  
  Index: forrest.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/document/forrest.py,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- forrest.py        19 Mar 2004 23:11:46 -0000      1.113
  +++ forrest.py        24 Mar 2004 15:19:22 -0000      1.114
  @@ -1218,6 +1218,9 @@
                   
           projectsSection.createParagraph().createRaw(description)
           
  +        #
  +        # The 'cause' is something upstream.
  +        #
           if project.cause and not project==project.cause:
                self.insertTypedLink( project.cause, project, \
                    document.createNote( "This project failed due to: "))              
  @@ -1247,6 +1250,12 @@
           self.insertLink(project.getModule(),project, \
                   detailsList.createEntry('Containing Module: '))        
           
  +        if project.getDependencyDepth():
  +            detailsList.createEntry('Dependency Depth: ', 
project.getDependencyDepth())
  +        
  +        if project.getTotalDependencyDepth():
  +            detailsList.createEntry('Total Dependency Depth: ', 
project.getTotalDependencyDepth())
  +        
           if project.hasHomeDirectory() and project.isVerboseOrDebug():
               detailsList.createEntry('Home Directory: ', project.getHomeDirectory())
               
  @@ -1358,17 +1367,33 @@
           depens = 0
           depees = 0
           
  -        depens += self.documentDependenciesList(dependencySection, "Project 
Dependencies",   \
  +        
  +        #
  +        # The 'cause' is something upstream. Possibly a project,
  +        # possibly a module (so determine paths to module projects).
  +        #
  +        if project.cause and not project==project.cause:
  +            if isinstance(project.cause, Project):
  +                for path in project.getDependencyPaths(project.cause):
  +                    self.documentDependenciesPath(dependencySection, 'Root Cause 
Dependency Path',   \
  +                            path, 0, 1, project, gumpSet)
  +            elif isinstance(project.cause, Module):
  +                for causeProject in project.cause.getProjects():
  +                    for path in project.getDependencyPaths(causeProject):
  +                        self.documentDependenciesPath(dependencySection, 'Root 
Cause Module Dependency Path',        \
  +                                path, 0, 1, project, gumpSet)
  +                
  +        depens += self.documentDependenciesList(dependencySection, 'Project 
Dependencies',   \
                       project.getDirectDependencies(), 0, 0, project, gumpSet)
                       
  -        depees += self.documentDependenciesList(dependencySection, "Project 
Dependees",              \
  +        depees += self.documentDependenciesList(dependencySection, 'Project 
Dependees',              \
                       project.getDirectDependees(), 1, 0, project, gumpSet)
                       
           if project.isVerboseOrDebug():
  -            self.documentDependenciesList(dependencySection, "Full Project 
Dependencies",    \
  +            self.documentDependenciesList(dependencySection, 'Full Project 
Dependencies',    \
                       project.getFullDependencies(), 0, 1, project, gumpSet)
                                                   
  -            self.documentDependenciesList(dependencySection, "Full Project 
Dependees",               \
  +            self.documentDependenciesList(dependencySection, 'Full Project 
Dependees',               \
                       project.getFullDependees(), 1, 1, project, gumpSet)
           
           deps = depees + depens
  @@ -1438,6 +1463,10 @@
           if not paths:        
               pathTable.createLine('No ' + title + ' entries')
                        
  +    def 
documentDependenciesPath(self,xdocNode,title,path,dependees,full,referencingObject,gumpSet):
        
  +        # :TODO: show start and end?
  +        
self.documentDependenciesList(xdocNode,title,path,dependees,full,referencingObject,gumpSet)
  +        
       def 
documentDependenciesList(self,xdocNode,title,dependencies,dependees,full,referencingObject,gumpSet):
        
           totalDeps=0
                   
  @@ -1598,7 +1627,7 @@
           stream.seek(0)
           xmldata=stream.read()
           if len(xmldata) < 32000:
  -            xmlSection.createSource(stream.read())
  +            xmlSection.createSource(xmldata)
           else:
               xmlSection.createParagraph('XML Data too large to display.')
           stream.close()
  
  
  
  1.22      +76 -1     gump/python/gump/model/depend.py
  
  Index: depend.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/model/depend.py,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- depend.py 19 Mar 2004 18:19:18 -0000      1.21
  +++ depend.py 24 Mar 2004 15:19:22 -0000      1.22
  @@ -233,6 +233,21 @@
       def getUniqueProjectDependCount(self):
           return len(self.projectMap)
        
  +class DependencyPath(list):
  +    """ 'Path' of dependencies between two points """
  +    def __init__(self,startDependable,endDependable):
  +        self.startDependable=startDependable
  +        self.endDependable=endDependable
  +        
  +    def appendDepend(self,depend):
  +        self.append(depend)
  +        self.endDependable=depend.getProject()
  +    
  +    def getStart(self):
  +        return self.startDependable
  +        
  +    def getEnd(self):
  +        return self.endDependable
                   
   class Dependable:
       
  @@ -246,6 +261,10 @@
           # Direct & Full Dependees
           self.directDependees=DependSet(1)
           self.fullDependees=None
  +    
  +        # Depth
  +        self.depth=0
  +        self.totalDepth=0
           
       #
       # Dependencies
  @@ -283,7 +302,53 @@
       def getFullDependencyCount(self):
           self.getFullDependencies()
           return self.fullDependencies.getUniqueProjectDependCount()
  -                
  +
  +    #
  +    # Depth
  +    #
  +    def getDependencyDepth(self):
  +        if self.depth: return self.depth
  +        maxDepth=1
  +        for depend in self.directDependencies.getDepends():
  +            dependencyDepth=depend.getProject().getDependencyDepth() + 1
  +            if maxDepth <  dependencyDepth:
  +                maxDepth=dependencyDepth
  +        self.depth=maxDepth
  +        return self.depth
  +     
  +     
  +    #
  +    # Total Depth
  +    #
  +    def getTotalDependencyDepth(self):
  +        if self.totalDepth: return self.totalDepth
  +        for depend in self.directDependencies.getDepends():
  +            dependencyDepth=depend.getProject().getDependencyDepth()
  +            self.totalDepth += dependencyDepth
  +        return self.totalDepth
  +        
  +    #
  +    # Dependency Paths (None, One, Some).
  +    #
  +    def getDependencyPaths(self, dependable):
  +        paths=[]
  +        # Determine the dependency paths for any direct dependencies
  +        # and 
  +        for depend in self.directDependencies.getDepends():
  +            directDependable=depend.getProject()
  +            if dependable == directDependable:
  +                # A simple path
  +                path=DependencyPath(dependable,self)
  +                path.appendDepend(depend)
  +                paths.append(path)
  +            elif directDependable.hasDependencyOn(dependable):
  +                # Clearly there is at least one path (maybe more)
  +                for path in directDependable.getDependencyPaths(dependable):
  +                    # Take each path and extend it...
  +                    path.appendDepend(depend)
  +                    paths.append(path)
  +        return paths
  +        
       #
       # Dependees
       # 
  @@ -293,6 +358,7 @@
       def getDirectDependees(self):
           return self.directDependees.getDepends()
           
  +        
       def getFullDependees(self):
           if self.fullDependees: return self.fullDependees.getDepends()
           
  @@ -345,13 +411,22 @@
   
       # determine if this project is a prereq of any project on the todo list
       def hasDirectDependencyOn(self,project):
  +        """ Does this project exist as a dependency """    
           for dependency in self.getDirectDependencies():
               if dependency.getProject()==project: return 1
       
  +    # determine if this project is a prereq of any project on the todo sequence
  +    def hasDependencyOn(self,project):
  +        """ Does this project exist as any dependency """        
  +        for dependency in self.getFullDependencies():
  +            if dependency.getProject()==project: return 1
  +    
       def hasDirectDependee(self,project):
  +        """ Does this project exist as a direct dependee """    
           for dependee in self.getDirectDependees():
               if dependee.getOwnerProject()==project: return 1
               
       def hasDependee(self,project):
  +        """ Does this project exist as any dependee """
           for dependee in self.getFullDependees():
               if dependee.getOwnerProject()==project: return 1
  
  
  
  1.94      +5 -0      gump/python/gump/engine.py
  
  Index: engine.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/engine.py,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- engine.py 19 Mar 2004 23:11:46 -0000      1.93
  +++ engine.py 24 Mar 2004 15:19:22 -0000      1.94
  @@ -418,6 +418,11 @@
                           if cmdResult.state==CMD_STATE_TIMED_OUT:
                               reason=REASON_BUILD_TIMEDOUT
                           project.changeState(STATE_FAILED,reason)
  +                        
  +                        # Display...
  +                        project.addInfo('Enable "debug" output, due to build 
failure.')
  +                        project.setDebug(1)
  +                        
                       else:                         
                           # For now, things are going good...
                           project.changeState(STATE_SUCCESS)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to