You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by ni...@apache.org on 2003/04/26 12:03:54 UTC

cvs commit: jakarta-gump/python build.py gen.py gumpconf.py gumputil.py

nicolaken    2003/04/26 03:03:53

  Modified:    python   build.py gen.py gumpconf.py gumputil.py
  Log:
  Remove the os.path.chdir calls and use absolutized paths, that
  refer to the base gump install.
  
  Revision  Changes    Path
  1.8       +5 -2      jakarta-gump/python/build.py
  
  Index: build.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/build.py,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- build.py	26 Apr 2003 08:46:19 -0000	1.7
  +++ build.py	26 Apr 2003 10:03:53 -0000	1.8
  @@ -153,8 +153,11 @@
   
   # static void main()
   if __name__=='__main__':
  +  # -----------DISABLED-----------
  +  # use all absolutized pathnames
  +  # ------------------------------
     # cd into the base Gump dir; all dirs are relative to it
  -  os.chdir(dir.base)
  +  #os.chdir(dir.base)
       
     # load commandline args or use default values
     if len(sys.argv)>1 :
  @@ -168,7 +171,7 @@
       ps=default.project    
   
     # get parsed workspace definition
  -  workspace=load(ws)
  +  workspace=load( gumpPath(ws) )
     # print info on the definition
     dumpDeps(workspace, ps);          
     sys.exit(0)
  
  
  
  1.10      +22 -21    jakarta-gump/python/gen.py
  
  Index: gen.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gen.py,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- gen.py	26 Apr 2003 09:21:42 -0000	1.9
  +++ gen.py	26 Apr 2003 10:03:53 -0000	1.10
  @@ -43,9 +43,9 @@
          # use compact form for elements without children
          if text.strip():
              f.write( '%s<%s>%s</%s>\n' % (indent.encode(encoding),' '.join(attrs).encode(encoding),text.strip().encode(encoding),nodeName))
  -        else:
  -               f.write( '%s<%s/>\n' % (indent.encode(encoding),' '.join(attrs).encode(encoding)))
  -     else:
  +       else:
  +           f.write( '%s<%s/>\n' % (indent.encode(encoding),' '.join(attrs).encode(encoding)))
  +    else:
          # use full form for elements with children
          f.write( '%s<%s>\n' % (indent.encode(encoding),' '.join(attrs).encode(encoding)))
          newindent=indent+delta
  @@ -53,33 +53,34 @@
            if isinstance(var,list):
               # multiple valued elements
               for e in var: xmlize(name,e,f,newindent,delta)
  -          elif isinstance(var,Single):
  +         elif isinstance(var,Single):
               # single valued elements
               xmlize(name,var.delegate,f,newindent,delta)
               f.write( '%s</%s>\n' % (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)
  +  # -----------DISABLED-----------
  +  # use all absolutized pathnames
  +  # ------------------------------
  +  # 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
  +  # load commandline args or use default values
  +  if len(sys.argv)>1 :
  +    ws=sys.argv[1]
  +  else:
  +    ws=default.workspace
   
  -workspace=load(ws)
  +  workspace=load(gumpPath(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()
  +  try:
  +    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.9       +11 -4     jakarta-gump/python/gumpconf.py
  
  Index: gumpconf.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gumpconf.py,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- gumpconf.py	26 Apr 2003 09:21:42 -0000	1.8
  +++ gumpconf.py	26 Apr 2003 10:03:53 -0000	1.9
  @@ -3,13 +3,19 @@
       Global configuration settings for gump, done as Python classes
   """
   
  -import socket, time
  +import socket, time, os.path, sys
   
   class dir:
  -    base      = ".."
  -    cache     = "cache"
  -    work      = "work"
  +    cmdpath   = os.path.abspath(sys.argv[0])
  +    base      = os.path.normpath('%s/%s' % (os.path.dirname(cmdpath),'..'))
  +    cache     = os.path.normpath('%s/%s' % (base,'cache'))
  +    work      = os.path.normpath('%s/%s' % (base,'work'))
   
  +    if not os.path.exists(cache): os.path.mkdir(cache)
  +    if not os.path.exists(work): os.path.mkdir(work)
  +    
  +    if base not in sys.path: sys.path.insert(0, base)
  +    
   class default:
       workspace  = socket.gethostname().split('.')[0] + ".xml"
       project    = "krysalis-ruper-test"
  @@ -18,3 +24,4 @@
       debug      = True
       antCommand = 'java org.apache.tools.ant.Main -Dbuild.sysclasspath=only'
       syncCommand= 'cp -Rf'
  +
  
  
  
  1.6       +5 -1      jakarta-gump/python/gumputil.py
  
  Index: gumputil.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gumputil.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- gumputil.py	26 Apr 2003 09:21:42 -0000	1.5
  +++ gumputil.py	26 Apr 2003 10:03:53 -0000	1.6
  @@ -54,4 +54,8 @@
     print ' ****************************************************************'
     print
     print
  -                        
  +
  +# returns the path absolutized relative to the base gump dir
  +def gumpPath(path):
  +  return os.path.normpath('%s/%s' % (dir.base,path))
  +