gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nicola...@apache.org
Subject cvs commit: jakarta-gump/python/gump build.py check.py conf.py gen.py update.py
Date Thu, 08 May 2003 06:35:41 GMT
nicolaken    2003/05/07 23:35:41

  Modified:    python/gump build.py check.py conf.py gen.py update.py
  Log:
  Refactored the args handling out of update.py into conf.py and made all
  .pys use that.
  
  The new format is
  
   python xx.py [-w workspace.xml] argument
  
  Revision  Changes    Path
  1.6       +5 -12     jakarta-gump/python/gump/build.py
  
  Index: build.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/build.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- build.py	5 May 2003 07:23:06 -0000	1.5
  +++ build.py	8 May 2003 06:35:41 -0000	1.6
  @@ -18,7 +18,7 @@
   import logging
   
   from gump import load, buildSequence
  -from gump.conf import dir, default
  +from gump.conf import dir, default, handleArgv
   from gump.model import Workspace, Module, Project
   
   ###############################################################################
  @@ -186,17 +186,10 @@
     #set verbosity to show all messages of severity >= default.logLevel
     log.setLevel(default.logLevel)
   
  -  # 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
  -
  +  args = handleArgv(sys.argv)
  +  ws=args[0]
  +  ps=args[1]
  +  
     # get parsed workspace definition
     workspace=load(ws)
     # run gump
  
  
  
  1.10      +6 -12     jakarta-gump/python/gump/check.py
  
  Index: check.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/check.py,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- check.py	7 May 2003 12:42:22 -0000	1.9
  +++ check.py	8 May 2003 06:35:41 -0000	1.10
  @@ -10,7 +10,7 @@
   import logging
   
   from gump import load, buildSequence
  -from gump.conf import dir, default
  +from gump.conf import dir, default, handleArgv
   from gump.model import Workspace, Module, Project
   
   ###############################################################################
  @@ -128,11 +128,12 @@
         print "  ",currentmodule.description
         print
         print "   project url: " , currentproject.url.href
  +      print "   module  url: " , currentmodule.url.href
         print "   module  cvs: " , currentmodule.cvsroot()
         if currentmodule.redistributable:
           print  
           print "   NOTE: You can also get it in the Gump jar repository." 
  -        print "         See http://jakarta.apache.org/gump/ for details."
  +        print "         See http://jakarta.apache,org/gump/ for details."
           
       else:
         print "   Gump doesn't know about it. Or it's wrong, or you have to "
  @@ -148,16 +149,9 @@
     #set verbosity to show all messages of severity >= default.logLevel
     log.setLevel(default.logLevel)
     
  -  # 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
  +  args = handleArgv(sys.argv)
  +  ws=args[0]
  +  ps=args[1]
   
     # get parsed workspace definition
     workspace=load(ws)
  
  
  
  1.5       +25 -3     jakarta-gump/python/gump/conf.py
  
  Index: conf.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/conf.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- conf.py	5 May 2003 21:09:02 -0000	1.4
  +++ conf.py	8 May 2003 06:35:41 -0000	1.5
  @@ -94,4 +94,26 @@
       if not os.path.exists(dir.work): os.mkdir(dir.work)
   
       if dir.base not in sys.path: sys.path.insert(0, dir.base)
  +        
  +def handleArgv(argv):
  +  args = []  
  +  # the workspace
  +  if len(argv)>2 and argv[1] in ['-w','--workspace']:
  +    args.append(argv[2])
  +    del argv[1:3]
  +  else:
  +    args.append(default.workspace)
  +    print
  +    print " No workspace defined, using default:"
  +    print "  " , default.workspace
  +    print
  +    
  +  # determine which modules the user desires (wildcards are permitted)
  +  if len(argv)>2:
  +   args.append(argv[1] or '*')
  +   if args[1]=='all': args[1]='*'
  +  else:
  +   args.append(default.project)  
  +      
  +  return args
       
  
  
  
  1.7       +5 -7      jakarta-gump/python/gump/gen.py
  
  Index: gen.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/gen.py,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- gen.py	5 May 2003 07:23:07 -0000	1.6
  +++ gen.py	8 May 2003 06:35:41 -0000	1.7
  @@ -139,10 +139,8 @@
     log.setLevel(default.logLevel)
   
     # load commandline args or use default values
  -  if len(sys.argv)>1 :
  -    ws=sys.argv[1]
  -  else:
  -    ws=default.workspace
  +  args = handleArgv(sys.argv)
  +  ws=args[0]
   
     workspace=load(ws)
   
  
  
  
  1.4       +7 -10     jakarta-gump/python/gump/update.py
  
  Index: update.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/update.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- update.py	5 May 2003 18:54:49 -0000	1.3
  +++ update.py	8 May 2003 06:35:41 -0000	1.4
  @@ -104,16 +104,13 @@
     except:
       pass
   
  +  args = handleArgv(sys.argv)
  +  
     # load the workspace
  -  if len(sys.argv)>2 and sys.argv[1] in ['-w','--workspace']:
  -    workspace=load(sys.argv[2])
  -    del sys.argv[1:3]
  -  else:
  -    workspace=load(default.workspace)
  +  workspace=load(args[0])
   
     # determine which modules the user desires (wildcards are permitted)
  -  selected=sys.argv[1:] or ['*']
  -  if selected[0]=='all': selected[0]='*'
  +  selected=args[1]
   
     # determine which modules are available
     modules=Module.list.keys()
  
  
  

Mime
View raw message