/[ascend]/trunk/scons/disttar.py
ViewVC logotype

Diff of /trunk/scons/disttar.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2149 by johnpye, Thu May 4 07:35:43 2006 UTC revision 2150 by mahesh, Tue Feb 16 06:08:57 2010 UTC
# Line 1  Line 1 
1  # DistTarBuilder: tool to generate tar files using SCons  # DistTarBuilder: tool to generate tar files using SCons
2  # Copyright (C) 2005, 2006  Matthew A. Nicholson  # Copyright (C) 2005, 2006  Matthew A. Nicholson
3    # Copyright (C) 2006-2010 John Pye
4  #  #
5  # This file is free software; you can redistribute it and/or  # This file is free software; you can redistribute it and/or
6  # modify it under the terms of the GNU Lesser General Public  # modify it under the terms of the GNU Lesser General Public
# Line 14  Line 15 
15  # License along with this library; if not, write to the Free Software  # License along with this library; if not, write to the Free Software
16  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  #  #
 # vim: set et sw=3 tw=0 fo=awqorc ft=python:  
18    
19  import os,sys  import os,sys
20  from SCons.Script import *  from SCons.Script import *
21    import re
22    
23  def disttar_emitter(target,source,env):  def disttar_emitter(target,source,env):
24    
# Line 25  def disttar_emitter(target,source,env): Line 26  def disttar_emitter(target,source,env):
26    
27      excludeexts = env.Dictionary().get('DISTTAR_EXCLUDEEXTS',[])      excludeexts = env.Dictionary().get('DISTTAR_EXCLUDEEXTS',[])
28      excludedirs = env.Dictionary().get('DISTTAR_EXCLUDEDIRS',[])      excludedirs = env.Dictionary().get('DISTTAR_EXCLUDEDIRS',[])
29        re1 = env.Dictionary().get('DISTTAR_EXCLUDERES',[])
30        excluderes = [re.compile(r) for r in re1]
31    
32      # assume the sources are directories... need to check that      # assume the sources are directories... need to check that
33      for item in origsource:      for item in origsource:
# Line 41  def disttar_emitter(target,source,env): Line 44  def disttar_emitter(target,source,env):
44                  ext = os.path.splitext(name)                  ext = os.path.splitext(name)
45                  if not ext[1] in excludeexts:                  if not ext[1] in excludeexts:
46                      relpath = os.path.join(root,name)                      relpath = os.path.join(root,name)
47                      #print "Adding source",relpath                      failre = False
48                      source.append(relpath)                      for r in excluderes:
49                            #print "Match(  %s   against   %s)" % (r,relpath)
50                            if r.search(relpath):
51                                failre = True
52                                #print "Excluding '%s' from tarball" % relpath
53                                break
54                        if not failre:
55                            #print "Adding source",relpath
56                            source.append(relpath)
57              for d in excludedirs:              for d in excludedirs:
58                  if d in dirs:                  if d in dirs:
59                      dirs.remove(d)  # don't visit CVS directories etc                      dirs.remove(d)  # don't visit CVS directories etc
# Line 128  def exists(env): Line 139  def exists(env):
139          return False          return False
140      else:      else:
141          return True          return True
142    
143    # vim:set ts=4 sw=4 noexpandtab:
144    

Legend:
Removed from v.2149  
changed lines
  Added in v.2150

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22