Search path reordering in crlenv.py so the debug version can be found.

This commit is contained in:
Jean-Paul Chaput 2023-01-07 12:53:11 +01:00
parent d2b40d568b
commit d9ebeb4b96
1 changed files with 17 additions and 14 deletions

View File

@ -10,9 +10,6 @@ import re
import argparse import argparse
useDebug = False
reCoriolisPattern = re.compile( r".*coriolis.*" ) reCoriolisPattern = re.compile( r".*coriolis.*" )
reReleaseSharedPattern = re.compile( r".*Release\.Shared.*" ) reReleaseSharedPattern = re.compile( r".*Release\.Shared.*" )
reReleaseStaticPattern = re.compile( r".*Release\.Static.*" ) reReleaseStaticPattern = re.compile( r".*Release\.Static.*" )
@ -56,18 +53,22 @@ def envWriteBack ( pathName, pathValue ):
return pathValue return pathValue
def setupPaths ( verbose ): def setupPaths ( verbose, debug=False ):
""" """
Guess and setup the main variables to use Coriolis: Guess and setup the main variables to use Coriolis:
* ``PATH``, to find the binaries. * ``PATH``, to find the binaries.
* ``LD_LIBRARY_PATH``, to access the dynamic libraries. * ``LD_LIBRARY_PATH``, to access the dynamic libraries.
* ``DYLD_LIBRARY_PATH``, same as above under MacOS. * ``DYLD_LIBRARY_PATH``, same as above under MacOS.
* ``PYTHONPATH``, to access the various Python modules * ``PYTHONPATH``, to access the various Python modules provided
provided by Coriolis. by Coriolis.
"""
global useDebug
:param verbose: Self explanatory.
:param debug: Use the version compiled with debugging support.
Be aware that it is roughly 4 times slower...
It's the tree rooted at ``Debug.Shared/install``
instead of ``Release.Shared/install``.
"""
# Setup CORIOLIS_TOP. # Setup CORIOLIS_TOP.
osEL9 = re.compile (".*Linux.*el9.*x86_64.*") osEL9 = re.compile (".*Linux.*el9.*x86_64.*")
osSlsoc7x_64 = re.compile (".*Linux.*el7.*x86_64.*") osSlsoc7x_64 = re.compile (".*Linux.*el7.*x86_64.*")
@ -125,16 +126,18 @@ def setupPaths ( verbose ):
print( ' (using: "{}")'.format( osDir )) print( ' (using: "{}")'.format( osDir ))
osDir = Path( osDir ) osDir = Path( osDir )
homeDir = Path( os.environ['HOME'] ) homeDir = Path( os.environ['HOME'] )
buildType = Path( 'Release.Debug' if useDebug else 'Release.Shared' ) buildType = Path( 'Debug.Shared' if debug else 'Release.Shared' )
scriptPath = Path( __file__ ).resolve() scriptPath = Path( __file__ ).resolve()
topDirs = [] topDirs = []
if debug:
topDirs.append( homeDir / 'coriolis-2.x' / osDir / buildType / 'install' )
if 'CORIOLIS_TOP' in os.environ: if 'CORIOLIS_TOP' in os.environ:
topDirs += [ Path( os.environ['CORIOLIS_TOP'] ) ] topDirs.append( Path( os.environ['CORIOLIS_TOP'] ))
topDirs += [ homeDir / 'coriolis-2.x' / osDir / buildType / 'install' if not debug:
, Path( '/soc/coriolis2' ) topDirs.append( homeDir / 'coriolis-2.x' / osDir / buildType / 'install' )
topDirs += [ Path( '/soc/coriolis2' )
, Path( '/usr' ) , Path( '/usr' )
] ]
print( scriptPath )
for part in scriptPath.parts: for part in scriptPath.parts:
if part == 'nightly': if part == 'nightly':
topDirs.append( homeDir / 'nightly' / 'coriolis-2.x' / osDir / buildType / 'install' ) topDirs.append( homeDir / 'nightly' / 'coriolis-2.x' / osDir / buildType / 'install' )
@ -264,7 +267,7 @@ if __name__ == '__main__':
parser.add_argument( 'command', nargs='*' ) parser.add_argument( 'command', nargs='*' )
args = parser.parse_args() args = parser.parse_args()
setupPaths( args.verbose ) setupPaths( args.verbose, args.debug )
if not len(args.command): if not len(args.command):
printEnvironment() printEnvironment()
sys.exit( 0 ) sys.exit( 0 )