Improved environment support & detection.
This commit is contained in:
parent
eae107b259
commit
e85332a0bb
|
@ -6,6 +6,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import optparse
|
||||||
|
|
||||||
|
|
||||||
coriolisPattern = re.compile ( r".*coriolis.*" )
|
coriolisPattern = re.compile ( r".*coriolis.*" )
|
||||||
|
@ -68,15 +69,29 @@ if __name__ == "__main__":
|
||||||
buildType = "Debug"
|
buildType = "Debug"
|
||||||
linkType = "Shared"
|
linkType = "Shared"
|
||||||
coriolisVersion = None
|
coriolisVersion = None
|
||||||
|
rootDir = None
|
||||||
for argument in sys.argv:
|
sysCoriolisTop = "/asim/coriolis2"
|
||||||
if argument == "--v1": coriolisVersion=1
|
|
||||||
elif argument == "--v2": coriolisVersion=2
|
parser = optparse.OptionParser ()
|
||||||
elif argument == "--debug": buildType="Debug"
|
# Build relateds.
|
||||||
elif argument == "--devel": buildType="Debug"
|
parser.add_option ( "--v1" , action="store_true" , dest="v1" )
|
||||||
elif argument == "--release": buildType="Release"
|
parser.add_option ( "--v2" , action="store_true" , dest="v2" )
|
||||||
elif argument == "--shared": linkType="Shared"
|
parser.add_option ( "--release", action="store_true" , dest="release" )
|
||||||
elif argument == "--static": linkType="Static"
|
parser.add_option ( "--debug" , action="store_true" , dest="debug" )
|
||||||
|
parser.add_option ( "--devel" , action="store_true" , dest="devel" )
|
||||||
|
parser.add_option ( "--static" , action="store_true" , dest="static" )
|
||||||
|
parser.add_option ( "--shared" , action="store_true" , dest="shared" )
|
||||||
|
parser.add_option ( "--root" , action="store" , type="string", dest="rootDir" )
|
||||||
|
( options, args ) = parser.parse_args ()
|
||||||
|
|
||||||
|
if options.v1: coriolisVersion = 1
|
||||||
|
if options.v2: coriolisVersion = 2
|
||||||
|
if options.release: buildType = "Release"
|
||||||
|
if options.debug: buildType = "Debug"
|
||||||
|
if options.devel: buildType = "Debug"
|
||||||
|
if options.static: linkType = "Static"
|
||||||
|
if options.shared: linkType = "Shared"
|
||||||
|
if options.rootDir: rootDir = options.rootDir
|
||||||
|
|
||||||
strippedPath = stripPath ( "PATH" )
|
strippedPath = stripPath ( "PATH" )
|
||||||
strippedLibraryPath = stripPath ( "LD_LIBRARY_PATH" )
|
strippedLibraryPath = stripPath ( "LD_LIBRARY_PATH" )
|
||||||
|
@ -84,7 +99,10 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
if coriolisVersion == 1:
|
if coriolisVersion == 1:
|
||||||
|
|
||||||
hurricaneTop = "%s/coriolis-1.x/coriolis/%s/install" % ( os.getenv("HOME"), osDir )
|
if not rootDir:
|
||||||
|
rootDir = os.getenv("HOME") + "/coriolis-1.x"
|
||||||
|
|
||||||
|
hurricaneTop = "%s/coriolis/%s/install" % ( rootDir, osDir )
|
||||||
buildDir = None
|
buildDir = None
|
||||||
shellScript = \
|
shellScript = \
|
||||||
"""
|
"""
|
||||||
|
@ -103,10 +121,13 @@ fi
|
||||||
|
|
||||||
elif coriolisVersion == 2:
|
elif coriolisVersion == 2:
|
||||||
|
|
||||||
|
if not rootDir:
|
||||||
|
rootDir = os.getenv("HOME") + "/coriolis-2.x"
|
||||||
|
|
||||||
buildDir = buildType + "." + linkType
|
buildDir = buildType + "." + linkType
|
||||||
hurricaneTop = "%s/coriolis-2.x/%s/%s/install" % ( os.getenv("HOME"), osDir, buildDir )
|
coriolisTop = "%s/%s/%s/install" % ( rootDir, osDir, buildDir )
|
||||||
strippedPath = "%s/bin:%s" % ( hurricaneTop, strippedPath )
|
strippedPath = "%s/bin:%s" % ( coriolisTop, strippedPath )
|
||||||
strippedLibraryPath = "%s/%s:%s" % ( hurricaneTop, libDir, strippedLibraryPath )
|
strippedLibraryPath = "%s/%s:%s" % ( coriolisTop, libDir, strippedLibraryPath )
|
||||||
|
|
||||||
shellScript = \
|
shellScript = \
|
||||||
"""
|
"""
|
||||||
|
@ -114,9 +135,9 @@ echo "Switching to Coriolis 2.x (%(buildDir)s)";
|
||||||
PATH=%(PATH)s;
|
PATH=%(PATH)s;
|
||||||
LD_LIBRARY_PATH=%(LD_LIBRARY_PATH)s;
|
LD_LIBRARY_PATH=%(LD_LIBRARY_PATH)s;
|
||||||
PYTHONPATH=%(PYTHONPATH)s;
|
PYTHONPATH=%(PYTHONPATH)s;
|
||||||
HURRICANE_TOP=%(HURRICANE_TOP)s;
|
BOOTSTRAP_TOP=%(BOOTSTRAP_TOP)s;
|
||||||
CORIOLIS_TOP=%(HURRICANE_TOP)s;
|
CORIOLIS_TOP=%(CORIOLIS_TOP)s;
|
||||||
export PATH LD_LIBRARY_PATH PYTHONPATH HURRICANE_TOP CORIOLIS_TOP;
|
export PATH LD_LIBRARY_PATH PYTHONPATH BOOTSTRAP_TOP CORIOLIS_TOP;
|
||||||
hash -r
|
hash -r
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -124,6 +145,7 @@ hash -r
|
||||||
print shellScript % { "PATH" : strippedPath
|
print shellScript % { "PATH" : strippedPath
|
||||||
, "LD_LIBRARY_PATH" : strippedLibraryPath
|
, "LD_LIBRARY_PATH" : strippedLibraryPath
|
||||||
, "PYTHONPATH" : strippedPythonPath
|
, "PYTHONPATH" : strippedPythonPath
|
||||||
, "HURRICANE_TOP" : hurricaneTop
|
, "BOOTSTRAP_TOP" : coriolisTop
|
||||||
|
, "CORIOLIS_TOP" : coriolisTop
|
||||||
, "buildDir" : buildDir
|
, "buildDir" : buildDir
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ BOOTSTRAP_TOP=%(CORIOLIS_TOP)s;
|
||||||
CORIOLIS_TOP=%(CORIOLIS_TOP)s;
|
CORIOLIS_TOP=%(CORIOLIS_TOP)s;
|
||||||
HURRICANE_TOP=%(CORIOLIS_TOP)s;
|
HURRICANE_TOP=%(CORIOLIS_TOP)s;
|
||||||
MANGROVE_TOP=%(MANGROVE_TOP)s;
|
MANGROVE_TOP=%(MANGROVE_TOP)s;
|
||||||
export PATH LD_LIBRARY_PATH PYTHONPATH HURRICANE_TOP CORIOLIS_TOP;
|
export PATH LD_LIBRARY_PATH PYTHONPATH BOOTSTRAP_TOP CORIOLIS_TOP MANGROVE_TOP;
|
||||||
hash -r
|
hash -r
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,30 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -z "$BOOTSTRAP_TOP" ]; then
|
||||||
|
export BOOTSTRAP_TOP=/asim/coriolis2
|
||||||
|
echo "BOOTSTRAP_TOP is not in the environment. Using default:"
|
||||||
|
echo " $BOOTSTRAP_TOP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$CORIOLIS_TOP" ]; then
|
||||||
|
export CORIOLIS_TOP=/asim/coriolis2
|
||||||
|
echo "CORIOLIS_TOP is not in the environment. Using default:"
|
||||||
|
echo " $CORIOLIS_TOP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$MANGROVE_TOP" ]; then
|
||||||
|
export MANGROVE_TOP=/asim/mangrove
|
||||||
|
echo "MANGROVE_TOP is not in the environment. Using default:"
|
||||||
|
echo " $MANGROVE_TOP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rootDir=${HOME}/mangrove
|
||||||
|
|
||||||
procs=1
|
procs=1
|
||||||
if [ $# -gt 0 ]; then procs="$1"; fi
|
if [ $# -gt 0 ]; then procs="$1"; fi
|
||||||
|
|
||||||
echo "Using $procs threads."
|
echo "Using $procs threads."
|
||||||
|
|
||||||
export CORIOLIS_TOP=/asim/coriolis2
|
|
||||||
export MANGROVE_TOP=/asim/mangrove
|
|
||||||
rootDir=${HOME}/mangrove
|
|
||||||
|
|
||||||
${rootDir}/src/bootstrap/buildMangrove.py \
|
${rootDir}/src/bootstrap/buildMangrove.py \
|
||||||
--root=${rootDir} \
|
--root=${rootDir} \
|
||||||
--project=mangrove \
|
--project=mangrove \
|
||||||
|
|
Loading…
Reference in New Issue