Bug: bad managment of the csh case.
This commit is contained in:
parent
aaeeef0097
commit
3777c34834
|
@ -129,7 +129,27 @@ def guessOs ():
|
||||||
libDir = 'lib'
|
libDir = 'lib'
|
||||||
|
|
||||||
return (osType,libDir,useDevtoolset2)
|
return (osType,libDir,useDevtoolset2)
|
||||||
|
|
||||||
|
|
||||||
|
def guessCsh ():
|
||||||
|
cshBins = [ '/usr/bin/tcsh'
|
||||||
|
, '/bin/tcsh'
|
||||||
|
, '/usr/pkg/bin/tcsh'
|
||||||
|
, '/usr/bin/csh'
|
||||||
|
, '/bin/csh'
|
||||||
|
, '/usr/pkg/bin/csh'
|
||||||
|
]
|
||||||
|
for cshBin in cshBins:
|
||||||
|
if os.path.isfile(cshBin): return cshBin
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def guessShell ():
|
||||||
|
if os.environ.has_key('SHELL'): return os.environ['SHELL']
|
||||||
|
|
||||||
|
# If SHELL is not set, it is likely we are under C-Shell variant.
|
||||||
|
# Look for standard places where the binaries are expecteds.
|
||||||
|
return guessCsh()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,6 +159,7 @@ if __name__ == "__main__":
|
||||||
buildType = "Release"
|
buildType = "Release"
|
||||||
linkType = "Shared"
|
linkType = "Shared"
|
||||||
rootDir = None
|
rootDir = None
|
||||||
|
shellBin = guessShell()
|
||||||
|
|
||||||
parser = optparse.OptionParser ()
|
parser = optparse.OptionParser ()
|
||||||
# Build relateds.
|
# Build relateds.
|
||||||
|
@ -155,12 +176,17 @@ if __name__ == "__main__":
|
||||||
parser.add_option ( "--root" , action="store" , type="string", dest="rootDir" )
|
parser.add_option ( "--root" , action="store" , type="string", dest="rootDir" )
|
||||||
( options, args ) = parser.parse_args ()
|
( options, args ) = parser.parse_args ()
|
||||||
|
|
||||||
if options.release: buildType = "Release"
|
if options.csh: shellBin = guessCsh()
|
||||||
if options.debug: buildType = "Debug"
|
if options.release: buildType = "Release"
|
||||||
if options.devel: buildType = "Debug"
|
if options.debug: buildType = "Debug"
|
||||||
if options.static: linkType = "Static"
|
if options.devel: buildType = "Debug"
|
||||||
if options.shared: linkType = "Shared"
|
if options.static: linkType = "Static"
|
||||||
if options.rootDir: rootDir = options.rootDir
|
if options.shared: linkType = "Shared"
|
||||||
|
if options.rootDir: rootDir = options.rootDir
|
||||||
|
|
||||||
|
if not shellBin:
|
||||||
|
print 'echo "[ERROR] coriolisEnv.py was not able to guess/find the current shell interpeter."'
|
||||||
|
sys.exit( 1 )
|
||||||
|
|
||||||
strippedPath = stripPath ( "PATH" )
|
strippedPath = stripPath ( "PATH" )
|
||||||
strippedLibraryPath = stripPath ( "LD_LIBRARY_PATH" )
|
strippedLibraryPath = stripPath ( "LD_LIBRARY_PATH" )
|
||||||
|
@ -246,11 +272,11 @@ if __name__ == "__main__":
|
||||||
if osType == "Darwin":
|
if osType == "Darwin":
|
||||||
shellScriptSh += 'DYLD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";' \
|
shellScriptSh += 'DYLD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";' \
|
||||||
'export DYLD_LIBRARY_PATH;'
|
'export DYLD_LIBRARY_PATH;'
|
||||||
shellScriptCsh += 'setenv DYLD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";'
|
shellScriptCsh += 'setenv DYLD_LIBRARY_PATH "%(LD_LIBRARY_PATH)s";'
|
||||||
else:
|
else:
|
||||||
shellScriptSh += 'LD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";' \
|
shellScriptSh += 'LD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";' \
|
||||||
'export LD_LIBRARY_PATH;'
|
'export LD_LIBRARY_PATH;'
|
||||||
shellScriptCsh += 'setenv LD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";'
|
shellScriptCsh += 'setenv LD_LIBRARY_PATH "%(LD_LIBRARY_PATH)s";'
|
||||||
|
|
||||||
shellScriptSh += "hash -r;"
|
shellScriptSh += "hash -r;"
|
||||||
shellScriptCsh += "rehash;"
|
shellScriptCsh += "rehash;"
|
||||||
|
@ -258,6 +284,9 @@ if __name__ == "__main__":
|
||||||
if options.csh: shellScript = shellScriptCsh
|
if options.csh: shellScript = shellScriptCsh
|
||||||
else: shellScript = shellScriptSh
|
else: shellScript = shellScriptSh
|
||||||
|
|
||||||
|
if useDevtoolset2:
|
||||||
|
shellScript += ' scl enable devtoolset-2 %(SHELL)s'
|
||||||
|
|
||||||
evalScript = shellScript % { "PATH" : strippedPath
|
evalScript = shellScript % { "PATH" : strippedPath
|
||||||
, "LD_LIBRARY_PATH" : strippedLibraryPath
|
, "LD_LIBRARY_PATH" : strippedLibraryPath
|
||||||
, "PYTHONPATH" : strippedPythonPath
|
, "PYTHONPATH" : strippedPythonPath
|
||||||
|
@ -266,10 +295,8 @@ if __name__ == "__main__":
|
||||||
, "SYSCONF_DIR" : sysconfDir
|
, "SYSCONF_DIR" : sysconfDir
|
||||||
, "MESSAGE" : shellMessage
|
, "MESSAGE" : shellMessage
|
||||||
, "buildDir" : buildDir
|
, "buildDir" : buildDir
|
||||||
|
, 'SHELL' : shellBin
|
||||||
}
|
}
|
||||||
if useDevtoolset2:
|
|
||||||
evalScript = '%s scl enable devtoolset-2 ${SHELL}' % evalScript
|
|
||||||
|
|
||||||
if options.queryISysRoot:
|
if options.queryISysRoot:
|
||||||
print '%s/%s' % (rootDir,osType)
|
print '%s/%s' % (rootDir,osType)
|
||||||
sys.exit( 0 )
|
sys.exit( 0 )
|
||||||
|
@ -279,3 +306,4 @@ if __name__ == "__main__":
|
||||||
sys.exit( 0 )
|
sys.exit( 0 )
|
||||||
|
|
||||||
print evalScript
|
print evalScript
|
||||||
|
sys.exit( 0 )
|
||||||
|
|
Loading…
Reference in New Issue