gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject cvs commit: jakarta-gump/python build.py gen.py gumpconf.py gumputil.py gumpview.py orphans.py ruper.py
Date Thu, 24 Apr 2003 22:57:55 GMT
leosimons    2003/04/24 15:57:55

  Modified:    python   build.py gen.py gumpconf.py gumputil.py gumpview.py
                        orphans.py ruper.py
  Log:
  more whitespace. No other changes
  
  Revision  Changes    Path
  1.4       +95 -95    jakarta-gump/python/build.py
  
  Index: build.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/build.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- build.py	24 Apr 2003 07:45:50 -0000	1.3
  +++ build.py	24 Apr 2003 22:57:54 -0000	1.4
  @@ -1,95 +1,95 @@
  -#!/usr/bin/python
  -"""
  -	Look for obsolete installed packages, cvs checkouts, and build
  -	directories.
  -"""
  -
  -import os.path,os,sys
  -from gumpcore import *
  -from gumpconf import *
  -
  -# dump all dependencies to build a project to the output
  -def dumpDeps(workspace, projectname):
  -
  -  # get the project object given the project name
  -  project=Project.list[projectname]
  -  
  -  print 'PROJECTS TO BUILD:'
  -
  -  # resolve the build sequence of the specified project
  -  build_sequence = dependencies(projectname, project.depend)
  -
  -  print
  -  print ' ----- Build sequence for ' + projectname + ' -----'
  -  print
  -
  -  # for all the projects that this project depends upon, show relevant infos
  -  for project in build_sequence:
  -    
  -    # get the module object given the module name,
  -    # which is gotten from the project
  -    module=Module.list[project.module]
  -
  -    print ' ----------- '+ module.name + ':' + project.name + ' ----------- '
  -
  -    # get the ant element
  -    ant=project.ant
  -
  -    if ant:  
  -      if ant.target:
  -        print ' ANT TARGET '
  -        print '   ',ant.target
  -      else:
  -        print ' ANT TARGET '
  -        print '   [default]'    
  -
  -    # get the script element
  -    script=project.script
  -
  -    if script:
  -      print ' BUILD WITH SCRIPT '
  -      print '   ?', script
  -
  -    if not (script or ant):
  -      print ' THIS PROJECT IS NOT TO BE BUILT '
  -      
  -    print ' SRCDIR'
  -    print '   ',os.path.normpath(os.path.join(module.srcdir,ant.basedir or ''))
  -
  -    print ' CLASSPATH'          #FIXME (nicolaken) has to use this too
  -    for depend in project.depend:#+project.option:
  -      p=Project.list[depend.project]
  -      srcdir=Module.list[p.module].srcdir
  -
  -      for jar in p.jar:
  -        print '  ',os.path.normpath(os.path.join(srcdir,jar.name))
  -
  -    print
  -    print ' PROPERTIES'                #FIXME (nicolaken) it's not necessarily there
  -    for property in workspace.property:#+ant.property:
  -      print '  ',property.name,'=',property.value
  -
  -    print
  -    print ' ------------------------------------------------------- '
  -    print    
  -
  -  
  -# static void main()
  -if __name__=='__main__':
  -  # cd into the base Gump dir; all dirs are relative to it
  -  os.chdir(dir.base)
  -    
  -  # load commandline args or use default values
  -  if len(sys.argv)>1 :
  -    ws=sys.argv[1]
  -  else:
  -    ws=default.workspace
  -    
  -  if len(sys.argv)>2 :
  -    ps=sys.argv[2]
  -  else:
  -    ps=default.project    
  -
  -  workspace=load(ws)
  -  dumpDeps(workspace, ps);          
  -  sys.exit(0)
  +#!/usr/bin/python
  +"""
  +        Look for obsolete installed packages, cvs checkouts, and build
  +        directories.
  +"""
  +
  +import os.path,os,sys
  +from gumpcore import *
  +from gumpconf import *
  +
  +# dump all dependencies to build a project to the output
  +def dumpDeps(workspace, projectname):
  +
  +  # get the project object given the project name
  +  project=Project.list[projectname]
  +  
  +  print 'PROJECTS TO BUILD:'
  +
  +  # resolve the build sequence of the specified project
  +  build_sequence = dependencies(projectname, project.depend)
  +
  +  print
  +  print ' ----- Build sequence for ' + projectname + ' -----'
  +  print
  +
  +  # for all the projects that this project depends upon, show relevant infos
  +  for project in build_sequence:
  +    
  +    # get the module object given the module name,
  +    # which is gotten from the project
  +    module=Module.list[project.module]
  +
  +    print ' ----------- '+ module.name + ':' + project.name + ' ----------- '
  +
  +    # get the ant element
  +    ant=project.ant
  +
  +    if ant:  
  +      if ant.target:
  +        print ' ANT TARGET '
  +        print '   ',ant.target
  +      else:
  +        print ' ANT TARGET '
  +        print '   [default]'    
  +
  +    # get the script element
  +    script=project.script
  +
  +    if script:
  +      print ' BUILD WITH SCRIPT '
  +      print '   ?', script
  +
  +    if not (script or ant):
  +      print ' THIS PROJECT IS NOT TO BE BUILT '
  +      
  +    print ' SRCDIR'
  +    print '   ',os.path.normpath(os.path.join(module.srcdir,ant.basedir or ''))
  +
  +    print ' CLASSPATH'          #FIXME (nicolaken) has to use this too
  +    for depend in project.depend:#+project.option:
  +      p=Project.list[depend.project]
  +      srcdir=Module.list[p.module].srcdir
  +
  +      for jar in p.jar:
  +        print '  ',os.path.normpath(os.path.join(srcdir,jar.name))
  +
  +    print
  +    print ' PROPERTIES'                #FIXME (nicolaken) it's not necessarily there
  +    for property in workspace.property:#+ant.property:
  +      print '  ',property.name,'=',property.value
  +
  +    print
  +    print ' ------------------------------------------------------- '
  +    print    
  +
  +  
  +# static void main()
  +if __name__=='__main__':
  +  # cd into the base Gump dir; all dirs are relative to it
  +  os.chdir(dir.base)
  +    
  +  # load commandline args or use default values
  +  if len(sys.argv)>1 :
  +    ws=sys.argv[1]
  +  else:
  +    ws=default.workspace
  +    
  +  if len(sys.argv)>2 :
  +    ps=sys.argv[2]
  +  else:
  +    ps=default.project    
  +
  +  workspace=load(ws)
  +  dumpDeps(workspace, ps);          
  +  sys.exit(0)
  
  
  
  1.6       +82 -82    jakarta-gump/python/gen.py
  
  Index: gen.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gen.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- gen.py	24 Apr 2003 10:11:46 -0000	1.5
  +++ gen.py	24 Apr 2003 22:57:54 -0000	1.6
  @@ -1,82 +1,82 @@
  -#!/usr/bin/python
  -"""
  -	Generate the merged XML description of the workspace
  -"""
  -
  -import os.path,os,sys
  -from gumpcore import *
  -from gumpconf import *
  -
  -#########################################################################
  -#                     Dump the object module as XML                     #
  -#########################################################################
  -
  -def xmlize(nodeName,object,f,indent='',delta='  '):
  -  from xml.sax.saxutils import escape
  -  import types
  -
  -  attrs=[nodeName]
  -  elements=[]
  -  text=''
  -  encoding='latin-1'
  -
  -  # iterate over the object properties
  -  for name in object.__dict__:
  -    if name.startswith('__') and name.endswith('__'): continue
  -    var=getattr(object,name)
  -
  -    # avoid nulls, metadata, and methods
  -    if not var: continue
  -    if isinstance(var,types.TypeType): continue
  -    if isinstance(var,types.MethodType): continue
  -
  -    # determine if the property is text, attribute, or element
  -    if name=='@text':
  -      text=var
  -    elif isinstance(var,types.StringTypes): 
  -      attrs.append('%s="%s"' % (name,escape(var)))
  -    else:
  -      elements.append((name,var))
  -
  -  # format for display
  -  if not elements:
  -    # use compact form for elements without children
  -    if text.strip():
  -      f.write( '%s<%s>%s</%s>' % (indent.encode(encoding),' '.join(attrs).encode(encoding),text.strip().encode(encoding),nodeName))
  -    else:
  -      f.write( '%s<%s/>' % (indent.encode(encoding),' '.join(attrs).encode(encoding)))
  -  else:
  -    # use full form for elements with children
  -    f.write( '%s<%s>' % (indent.encode(encoding),' '.join(attrs).encode(encoding)))
  -    newindent=indent+delta
  -    for (name,var) in elements:
  -      if isinstance(var,list):
  -        # multiple valued elements
  -        for e in var: xmlize(name,e,f,newindent,delta)
  -      elif isinstance(var,Single):
  -       # single valued elements
  -        xmlize(name,var.delegate,f,newindent,delta)
  -    f.write( '%s</%s>' % (indent.encode(encoding),nodeName.encode(encoding)))
  -
  -  
  -if __name__=='__main__':
  -  # cd into the base Gump dir; all dirs are relative to it
  -  os.chdir(dir.base)
  -
  -  # load commandline args or use default values
  -  if len(sys.argv)>1 :
  -    ws=sys.argv[1]
  -  else:
  -    ws=default.workspace
  -
  -  workspace=load(ws)
  -
  -  try:
  -    if not os.path.exists(dir.work):
  -      os.path.mkdir(dir.work)
  -    f=open(dir.work+'/'+default.merge, 'w')
  -    xmlize('workspace',workspace,f)
  -  finally:
  -    # Since we may exit via an exception, close fp explicitly.
  -    if f:
  -      f.close()
  +#!/usr/bin/python
  +"""
  +        Generate the merged XML description of the workspace
  +"""
  +
  +import os.path,os,sys
  +from gumpcore import *
  +from gumpconf import *
  +
  +#########################################################################
  +#                     Dump the object module as XML                     #
  +#########################################################################
  +
  +def xmlize(nodeName,object,f,indent='',delta='  '):
  +  from xml.sax.saxutils import escape
  +  import types
  +
  +  attrs=[nodeName]
  +  elements=[]
  +  text=''
  +  encoding='latin-1'
  +
  +  # iterate over the object properties
  +  for name in object.__dict__:
  +    if name.startswith('__') and name.endswith('__'): continue
  +    var=getattr(object,name)
  +
  +    # avoid nulls, metadata, and methods
  +    if not var: continue
  +    if isinstance(var,types.TypeType): continue
  +    if isinstance(var,types.MethodType): continue
  +
  +    # determine if the property is text, attribute, or element
  +    if name=='@text':
  +      text=var
  +    elif isinstance(var,types.StringTypes): 
  +      attrs.append('%s="%s"' % (name,escape(var)))
  +    else:
  +      elements.append((name,var))
  +
  +  # format for display
  +  if not elements:
  +    # use compact form for elements without children
  +    if text.strip():
  +      f.write( '%s<%s>%s</%s>' % (indent.encode(encoding),' '.join(attrs).encode(encoding),text.strip().encode(encoding),nodeName))
  +    else:
  +      f.write( '%s<%s/>' % (indent.encode(encoding),' '.join(attrs).encode(encoding)))
  +  else:
  +    # use full form for elements with children
  +    f.write( '%s<%s>' % (indent.encode(encoding),' '.join(attrs).encode(encoding)))
  +    newindent=indent+delta
  +    for (name,var) in elements:
  +      if isinstance(var,list):
  +        # multiple valued elements
  +        for e in var: xmlize(name,e,f,newindent,delta)
  +      elif isinstance(var,Single):
  +       # single valued elements
  +        xmlize(name,var.delegate,f,newindent,delta)
  +    f.write( '%s</%s>' % (indent.encode(encoding),nodeName.encode(encoding)))
  +
  +  
  +if __name__=='__main__':
  +  # cd into the base Gump dir; all dirs are relative to it
  +  os.chdir(dir.base)
  +
  +  # load commandline args or use default values
  +  if len(sys.argv)>1 :
  +    ws=sys.argv[1]
  +  else:
  +    ws=default.workspace
  +
  +  workspace=load(ws)
  +
  +  try:
  +    if not os.path.exists(dir.work):
  +      os.path.mkdir(dir.work)
  +    f=open(dir.work+'/'+default.merge, 'w')
  +    xmlize('workspace',workspace,f)
  +  finally:
  +    # Since we may exit via an exception, close fp explicitly.
  +    if f:
  +      f.close()
  
  
  
  1.4       +17 -17    jakarta-gump/python/gumpconf.py
  
  Index: gumpconf.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gumpconf.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- gumpconf.py	24 Apr 2003 10:11:47 -0000	1.3
  +++ gumpconf.py	24 Apr 2003 22:57:54 -0000	1.4
  @@ -1,17 +1,17 @@
  -#!/usr/bin/python
  -"""
  -	Configuration for Gump, done as Python classes
  -"""
  -
  -import socket
  -
  -class dir:
  -   base      = ".."
  -   cache     = "cache"
  -   work      = "work"
  -
  -class default:
  -  workspace  = socket.gethostname().split('.')[0] + ".xml"
  -  project    = "krysalis-ruper-test"
  -  merge      = "merge.xml"
  -
  +#!/usr/bin/python
  +"""
  +        Configuration for Gump, done as Python classes
  +"""
  +
  +import socket
  +
  +class dir:
  +   base      = ".."
  +   cache     = "cache"
  +   work      = "work"
  +
  +class default:
  +  workspace  = socket.gethostname().split('.')[0] + ".xml"
  +  project    = "krysalis-ruper-test"
  +  merge      = "merge.xml"
  +
  
  
  
  1.3       +57 -57    jakarta-gump/python/gumputil.py
  
  Index: gumputil.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gumputil.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- gumputil.py	24 Apr 2003 08:34:15 -0000	1.2
  +++ gumputil.py	24 Apr 2003 22:57:54 -0000	1.3
  @@ -1,57 +1,57 @@
  -#!/usr/bin/python
  -"""
  -	Utility functions for Gump
  -"""
  -
  -import os, os.path, sys, urllib, urlparse
  -from gumpconf import *
  -
  -# output debug messages or not
  -debug = False #True
  -  
  -#########################################################################
  -#                     Utility functions                                 #
  -#########################################################################
  -
  - 
  -# returns the path of the file in the href, cached if remote
  -def gumpCache(href):
  -    
  -  #if it's a local file get it locally
  -  if not href.startswith('http://'):
  -    newHref=href;  
  -  else:
  -    if debug: print 'url: ' + href
  -    if not os.path.exists(dir.cache):  mkdir(dir.cache)
  -
  -    #the name of the cached descriptor
  -    quotedHref = urllib.quote_plus(href)
  -    #the path of the cached descriptor
  -    newHref = dir.cache+'/'+quotedHref
  -    
  -    #download the file if not present in the cache
  -    if os.path.exists(newHref): 
  -      if debug: print 'using cached descriptor'
  -    else:  
  -      if debug: print 'caching...'
  -      urllib.urlretrieve(href, newHref)
  -      if debug: print '...done' 
  -
  -  return newHref
  -
  -# display an error message in standard formatting
  -def gumpMessage(type, error, description):
  -  print
  -  print
  -  print ' ****************************************************************'
  -  print '     ',type
  -  print ' ****************************************************************'
  -  print ' **                                                            **'
  -  print '   ',error
  -  print
  -  print description
  -  print
  -  print ' **                                                            **'
  -  print ' ****************************************************************'
  -  print
  -  print
  +#!/usr/bin/python
  +"""
  +        Utility functions for Gump
  +"""
  +
  +import os, os.path, sys, urllib, urlparse
  +from gumpconf import *
  +
  +# output debug messages or not
  +debug = False #True
  +  
  +#########################################################################
  +#                     Utility functions                                 #
  +#########################################################################
  +
  + 
  +# returns the path of the file in the href, cached if remote
  +def gumpCache(href):
  +    
  +  #if it's a local file get it locally
  +  if not href.startswith('http://'):
  +    newHref=href;  
  +  else:
  +    if debug: print 'url: ' + href
  +    if not os.path.exists(dir.cache):  mkdir(dir.cache)
  +
  +    #the name of the cached descriptor
  +    quotedHref = urllib.quote_plus(href)
  +    #the path of the cached descriptor
  +    newHref = dir.cache+'/'+quotedHref
  +    
  +    #download the file if not present in the cache
  +    if os.path.exists(newHref): 
  +      if debug: print 'using cached descriptor'
  +    else:  
  +      if debug: print 'caching...'
  +      urllib.urlretrieve(href, newHref)
  +      if debug: print '...done' 
  +
  +  return newHref
  +
  +# display an error message in standard formatting
  +def gumpMessage(type, error, description):
  +  print
  +  print
  +  print ' ****************************************************************'
  +  print '     ',type
  +  print ' ****************************************************************'
  +  print ' **                                                            **'
  +  print '   ',error
  +  print
  +  print description
  +  print
  +  print ' **                                                            **'
  +  print ' ****************************************************************'
  +  print
  +  print
  
  
  
  1.3       +153 -153  jakarta-gump/python/gumpview.py
  
  Index: gumpview.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gumpview.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- gumpview.py	24 Apr 2003 22:51:19 -0000	1.2
  +++ gumpview.py	24 Apr 2003 22:57:54 -0000	1.3
  @@ -1,153 +1,153 @@
  -#!/usr/bin/python
  -"""
  -	Graphic GUI to navigate a Gump workspace
  -"""
  -
  -import sys
  -from xml.sax import parse
  -from xml.sax.handler import ContentHandler
  -
  -# http://wxpython.org/
  -from wxPython.wx import *
  -
  -from gumpcore import load,Module,Project,dependencies
  -from gen import xmlize
  -from gumpconf import *
  -
  -class gumpview(wxApp):
  -  # model
  -  mySubs=None
  -  items=None
  -  build_sequence=None
  -  
  -  # view
  -  tree=None
  -  list=None
  -  data=None
  -
  -  # tree index
  -  mItem={}
  -  pItem={}
  -
  -  def OnInit(self):
  -    # layout 
  -    frame = wxFrame(NULL, -1, "Gump Workspace Viewer")
  -    split1 = wxSplitterWindow(frame,-1)
  -    notebook = wxNotebook(split1, -1, style=wxCLIP_CHILDREN)
  -    split2 = wxSplitterWindow(notebook,-1)
  -    
  -    # panes 
  -    self.tree=wxTreeCtrl(split1,-1)
  -    self.list=wxListCtrl(split2,-1,style=wxLC_REPORT|wxSUNKEN_BORDER)
  -    self.dependencies=wxListCtrl(notebook,-1,style=wxLC_REPORT|wxSUNKEN_BORDER)
  -    self.data=wxTextCtrl(split2,-1,style=wxTE_MULTILINE)
  -
  -    # attach the panes to the frame
  -    split1.SplitVertically(self.tree, notebook)
  -    notebook.AddPage(split2, 'referenced')
  -    notebook.AddPage(self.dependencies, 'dependencies')
  -    split2.SplitHorizontally(self.list, self.data)
  -    self.SetTopWindow(frame)
  -    frame.Show(true)
  -    
  -    # resize
  -    split1.SetMinimumPaneSize(20)
  -    split2.SetMinimumPaneSize(20)
  -    split1.SetSashPosition(300,true)
  -    split2.SetSashPosition(200)
  -    
  -    # wire up the events
  -    EVT_TREE_SEL_CHANGED(self, self.tree.GetId(), self.selectTree)
  -    EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.selectItem)
  -    EVT_LIST_ITEM_SELECTED(self, self.dependencies.GetId(), self.selectItem2)
  -    return true
  -    
  -  # list all modules and their projects
  -  def load(self,files):
  -    root = self.tree.AddRoot(files[0])
  -    self.workspace = load(files[0])
  -    names=Module.list.keys()
  -    names.sort()
  -    for name in names:
  -      module=Module.list[name]
  -      parent=self.mItem[name]=self.tree.AppendItem(root,name)
  -      self.tree.SetPyData(parent,module)
  -      for project in module.project:
  -        self.pItem[project.name]=self.tree.AppendItem(parent,project.name)
  -        self.tree.SetPyData(self.pItem[project.name],project)
  -
  -    self.tree.Expand(root)
  -
  -  # select a single feed and display titles from each item
  -  def selectTree(self, event):
  -    self.showProject(self.tree.GetPyData(event.GetItem()))
  -
  -  def showProject(self,project):
  -    if not project or not isinstance(project,Project): return
  -
  -    # gather a list of projects which reference this project
  -    self.items=[]
  -    for parent in Project.list.values():
  -      list=parent.depend+parent.option
  -      if parent.ant: list+=parent.ant.depend
  -      for depend in list:
  -        if depend.project==project.name:
  -          self.items.append(parent.name)
  -
  -    # display the list, sorted by name
  -    self.list.DeleteAllItems()
  -    if not self.list.GetColumn(0): 
  -      self.list.InsertColumn(0, 'Cross Reference')
  -      self.items.sort()
  -    for i in range(0,len(self.items)): 
  -      row=self.list.InsertStringItem(i,self.items[i])
  -      self.list.SetItemData(row,i)
  -
  -    self.list.SetColumnWidth(0,wxLIST_AUTOSIZE_USEHEADER)
  -
  -    # display the project definition
  -    import StringIO
  -    data = StringIO.StringIO()
  -    xmlize('project',project,data,)
  -    self.data.Clear()
  -    data.seek(0)
  -    self.data.AppendText(data.read())
  -    self.data.ShowPosition(0)
  -    
  -    # gather a list of project dependencies unrolled to build
  -    self.build_sequence = dependencies(project.name, project.depend)
  -    
  -    # display the project dependencies
  -    self.dependencies.DeleteAllItems()
  -    if not self.dependencies.GetColumn(0): 
  -      self.dependencies.InsertColumn(0, 'Build sequence')
  -      
  -    for i in range(0,len(self.build_sequence)): 
  -      row=self.dependencies.InsertStringItem(i,self.build_sequence[i].name)
  -      self.dependencies.SetItemData(row,i)
  -    
  -    self.list.SetColumnWidth(0,wxLIST_AUTOSIZE_USEHEADER)
  -
  -    
  -  # show the xml description for a single item
  -  def selectItem(self, event):
  -    project=Project.list[self.items[event.GetItem().GetData()]]
  -    self.showProject(project)
  -
  -    # expand the associated module and select the project
  -    self.tree.Expand(self.mItem[project.module])
  -    self.tree.SelectItem(self.pItem[project.name])
  -
  -  # show the xml description for a single item
  -  def selectItem2(self, event):
  -    project=Project.list[self.build_sequence[event.GetItem().GetData()].name]
  -    self.showProject(project)
  -
  -    # expand the associated module and select the project
  -    self.tree.Expand(self.mItem[project.module])
  -    self.tree.SelectItem(self.pItem[project.name])
  -    
  -if __name__ == '__main__':
  -  app = gumpview(0)
  -  app.load(sys.argv[1:] or [default.workspace])
  -  app.MainLoop()
  +#!/usr/bin/python
  +"""
  +        Graphic GUI to navigate a Gump workspace
  +"""
  +
  +import sys
  +from xml.sax import parse
  +from xml.sax.handler import ContentHandler
  +
  +# http://wxpython.org/
  +from wxPython.wx import *
  +
  +from gumpcore import load,Module,Project,dependencies
  +from gen import xmlize
  +from gumpconf import *
  +
  +class gumpview(wxApp):
  +  # model
  +  mySubs=None
  +  items=None
  +  build_sequence=None
  +  
  +  # view
  +  tree=None
  +  list=None
  +  data=None
  +
  +  # tree index
  +  mItem={}
  +  pItem={}
  +
  +  def OnInit(self):
  +    # layout 
  +    frame = wxFrame(NULL, -1, "Gump Workspace Viewer")
  +    split1 = wxSplitterWindow(frame,-1)
  +    notebook = wxNotebook(split1, -1, style=wxCLIP_CHILDREN)
  +    split2 = wxSplitterWindow(notebook,-1)
  +    
  +    # panes 
  +    self.tree=wxTreeCtrl(split1,-1)
  +    self.list=wxListCtrl(split2,-1,style=wxLC_REPORT|wxSUNKEN_BORDER)
  +    self.dependencies=wxListCtrl(notebook,-1,style=wxLC_REPORT|wxSUNKEN_BORDER)
  +    self.data=wxTextCtrl(split2,-1,style=wxTE_MULTILINE)
  +
  +    # attach the panes to the frame
  +    split1.SplitVertically(self.tree, notebook)
  +    notebook.AddPage(split2, 'referenced')
  +    notebook.AddPage(self.dependencies, 'dependencies')
  +    split2.SplitHorizontally(self.list, self.data)
  +    self.SetTopWindow(frame)
  +    frame.Show(true)
  +    
  +    # resize
  +    split1.SetMinimumPaneSize(20)
  +    split2.SetMinimumPaneSize(20)
  +    split1.SetSashPosition(300,true)
  +    split2.SetSashPosition(200)
  +    
  +    # wire up the events
  +    EVT_TREE_SEL_CHANGED(self, self.tree.GetId(), self.selectTree)
  +    EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.selectItem)
  +    EVT_LIST_ITEM_SELECTED(self, self.dependencies.GetId(), self.selectItem2)
  +    return true
  +    
  +  # list all modules and their projects
  +  def load(self,files):
  +    root = self.tree.AddRoot(files[0])
  +    self.workspace = load(files[0])
  +    names=Module.list.keys()
  +    names.sort()
  +    for name in names:
  +      module=Module.list[name]
  +      parent=self.mItem[name]=self.tree.AppendItem(root,name)
  +      self.tree.SetPyData(parent,module)
  +      for project in module.project:
  +        self.pItem[project.name]=self.tree.AppendItem(parent,project.name)
  +        self.tree.SetPyData(self.pItem[project.name],project)
  +
  +    self.tree.Expand(root)
  +
  +  # select a single feed and display titles from each item
  +  def selectTree(self, event):
  +    self.showProject(self.tree.GetPyData(event.GetItem()))
  +
  +  def showProject(self,project):
  +    if not project or not isinstance(project,Project): return
  +
  +    # gather a list of projects which reference this project
  +    self.items=[]
  +    for parent in Project.list.values():
  +      list=parent.depend+parent.option
  +      if parent.ant: list+=parent.ant.depend
  +      for depend in list:
  +        if depend.project==project.name:
  +          self.items.append(parent.name)
  +
  +    # display the list, sorted by name
  +    self.list.DeleteAllItems()
  +    if not self.list.GetColumn(0): 
  +      self.list.InsertColumn(0, 'Cross Reference')
  +      self.items.sort()
  +    for i in range(0,len(self.items)): 
  +      row=self.list.InsertStringItem(i,self.items[i])
  +      self.list.SetItemData(row,i)
  +
  +    self.list.SetColumnWidth(0,wxLIST_AUTOSIZE_USEHEADER)
  +
  +    # display the project definition
  +    import StringIO
  +    data = StringIO.StringIO()
  +    xmlize('project',project,data,)
  +    self.data.Clear()
  +    data.seek(0)
  +    self.data.AppendText(data.read())
  +    self.data.ShowPosition(0)
  +    
  +    # gather a list of project dependencies unrolled to build
  +    self.build_sequence = dependencies(project.name, project.depend)
  +    
  +    # display the project dependencies
  +    self.dependencies.DeleteAllItems()
  +    if not self.dependencies.GetColumn(0): 
  +      self.dependencies.InsertColumn(0, 'Build sequence')
  +      
  +    for i in range(0,len(self.build_sequence)): 
  +      row=self.dependencies.InsertStringItem(i,self.build_sequence[i].name)
  +      self.dependencies.SetItemData(row,i)
  +    
  +    self.list.SetColumnWidth(0,wxLIST_AUTOSIZE_USEHEADER)
  +
  +    
  +  # show the xml description for a single item
  +  def selectItem(self, event):
  +    project=Project.list[self.items[event.GetItem().GetData()]]
  +    self.showProject(project)
  +
  +    # expand the associated module and select the project
  +    self.tree.Expand(self.mItem[project.module])
  +    self.tree.SelectItem(self.pItem[project.name])
  +
  +  # show the xml description for a single item
  +  def selectItem2(self, event):
  +    project=Project.list[self.build_sequence[event.GetItem().GetData()].name]
  +    self.showProject(project)
  +
  +    # expand the associated module and select the project
  +    self.tree.Expand(self.mItem[project.module])
  +    self.tree.SelectItem(self.pItem[project.name])
  +    
  +if __name__ == '__main__':
  +  app = gumpview(0)
  +  app.load(sys.argv[1:] or [default.workspace])
  +  app.MainLoop()
  
  
  
  1.4       +59 -59    jakarta-gump/python/orphans.py
  
  Index: orphans.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/orphans.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- orphans.py	24 Apr 2003 22:51:19 -0000	1.3
  +++ orphans.py	24 Apr 2003 22:57:54 -0000	1.4
  @@ -1,59 +1,59 @@
  -#!/usr/bin/python
  -"""
  -	Look for obsolete installed packages, cvs checkouts, and build
  -	directories.
  -"""
  -
  -from xml.sax import parse
  -from xml.sax.handler import ContentHandler
  -from glob import glob
  -import os
  -
  -class Workspace(ContentHandler):
  -    cvsdir = None
  -    pkgdir = None
  -    logdir = None
  -    basedir = None
  -    jardir = ""
  -    modules=[]
  -    packages=[]
  -    def startElement(self, name, attrs):
  -        if name == 'workspace':
  -            attrs=dict(attrs)
  -            self.pkgdir = attrs['pkgdir']
  -            self.cvsdir = attrs['cvsdir']
  -            self.basedir = attrs['basedir']
  -            if 'jardir' in attrs: self.jardir = attrs['jardir']
  -            self.logdir = attrs['logdir']
  -        if name == 'module':
  -            attrs=dict(attrs)
  -            self.modules.append(attrs['name'])
  -        if name == 'project':
  -            attrs=dict(attrs)
  -        if 'home' in attrs and attrs['home'].find(self.pkgdir) ==0:
  -            self.packages.append(attrs['home'].replace('\\','/'))
  -
  -workspace=Workspace()
  -parse(open('work/merge.xml'),workspace)
  -
  -# orphan packages
  -for dir in glob(workspace.pkgdir+'/*'):
  -    if not dir.replace('\\','/') in workspace.packages:
  -        if os.path.isdir(dir): print dir.replace('/',os.sep)
  -
  -# orphan cvs checkouts
  -for dir in glob(workspace.cvsdir+'/*'):
  -    if dir.endswith('Entries') or dir.endswith('Entries.log'): continue
  -    if not dir[len(workspace.cvsdir)+1:] in workspace.modules:
  -        if os.path.isdir(dir): print dir.replace('/',os.sep)
  -
  -# orphan builds
  -for dir in glob(workspace.basedir+'/*'):
  -    if not dir[len(workspace.basedir)+1:] in workspace.modules:
  -        dir=dir.replace('/',os.sep)
  -        if dir==workspace.basedir.replace('/',os.sep)+os.sep+"dist": continue
  -        if dir==workspace.jardir.replace('/',os.sep): continue
  -        if dir==workspace.logdir.replace('/',os.sep): continue
  -        if dir==workspace.cvsdir.replace('/',os.sep): continue
  -        if os.path.isdir(dir): print dir
  -
  +#!/usr/bin/python
  +"""
  +        Look for obsolete installed packages, cvs checkouts, and build
  +        directories.
  +"""
  +
  +from xml.sax import parse
  +from xml.sax.handler import ContentHandler
  +from glob import glob
  +import os
  +
  +class Workspace(ContentHandler):
  +    cvsdir = None
  +    pkgdir = None
  +    logdir = None
  +    basedir = None
  +    jardir = ""
  +    modules=[]
  +    packages=[]
  +    def startElement(self, name, attrs):
  +        if name == 'workspace':
  +            attrs=dict(attrs)
  +            self.pkgdir = attrs['pkgdir']
  +            self.cvsdir = attrs['cvsdir']
  +            self.basedir = attrs['basedir']
  +            if 'jardir' in attrs: self.jardir = attrs['jardir']
  +            self.logdir = attrs['logdir']
  +        if name == 'module':
  +            attrs=dict(attrs)
  +            self.modules.append(attrs['name'])
  +        if name == 'project':
  +            attrs=dict(attrs)
  +        if 'home' in attrs and attrs['home'].find(self.pkgdir) ==0:
  +            self.packages.append(attrs['home'].replace('\\','/'))
  +
  +workspace=Workspace()
  +parse(open('work/merge.xml'),workspace)
  +
  +# orphan packages
  +for dir in glob(workspace.pkgdir+'/*'):
  +    if not dir.replace('\\','/') in workspace.packages:
  +        if os.path.isdir(dir): print dir.replace('/',os.sep)
  +
  +# orphan cvs checkouts
  +for dir in glob(workspace.cvsdir+'/*'):
  +    if dir.endswith('Entries') or dir.endswith('Entries.log'): continue
  +    if not dir[len(workspace.cvsdir)+1:] in workspace.modules:
  +        if os.path.isdir(dir): print dir.replace('/',os.sep)
  +
  +# orphan builds
  +for dir in glob(workspace.basedir+'/*'):
  +    if not dir[len(workspace.basedir)+1:] in workspace.modules:
  +        dir=dir.replace('/',os.sep)
  +        if dir==workspace.basedir.replace('/',os.sep)+os.sep+"dist": continue
  +        if dir==workspace.jardir.replace('/',os.sep): continue
  +        if dir==workspace.logdir.replace('/',os.sep): continue
  +        if dir==workspace.cvsdir.replace('/',os.sep): continue
  +        if os.path.isdir(dir): print dir
  +
  
  
  
  1.2       +66 -66    jakarta-gump/python/ruper.py
  
  Index: ruper.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/ruper.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ruper.py	24 Apr 2003 17:38:55 -0000	1.1
  +++ ruper.py	24 Apr 2003 22:57:54 -0000	1.2
  @@ -1,66 +1,66 @@
  -#!/usr/bin/python
  -"""
  -	Resource updater for Gump
  -"""
  -
  -import os, os.path, sys, urllib
  -from gumpconf import *
  -
  -# output debug messages or not
  -debug = True #True
  -
  -# Repository
  -class RuperRepository(object):
  -  def __init__(self,url,type):
  -    self.url=url
  -    self.type=type
  -    
  -  def resolve(self, resource):
  -    # FIXME (nicolaken)
  -    # delegate the getting of a resource to an outside file
  -    # named after the repository type
  -    if self.type == 'maven':
  -      # not necessarily Maven uses our resource.standardName()
  -      if resource.type == 'jar':
  -        resolvedUrl = '%s/%s/jars/%s-%s.jar' % (self.url,resource.name,resource.name,resource.version)
  -      else:
  -        raise Error, 'Unknown Resource Type; type: '+type
  -    else:
  -      raise Error, 'Unknown Repository; type: '+type
  -
  -    return resolvedUrl
  -  
  -  def download(self, resource, destinationDir):
  -    if not os.path.isdir(destinationDir):
  -      raise IOError, 'This method needs a directory, instead it got:'+destinationDir
  -    
  -    remoteurl = self.resolve(resource)
  -    urllib.urlretrieve(remoteurl, '%s/%s' % (destinationDir,resource.standardName()))
  -
  -
  -  
  -# Resource
  -class RuperResource(object):
  -  def __init__(self,name,version,type):
  -    self.name=name
  -    self.version=version
  -    self.type=type
  -    
  -  def standardName(self):
  -    if self.type == 'jar':
  -      return '%s-%s.jar' % (self.name,self.version)
  -    else:
  -      raise Error, 'Unknown Resource Type; type: '+type
  -
  -    
  - 
  -if __name__=='__main__':
  -  os.chdir(dir.base)
  -  resource = RuperResource('log4j','1.3.4','jar')
  -  print resource.standardName()
  -  repository = RuperRepository('http://www.ibiblio.org/maven','maven')
  -  print repository.resolve(resource)
  -  repository.download(resource,dir.cache)
  -
  -
  -  
  +#!/usr/bin/python
  +"""
  +        Resource updater for Gump
  +"""
  +
  +import os, os.path, sys, urllib
  +from gumpconf import *
  +
  +# output debug messages or not
  +debug = True #True
  +
  +# Repository
  +class RuperRepository(object):
  +  def __init__(self,url,type):
  +    self.url=url
  +    self.type=type
  +    
  +  def resolve(self, resource):
  +    # FIXME (nicolaken)
  +    # delegate the getting of a resource to an outside file
  +    # named after the repository type
  +    if self.type == 'maven':
  +      # not necessarily Maven uses our resource.standardName()
  +      if resource.type == 'jar':
  +        resolvedUrl = '%s/%s/jars/%s-%s.jar' % (self.url,resource.name,resource.name,resource.version)
  +      else:
  +        raise Error, 'Unknown Resource Type; type: '+type
  +    else:
  +      raise Error, 'Unknown Repository; type: '+type
  +
  +    return resolvedUrl
  +  
  +  def download(self, resource, destinationDir):
  +    if not os.path.isdir(destinationDir):
  +      raise IOError, 'This method needs a directory, instead it got:'+destinationDir
  +    
  +    remoteurl = self.resolve(resource)
  +    urllib.urlretrieve(remoteurl, '%s/%s' % (destinationDir,resource.standardName()))
  +
  +
  +  
  +# Resource
  +class RuperResource(object):
  +  def __init__(self,name,version,type):
  +    self.name=name
  +    self.version=version
  +    self.type=type
  +    
  +  def standardName(self):
  +    if self.type == 'jar':
  +      return '%s-%s.jar' % (self.name,self.version)
  +    else:
  +      raise Error, 'Unknown Resource Type; type: '+type
  +
  +    
  + 
  +if __name__=='__main__':
  +  os.chdir(dir.base)
  +  resource = RuperResource('log4j','1.3.4','jar')
  +  print resource.standardName()
  +  repository = RuperRepository('http://www.ibiblio.org/maven','maven')
  +  print repository.resolve(resource)
  +  repository.download(resource,dir.cache)
  +
  +
  +  
  
  
  

Mime
View raw message