Changeset 1184
- Timestamp:
- 08/25/06 16:34:59 (18 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SConstruct
r1182 r1184 3 3 import distutils.sysconfig 4 4 import platform 5 import SCons 5 6 # scons plug-ins 6 7 #from installtree import InstallTree 7 8 8 version = "2.1.0b"9 9 moduledir = distutils.sysconfig.get_python_lib() 10 10 if platform.architecture()[0] == '64bit': … … 31 31 32 32 env = Environment( toolpath = ['./scons'], 33 tools = ["default", " installtree", "casa",34 " utils"],33 tools = ["default", "casa", "archiver", "utils", 34 "quietinstall"], 35 35 ENV = { 'PATH' : os.environ[ 'PATH' ], 36 36 'HOME' : os.environ[ 'HOME' ] }, … … 76 76 env = conf.Finish() 77 77 78 env[" stage_dir"] = Dir("#/stage/asap")78 env["version"] = "2.1.0b" 79 79 80 80 # general CPPFLAGS … … 85 85 env.Append(CPPFLAGS=['-fPIC', '-D__x86_64__', '-DAIPS_64B']) 86 86 87 if env["PLATFORM"] == "darwin":88 env['SHLINKFLAGS'] = '$LINKFLAGS -bundle'89 #env['SHLIBSUFFIX'] = '.dylib'90 91 87 if env['mode'] == 'release': 92 88 env.Append(LINKFLAGS=['-Wl,-O1']) 89 90 # Export for SConscript files 93 91 Export("env") 94 92 93 # build library 95 94 so = env.SConscript("src/SConscript", build_dir="build", duplicate=0) 96 stagebuild = env.Install(env["stage_dir"], so ) 97 stagedoc = env.Install("stage", ["doc/README", "doc/CHANGELOG"] ) 98 stagepys = env.SConscript("python/SConscript") 99 stage0 = env.Install("stage", "bin/install") 100 stage1 = env.Install("stage/bin", ["bin/asap", "bin/asap_update_data"]) 101 stage2 = env.Install("stage/data", "share/ipythonrc-asap") 102 env.Alias('stage', [stagebuild,stagedoc,stagepys, stage0, stage1, stage2]) 103 # install locally 104 asapmod = env.InstallTree(dest_dir = os.path.join(env["moduledir"], "asap"), 105 src_dir = "stage", 106 includes = ['asap','data'], 107 excludes = []) 108 asapbin = env.Install(os.path.join(env["prefix"], "bin"), "bin/asap") 109 env.Alias('install', [asapmod, asapbin]) 95 96 # install targets 97 somod = env.Install("$moduledir/asap", so ) 98 pymods = env.Install("$moduledir/asap", env.SGlob("python/*.py")) 99 bins = env.Install("$prefix/bin", ["bin/asap", "bin/asap_update_data"]) 100 shares = env.Install("$moduledir/data", "share/ipythonrc-asap") 101 env.Alias('install', [somod, pymods, bins, shares]) 102 103 # install aips++ data repos 104 rootdir=None 105 outdir = os.path.join(env["moduledir"],'asap','data') 106 sources = ['ephemerides','geodetic'] 107 if os.path.exists("/nfs/aips++/data"): 108 rootdir = "/nfs/aips++/data" 109 elif os.path.exists("data"): 110 rootdir = "data" 111 if rootdir is not None: 112 ofiles, ifiles = env.WalkDirTree(outdir, rootdir, sources) 113 data = env.InstallAs(ofiles, ifiles) 114 env.Alias('install', data) 115 110 116 # make binary distribution 111 117 if len(env["makedist"]): 112 md =env.CreateDist("dist/asap-%s-%s" % (version, env["makedist"]), 113 ["install", "README", "CHANGELOG", "asap", "data", 114 "bin"], 115 "stage") 118 env["stagedir"] = "asap-%s-%s" % (env["version"], env["makedist"]) 119 env.Command('Staging distribution for archive in %s' % env["stagedir"], 120 '', env.MessageAction) 121 env.QInstall("$stagedir/asap", [so, pymods] ) 122 env.QInstall("$stagedir/bin", ["bin/asap", "bin/asap_update_data"]) 123 env.QInstall("$stagedir/install", ["bin/install"]) 124 env.QInstall("$stagedir/data", "share/ipythonrc-asap") 125 if os.path.exists("/nfs/aips++/data"): 126 rootdir = "/nfs/aips++/data" 127 sources = ['ephemerides','geodetic'] 128 outdir = os.path.join(env["stagedir"],'asap','data') 129 ofiles, ifiles = env.WalkDirTree(outdir, rootdir, sources) 130 env.QInstallAs(ofiles, ifiles) 131 arch = env.Archiver(os.path.join("dist",env["stagedir"]), 132 env["stagedir"]) 133 env.AddPostAction(arch, Delete("$stagedir")) 134 -
trunk/scons/utils.py
r1178 r1184 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() 17 def WalkDirTree(targetroot, sourceroot, sources): 18 ifiles = [] 19 ofiles = [] 20 for s in sources: 21 if os.path.isdir(os.path.join(sourceroot ,s)): 22 for d,ld,f in os.walk(os.path.join(sourceroot ,s)): 23 for fl in f: 24 ifile = os.path.join(d, fl) 25 ifiles.append(ifile) 26 ofile = ifile.replace(sourceroot, targetroot) 27 ofiles.append(ofile) 28 return ofiles, ifiles 29 env.WalkDirTree = WalkDirTree 42 30 43 env.CreateDist = CreateDist 31 def null_action(target, source, env): return 0 32 33 def message(target, source, env): 34 return "%s" % target[0] 35 env.MessageAction = env.Action(null_action, message) 44 36 45 37 def exists(env): … … 47 39 import os 48 40 import glob 49 import tarfile50 41 except ImportError: 51 42 return False
Note:
See TracChangeset
for help on using the changeset viewer.