gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject cvs commit: jakarta-gump/python/gump rss.py document.py
Date Tue, 09 Sep 2003 19:37:07 GMT
ajack       2003/09/09 12:37:07

  Modified:    python/gump rss.py document.py
  Log:
  1) Dump the context tree into documentation (still trying to debug missing projects)
  2) Some work on RSS
  
  Revision  Changes    Path
  1.3       +48 -6     jakarta-gump/python/gump/rss.py
  
  Index: rss.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/rss.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- rss.py	29 Aug 2003 00:20:22 -0000	1.2
  +++ rss.py	9 Sep 2003 19:37:07 -0000	1.3
  @@ -84,7 +84,9 @@
       
       db=StatisticsDB()       
               
  -    gumprss=open(workspace.logdir + '/index.rss','w')
  +    rssFile=os.path.normpath(os.path.join(workspace.logdir,'index.rss'))
  +    
  +    gumprss = open(rssFile,'w')
       gumprss.write("""<rss version="2.0"
     xmlns:admin="http://webns.net/mvcb/" 
     xmlns:dc="http://purl.org/dc/elements/1.1/" 
  @@ -115,7 +117,9 @@
                         and not s.currentState == STATUS_PREREQ_FAILURE \
                         and not s.currentState == STATUS_COMPLETE :
                           project=pctxt.project
  -                    
  +                            
  +                        log.info("RSS written for " + pctxt.name); 
  +    
                           link = gumproot + '/' + mctxt.name + '/' + pctxt.name + 'index.html'
                      
                           datestr=time.strftime('%Y-%m-%d')
                           timestr=time.strftime('%H%M')
  @@ -138,4 +142,42 @@
         </channel>
       </rss>
       """)
  -    gumprss.close()                                            
  \ No newline at end of file
  +    gumprss.close()                                 
  +    
  +    log.info("RSS Feed written" + rssFile);           
  +    
  +             
  +
  +# static void main()
  +if __name__=='__main__':
  +
  +  # init logging
  +  logging.basicConfig()
  +
  +  #set verbosity to show all messages of severity >= default.logLevel
  +  log.setLevel(default.logLevel)
  +  
  +  args = handleArgv(sys.argv,0)
  +  ws=args[0]
  +  ps=args[1]
  +
  +  context=GumpContext()
  +  
  +      
  +  # get parsed workspace definition
  +  from gump import load
  +  workspace=load(ws, context)
  +
  +  #
  +  #from gump.check import checkEnvironment
  +  #checkEnvironment(workspace, context)
  +  
  +  #
  +  # Store for later
  +  #
  +  from gump.logic import getGumpSetForProjectExpression
  +  context.gumpset=getGumpSetForProjectExpression(ps)
  +  
  +  # Document
  +  rss(workspace, context);
  +    
  \ No newline at end of file
  
  
  
  1.12      +46 -24    jakarta-gump/python/gump/document.py
  
  Index: document.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/document.py,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- document.py	9 Sep 2003 14:18:08 -0000	1.11
  +++ document.py	9 Sep 2003 19:37:07 -0000	1.12
  @@ -82,45 +82,48 @@
        isFullGumpSet
   
   def documentText(workspace,context,moduleFilterList=None,projectFilterList=None):    
  +    documentTextToFile(sys.stdout,workspace,context,moduleFilterList,projectFilterList)
       
  -    print "Workspace Status : " + stateName(context.status)
  -    print "Workspace Secs : " + str(context.elapsedSecs())
  -    print "Modules: " + str(len(context.subcontexts))
  +def documentTextToFile(f,workspace,context,moduleFilterList=None,projectFilterList=None):
   
  +    
  +    f.write("Workspace Status : " + stateName(context.status) + "\n")
  +    f.write("Workspace Secs : " + str(context.elapsedSecs()) + "\n")
  +    f.write("Modules: " + str(len(context.subcontexts)) + "\n")
       for note in context.annotations:
  -        print " - " + str(note)
  +        f.write(" - " + str(note) + "\n")
       for mctxt in context:
           mname=mctxt.name
           if moduleFilterList and not mctxt.module in moduleFilterList: continue        
           mname=mctxt.name
  -        print " Module [" + mname + "] Status: " + stateName(mctxt.status)
  -        print " Projects: " + str(len(mctxt.subcontexts))
  +        f.write(" Module [" + mname + "] Status: " + stateName(mctxt.status) + "\n")
  +        f.write(" Projects: " + str(len(mctxt.subcontexts)) + "\n")
           for note in mctxt.annotations:
  -            print "  - " + str(note)
  +            f.write("  - " + str(note) + "\n")
           for work in mctxt.worklist:
  -            print "    Work : " + stateName(work.status)
  +            f.write("    Work : " + stateName(work.status) + "\n")
               if isinstance(work,CommandWorkItem):
  -                print "    Work Name : " + work.command.name
  -                print "    Work Cmd  : " + work.command.formatCommandLine()
  +                f.write("    Work Name : " + work.command.name + "\n")
  +                f.write("    Work Cmd  : " + work.command.formatCommandLine() + "\n")
                   if work.command.cwd:
  -                    print "    Work Cwd  : " + work.command.cwd
  -                print "    Work Exit : " + str(work.result.exit_code)
  +                    f.write("    Work Cwd  : " + work.command.cwd + "\n")
  +                f.write("    Work Exit : " + str(work.result.exit_code) + "\n")
           
           for pctxt in mctxt:
               pname=pctxt.name
               if projectFilterList and not pctxt.project in projectFilterList: continue
               
  -            print "  Project [" + pname + "] Status: " + stateName(pctxt.status)
  -            print "   Work [" + str(len(pctxt.worklist)) + "] [" + str(pctxt.elapsedSecs())
+ "] secs." 
  +            f.write("  Project [" + pname + "] Status: " + stateName(pctxt.status) + "\n")
  +            f.write("   Work [" + str(len(pctxt.worklist)) + "] [" + str(pctxt.elapsedSecs())
+ "] secs."  + "\n")
               for note in pctxt.annotations:
  -                print "   - " + str(note)
  +                f.write("   - " + str(note) + "\n")
               for work in pctxt.worklist:
  -                print "    Work : " + stateName(work.status)
  +                f.write("    Work : " + stateName(work.status) + "\n")
                   if isinstance(work,CommandWorkItem):
  -                    print "    Work Name : " + work.command.name
  -                    print "    Work Cmd  : " + work.command.formatCommandLine()
  +                    f.write("    Work Name : " + work.command.name + "\n")
  +                    f.write("    Work Cmd  : " + work.command.formatCommandLine() + "\n")
                       if work.command.cwd:
  -                        print "    Work Cwd  : " + work.command.cwd
  -                    print "    Work Exit : " + str(work.result.exit_code)
  +                        f.write("    Work Cwd  : " + work.command.cwd + "\n")
  +                    f.write("    Work Exit : " + str(work.result.exit_code) + "\n")
   
   def document(workspace,context,full=None,moduleFilterList=None,projectFilterList=None):
       
  @@ -199,7 +202,10 @@
           
       forrest.addPrefixedParameter('-D','project.site-dir',  \
           workspace.logdir, '=')
  -        
  +     
  +    #   
  +    # Do we just tweak forrest.properties?
  +    #
       #forrest.addPrefixedParameter('-D','project.sitemap-dir',  \
       #    docroot, '=')    
       #forrest.addPrefixedParameter('-D','project.stylesheets-dir',  \
  @@ -286,6 +292,7 @@
       titledDataInTableXDoc(x,"Email Server: ", str(workspace.mailserver))
       titledDataInTableXDoc(x,"Prefix: ", str(workspace.prefix))
       titledDataInTableXDoc(x,"Signature: ", str(workspace.signature))
  +    titledDataInTableXDoc(x,"Context Tree: ", '<link href=\'context.html\'>context</link>')
       endTableXDoc(x)
       endSectionXDoc(x)       
       
  @@ -306,7 +313,7 @@
       endXDoc(x)
       
       #
  -    # Document 
  +    # Document modules
       #
       for mctxt in context:
           mname=mctxt.name    
  @@ -314,6 +321,17 @@
           if moduleFilterList and not mctxt.module in moduleFilterList: continue    
           documentModule(workspace,wdir,mctxt.name,mctxt,db,projectFilterList)
           
  +        
  +    # Document context
  +    
  +    x=startXDoc(getWorkspaceContextDocument(workspace,wdir))
  +    headerXDoc(x,'Context')    
  +    x.write('<source>\n')
  +    documentTextToFile(x,workspace,context,moduleFilterList,projectFilterList)    
  +    x.write('</source>\n')   
  +    footerXDoc(x)
  +    endXDoc(x)
  +        
   def documentModule(workspace,wdir,modulename,modulecontext,db,projectFilterList=None):
       mdir=getModuleDir(workspace,modulename,wdir)
       
  @@ -334,8 +352,8 @@
       x.write('    <table>\n')
       pcount=0
       for pctxt in modulecontext:     
  -        pname=pctxt.name    
           if projectFilterList and not pctxt.project in projectFilterList: continue  
  +        pname=pctxt.name    
           pcount+=1
              
           (phours, pmins, psecs) 	= pctxt.elapsedTime();
  @@ -771,6 +789,10 @@
       if not workspacedir: workspacedir = getWorkspaceDir(workspace)    
       return os.path.join(workspacedir,'index.xml')
       
  +def getWorkspaceContextDocument(workspace,workspacedir=None):
  +    if not workspacedir: workspacedir = getWorkspaceDir(workspace)    
  +    return os.path.join(workspacedir,'context.xml')
  +    
   def getStatisticsDocument(workspace,statsdir=None):
       if not statsdir: statsdir = getStatisticsDir(workspace)    
       return os.path.join(statsdir,'index.xml')
  @@ -784,7 +806,7 @@
       if not moduledir: moduledir=getModuleDir(workspace, modulename)
       return os.path.join(moduledir,'index.xml')
   
  -def getProjectDocument(workspace, modulename,projectname,moduledir=None):
  +def getProjectDocument(workspace,modulename,projectname,moduledir=None):
       pname=gumpSafeName(projectname)
       if not moduledir: moduledir=getModuleDir(workspace, modulename)
       return os.path.join(moduledir,pname+'.xml')
  
  
  

Mime
View raw message