- Timestamp:
- 08/23/06 16:07:04 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/scons/utils.py
r1135 r1176 1 import os 1 2 import glob 2 import os3 3 4 4 def generate(env): … … 15 15 env.AddCustomPath = AddCustomPath 16 16 17 def CreateDist(target, sources, descend="stage"): 18 import tarfile 19 base_name = str(target).split('.tar')[0] 20 (target_dir, dir_name) = os.path.split(base_name) 21 # create the target directory if it does not exist 22 if target_dir and not os.path.exists(target_dir): 23 os.makedirs(target_dir) 24 tar_format = "bz2" 25 tar = tarfile.open(str(target)+".tar.bz2", "w:%s" % (tar_format,)) 26 if os.path.exists(descend): os.chdir(descend) 27 taritems = [] 28 excludedirs = [".svn"] 29 for item in sources: 30 if os.path.isdir(item): 31 for root, dirs, files in os.walk(str(item)): 32 if not root in excludedirs: 33 for name in files: 34 if not name.startswith("."): 35 taritems.append(os.path.join(root, name)) 36 else: 37 taritems.append(item) 38 for item in taritems: 39 print "Adding to archive: %s/%s" % (dir_name, item) 40 tar.add(item,'%s/%s' % (dir_name, item)) 41 tar.close() 42 return env.Entry(traget_dir) 43 44 env.CreateDist = CreateDist 45 17 46 def exists(env): 18 return true 47 try: 48 import os 49 import glob 50 import tarfile 51 except ImportError: 52 return False 53 else: 54 return True
Note:
See TracChangeset
for help on using the changeset viewer.