ajack       2003/10/06 22:27:52

  Modified:    python/gump logic.py
  Log:
  Attempt to reduce/remove looping...
  
  Revision  Changes    Path
  1.19      +12 -6     jakarta-gump/python/gump/logic.py
  
  Index: logic.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/logic.py,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- logic.py  6 Oct 2003 21:22:27 -0000       1.18
  +++ logic.py  7 Oct 2003 05:27:52 -0000       1.19
  @@ -354,21 +354,27 @@
       
         if path:
             classpath.append(AnnotatedPath(path,pctxt))
  -          
  +
  +  visited=[]
     # Append dependent projects (including optional)
     if project.depend:
         for depend in project.depend:
  -          classpath += getDependOutputList(depend,context)  
  +          classpath += getDependOutputList(depend,context,visited)  
     if project.option:    
         for option in project.option:
  -          classpath += getDependOutputList(option,context)
  +          classpath += getDependOutputList(option,context,visited)
         
     return classpath
     
  -def getDependOutputList(depend,context,logIssues=None):      
  +def getDependOutputList(depend,context,visited):      
     """Get a classpath of outputs for a project (including it's dependencies)"""      
      
     projectname=depend.project
     
  +  # Don't loop
  +  if projectname in visited:
  +      return
  +  visited.append(projectname)
  +  
     if not Project.list.has_key(projectname):
         if projectname:
             log.error("Unknown project (in acquiring classpath) " + projectname )
  @@ -387,12 +393,12 @@
     # Append sub-projects outputs
     if project.depend:
         for depend in project.depend:
  -        classpath += getDependOutputList(depend,context,logIssues)
  +        classpath += getDependOutputList(depend,context,visited)
     
     # Append optional sub-project's output (that may not exist)
     if project.option:
         for option in project.option:
  -        classpath += getDependOutputList(option,context,logIssues)
  +        classpath += getDependOutputList(option,context,visited)
   
     return classpath
     
  
  
  

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

Reply via email to