Changeset 2503


Ignore:
Timestamp:
05/14/12 11:56:38 (12 years ago)
Author:
Malte Marquarding
Message:

remove install related stuff from scons. We use python distutils for installing

Location:
trunk
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SConstruct

    r2501 r2503  
    2222    return ""
    2323
    24 def get_moduledir(prefix="/usr/local"):
    25     moduledir = distutils.sysconfig.get_python_lib(1,0, prefix)
    26     if sys.platform.startswith('linux') \
    27             and platform.architecture()[0] == '64bit' \
    28             and platform.dist()[0].lower() not in ['debian', 'ubuntu']:
    29         # hack to install into /usr/lib64 if scons is in the 32bit /usr/lib/
    30         if moduledir.startswith("/usr"):
    31            moduledir = moduledir.replace("lib", "lib64")
    32     return moduledir
    33 
    3424EnsureSConsVersion(1,0,0)
    3525
    36 opts = Variables("options.cfg")
     26opts = Variables("options.cache")
    3727opts.AddVariables(
    3828                ("FORTRAN", "The fortran compiler", None),
    3929                ("f2clib", "The fortran to c library", None),
    40                 PathVariable("prefix",
    41                 "The root installation path",
    42                            distutils.sysconfig.PREFIX),
    43                 ("moduledir",
    44                  "The python module path (site-packages))",
    45                  None),
    4630                PathVariable("casacoreroot", "The location of casacore",
    4731                             "/usr/local"),
     
    7660                 "The root directory where rpfits is installed", None),
    7761                ("rpfitslibdir", "The rpfits library location", None),
     62
    7863                ("pyraproot", "The root directory where libpyrap is installed",
    7964                 None),
    8065                ("numpyincdir", "numpy header file directory",
    8166                 get_numpy_incdir()),
     67                BoolVariable("enable_pyrap",
     68                             "Use pyrap conversion library from system",
     69                             False),
    8270                ("pyraplib", "The name of the pyrap library", "pyrap"),
    8371                ("pyraplibdir", "The directory where libpyrap is installed",
     
    8573                ("pyrapincdir", "The pyrap include location",
    8674                 None),
    87                 BoolVariable("enable_pyrap", "Use pyrap conversion library",
    88                              False),
    89 
    9075                EnumVariable("mode", "The type of build.", "release",
    9176                           ["release","debug"], ignorecase=1),
    92                 EnumVariable("makedoc", "Build the userguide in specified format",
    93                            "none",
    94                            ["none", "pdf", "html"], ignorecase=1),
     77                EnumVariable("makedoc",
     78                             "Build the userguide in specified format",
     79                             "none",
     80                             ["none", "pdf", "html"], ignorecase=1),
    9581                BoolVariable("apps", "Build cpp apps", True),
    9682                BoolVariable("alma", "Enable alma specific functionality",
     
    9985
    10086env = Environment( toolpath = ['./scons'],
    101                    tools = ["default", "archiver", "utils",
    102                             "quietinstall", "casaoptions", "casa"],
     87                   tools = ["default", "utils",
     88                            "casaoptions", "casa"],
    10389                   ENV = { 'PATH' : os.environ[ 'PATH' ],
    10490                          'HOME' : os.environ[ 'HOME' ] },
    10591                   options = opts)
    10692
    107 Help(opts.GenerateHelpText(env))
     93env.Help(opts.GenerateHelpText(env))
    10894env.SConsignFile()
    109 
    110 if not env.GetOption('clean'):
     95if not ( env.GetOption('clean') or env.GetOption('help') ):
     96
    11197    conf = Configure(env)
    11298
     
    135121        Exit(1)
    136122
    137 #    conf.env.AddCustomPackage('pyrap')
    138     if False and conf.CheckLib(conf.env["pyraplib"], language='c++', autoadd=0):
    139         conf.env.Append(CPPFLAGS=['-DHAVE_LIBPYRAP'])
    140 #        conf.env.PrependUnique(LIBS=env['pyraplib'])
     123    if env["enable_pyrap"]:
     124        conf.env.AddCustomPackage('pyrap')
     125        if conf.CheckLib(conf.env["pyraplib"], language='c++', autoadd=0):
     126            conf.env.PrependUnique(LIBS=env['pyraplib'])
     127        else:
     128            Exit(1)
    141129    else:
    142130        conf.env.AppendUnique(CPPPATH=[conf.env["numpyincdir"]])
    143131        # numpy 1.0 uses config.h; numpy >= 1.1 uses numpyconfig.h
    144         if conf.CheckHeader("numpy/config.h") or \
    145                conf.CheckHeader("numpy/numpyconfig.h"):
     132        if conf.CheckHeader("numpy/numpyconfig.h"):
    146133            conf.env.Append(CPPDEFINES=["-DAIPS_USENUMPY"])
    147134        else:
    148135            conf.env.Exit(1)
    149         conf.env.Append(CPPFLAGS=['-DHAVE_LIBPYRAP'])
    150         # compile in pyrap here...
     136        # compile in pyrap from here...
    151137        conf.env["pyrapint"] = "#/external/libpyrap/pyrap-0.3.2"
     138    conf.env.Append(CPPFLAGS=['-DHAVE_LIBPYRAP'])
     139
    152140    # test for cfitsio
    153141    if not conf.CheckLib("m"): Exit(1)
     
    175163    if conf.env["alma"]:
    176164        conf.env.Append(CPPFLAGS=['-DUSE_CASAPY'])
    177     if not conf.env.get("moduledir"):
    178         mdir = get_moduledir(conf.env.get("prefix"))
    179         if env["PLATFORM"] == "darwin":
    180             mdir = distutils.sysconfig.get_python_lib(1,0)           
    181         conf.env["moduledir"] =  mdir
    182165    env = conf.Finish()
     166
     167opts.Save('options.cache', env)
    183168
    184169env["version"] = "4.1.x"
     
    195180
    196181# build externals
    197 env.SConscript("external-alma/SConscript")
     182ext = env.SConscript("external-alma/SConscript")
     183
    198184# build library
    199185so = env.SConscript("src/SConscript", variant_dir="build", duplicate=0)
     186
     187apps = env.SConscript("apps/SConscript")
     188
    200189# test module import, to see if there are unresolved symbols
    201190def test_module(target,source,env):
     
    206195    print "ok"
    207196    return 0
     197
    208198def test_str(target, source, env):
    209199    return "Testing module..."
     
    212202env.AddPostAction(so, taction)
    213203
    214 # Need this to make makedist work
    215 dummy = env.Install()
    216 env.Alias('install', dummy)
    217 
    218 # make binary distribution
    219 env["stagedir"] = "asap-%s" % (env["version"])
    220 env.Command('Staging distribution for archive in %s' % env["stagedir"],
    221             '', env.MessageAction)
    222 env.QInstall("$stagedir/asap", [so,  env.SGlob("python/*.py")] )
    223 env.QInstall("$stagedir/bin", ["bin/asap", "bin/asap_update_data"])
    224 env.QInstall("$stagedir", ["packaging/setup.py"])
    225 env.QInstall("$stagedir/debian", env.SGlob("packaging/debian/*") )
    226 
    227 if env["apps"]:
    228     env.SConscript("apps/SConscript")
    229 
    230204if env.GetOption("clean"):
    231205    Execute(Delete(".sconf_temp"))
     206    Execute(Delete("options.cache"))
    232207
    233208if env["makedoc"].lower() != "none":
Note: See TracChangeset for help on using the changeset viewer.