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 2003/10/17 05:48:14 UTC

cvs commit: jakarta-gump/python/gump model.py logic.py utils.py

ajack       2003/10/16 20:48:14

  Modified:    python/gump model.py logic.py utils.py
  Log:
  Fingers crossed that inherit="all"/"jars"/"runtime" are now as expected...
  
  Revision  Changes    Path
  1.28      +16 -4     jakarta-gump/python/gump/model.py
  
  Index: model.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/model.py,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- model.py	15 Oct 2003 20:40:02 -0000	1.27
  +++ model.py	17 Oct 2003 03:48:14 -0000	1.28
  @@ -470,14 +470,26 @@
       def __eq__(self,other):
           return 	self.project == other.project \
                   and self.inherit == other.inherit \
  +                and self.runtime == other.runtime \
                   and self.ids == other.ids
                   
       def __cmp__(self,other):
           cmp = self.project < other.project
           if not cmp: cmp = self.inherit < other.inherit
  -        if not cmp: cmp = self.ids == other.ids
  +        if not cmp: cmp = self.runtime < other.runtime
  +        if not cmp: cmp = self.ids < other.ids
           return cmp
       
  +    def __str__(self):
  +        output=self.project
  +        if self.inherit:
  +            output+=' inherit="' + self.inherit + '"'
  +        if self.runtime:
  +            output+=' runtime="' + self.runtime + '"'
  +        if self.ids:
  +            output+=' ids="' + self.ids + '"'
  +        return output
  +        
       #
       # Return the jars for the dependent project (matching
       # ids, etc.)
  
  
  
  1.28      +55 -47    jakarta-gump/python/gump/logic.py
  
  Index: logic.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/logic.py,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- logic.py	16 Oct 2003 21:35:00 -0000	1.27
  +++ logic.py	17 Oct 2003 03:48:14 -0000	1.28
  @@ -388,9 +388,9 @@
     for work in project.work:
         path=None
         if work.nested:
  -          path=os.path.normpath(os.path.join(srcdir,work.nested))
  +          path=os.path.abspath(os.path.join(srcdir,work.nested))
         elif work.parent:
  -          path=os.path.normpath(os.path.join(workspace.basedir,work.parent))
  +          path=os.path.abspath(os.path.join(workspace.basedir,work.parent))
         else:
             log.error("<work element without nested or parent attributes on " \
                 + project.name + " in " + project.module)
  @@ -405,19 +405,19 @@
     if project.depend:
       # For each
       for depend in project.depend:
  -        classpath += getDependOutputList(depend,context,visited)  
  +        classpath += getDependOutputList(project,pctxt,depend,context,visited)  
                 
     # Same as above, but for optional...
     if project.option:    
       for option in project.option:
  -        classpath += getDependOutputList(option,context,visited)
  +        classpath += getDependOutputList(project,pctxt,option,context,visited)
         
     return classpath
   
   #
  -# :TODO: Runtime Dependncy?
  +# :TODO: Runtime Dependency?
   #
  -def getDependOutputList(depend,context,visited):      
  +def getDependOutputList(parent,parentctxt,depend,context,visited):      
     """Get a classpath of outputs for a project (including it's dependencies)"""            
      
     # Don't loop...
  @@ -431,59 +431,62 @@
     projectname=depend.project
     if not Project.list.has_key(projectname):
         if projectname:
  -          log.error("Unknown project (in acquiring classpath) " + projectname )
  +          parentctxt.addError("Unknown project (in acquiring classpath) [" + projectname \
  +                  + "] for [" + str(depend) + "]")
         return []
         
     # 
     classpath=[]
   
     #
  -  # Context for this project...
  +  # Context for this dependecy project...
     #
     project=Project.list[projectname]
     pctxt=context.getProjectContextForProject(project)
     
  -  #
  -  # Are we asking for runtime dependencies only?
  -  #
  +  # The dependency drivers...
     runtime=depend.runtime
  +  inherit=depend.inherit
  +  if depend.ids:
  +      ids=depend.ids.split(' ')
  +  else:
  +      ids=None
     
     #
     # Append JARS for this project
  +  #	(respect ids)
     #
  -  # Note: This checks "id" in "<depend ids="
  -  for jar in depend.jars():
  -    classpath.append(AnnotatedPath(jar.path,pctxt)) 
  +  for jar in project.jar:
  +      # If 'all' or in ids list:
  +      if (not ids) or (jar.id in ids):   
  +          path=AnnotatedPath(jar.path,pctxt)
  +          if not path in classpath:
  +              classpath.append(path)
  +
  +  # :TODO: List all jar ids and check ones we asked for exists
  +  # and log if not as warning
   
     #
  -  # inherit='ALL' or 'HARD'
  -  # or inherit the runtime ones...
  +  # Deep copy all/hard (or those for runtime)
     #
  -  deepCopy=determineDeepCopy(depend)
  -
  -  if deepCopy or runtime:      
  +  if inherit == 'all' or inherit=='hard' or runtime:      
         # Append sub-projects outputs
         if project.depend:
             for subdepend in project.depend:        
  -            if not runtime or subdepend.inherit=="runtime":      
  -                classpath += getDependOutputList(subdepend,context,visited)
  +            if not runtime or subdepend.runtime:      
  +                for path in getDependOutputList(project,pctxt,subdepend,context,visited):
  +                    if not path in classpath:
  +                        classpath.append(path)
     
         # Append optional sub-project's output (that may not exist)
         if project.option:
             for suboption in project.option:
  -            if not runtime or suboption.inherit=="runtime":      
  -                classpath += getDependOutputList(suboption,context,visited)
  +            if not runtime or suboption.runtime:      
  +                for path in getDependOutputList(project,pctxt,suboption,context,visited):
  +                    if not path in classpath:
  +                        classpath.append(path)
   
     return classpath
  -  
  -def determineDeepCopy(depend):
  -    """Determine if we ought deepCopy to inherit"""
  -    deep=0
  -    inherit=depend.inherit
  -    # :TODO: The 'jars' is a temporary hack.
  -    if inherit == 'all' or inherit=='hard' or inherit=='jars':
  -        deep=1
  -    return deep
       
   # BOOTCLASSPATH?
   def getClasspath(project,workspace,context):
  @@ -643,24 +646,29 @@
     printSeparator()
     
     projects=getProjectsForProjectExpression(ps)
  -  print "Resolved Projects : " + str(len(projects))
  -  for p in projects: print "Project " + str(p.name)
  -  modules=getModulesForProjectExpression(ps)
  -  print "Resolved Modules : " + str(len(modules))
  -  for m in modules: print "Module " + str(m.name) + " : " + str(m.cvs.repository)
  -  
  -  projects=getBuildSequenceForProjects(getProjectsForProjectExpression(ps))
  -  print "Resolved Project Tree : " + str(len(projects))
  -  for p in projects: print "Project " + str(p.name)
  -  modules=getModulesForProjectList(projects)
  -  print "Resolved Module Tree : " + str(len(modules))
  -  for m in modules: print "Module " + str(m.name) + " : " + str(m.cvs.repository)
  +  #print "Resolved Projects : " + str(len(projects))
  +  #for p in projects: print "Project " + str(p.name)
  +  #modules=getModulesForProjectExpression(ps)
  +  #print "Resolved Modules : " + str(len(modules))
  +  #for m in modules: print "Module " + str(m.name) + " : " + str(m.cvs.repository)
  +  
  +  #projects=getBuildSequenceForProjects(getProjectsForProjectExpression(ps))
  +  #print "Resolved Project Tree : " + str(len(projects))
  +  #for p in projects: print "Project " + str(p.name)
  +  #modules=getModulesForProjectList(projects)
  +  #print "Resolved Module Tree : " + str(len(modules))
  +  #for m in modules: print "Module " + str(m.name) + " : " + str(m.cvs.repository)
     
     printSeparator()
     
  -  preprocessContext(workspace, context)
  +  # preprocessContext(workspace, context)
     
  -  from gump.document import documentText
  +  # from gump.document import documentText
  +  # documentText(workspace, context, ps)
     
  -  documentText(workspace, context, ps)
  +  for project in projects:
  +      cp=getClasspathList(project,workspace,context)
  +      print "Project : " + project.name 
  +      for p in cp:
  +          print " - " + str(p)
   
  
  
  
  1.5       +1 -0      jakarta-gump/python/gump/utils.py
  
  Index: utils.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/utils.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- utils.py	27 Sep 2003 14:36:18 -0000	1.4
  +++ utils.py	17 Oct 2003 03:48:14 -0000	1.5
  @@ -63,6 +63,7 @@
   """
   
   import logging
  +import sys
   import types, StringIO
   
   from gump  import log