From: Cédric Aguerre Date: Tue, 30 Aug 2016 16:09:10 +0000 (+0200) Subject: refactoring X-Git-Tag: kw11013~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a329d79bd25b38c24ce8fca16d983c9ed5ae506;p=tools%2Fpvdeliv.git refactoring --- diff --git a/scripts/BuildSalomeMini.py b/scripts/BuildSalomeMini.py index aa2a3ef..0ebfdac 100755 --- a/scripts/BuildSalomeMini.py +++ b/scripts/BuildSalomeMini.py @@ -2,52 +2,29 @@ import os,sys,shutil,glob -current_directory=os.path.dirname(os.path.abspath(__file__)) - -from salome_environ import * - -envAcc={} - -# Read configuration -from salome_config import read_config_file -read_config_file(os.path.join(current_directory, "SalomeMiniConfig.cfg")) -from salome_config import config - -# Check system prerequisites -from salome_check_version import * -check_gcc_version(config["gcc_version_min"], envAcc) - -# Download archives -from salome_download import download_archives -download_archives(current_directory) - -# Prepare build -rootDir="SalomeMini" +from salome_misc import AutoChdir +from salome_config import read_config_file, initialize +from salome_check_version import check_gcc_version +from salome_download import extractSrc, download_archives +from salome_build_options import * +from salome_compile import compileOld, compileVeryOld, compileNew +from salome_environ import accumulateEnv, generateFileEnv -# Manage dependencies -__softwares = ["cmake","python","hdf5","swig","qt","med","medcoupling","paraview","paravis"] - -__dependencies={ - "cmake": [], - "python": ["cmake"], - "hdf5": ["cmake"], - "swig": ["python"], - "qt": ["cmake"], - "med": ["hdf5","python"], - "medcoupling": ["python","med","swig"], - "paraview": ["hdf5","python","qt","cmake"], - "paravis": ["paraview","medcoupling"], -} +current_directory=os.path.dirname(os.path.abspath(__file__)) -from salome_config import initialize -initialize(__softwares, __dependencies) +def __init(envAcc={}): + # Read configuration + config=read_config_file(os.path.join(current_directory, "SalomeMiniConfig.cfg")) + # Check system prerequisites + check_gcc_version(config["gcc_version_min"], envAcc) + # Download archives + download_archives(current_directory, config) + # Manage dependencies + initialize(config) + return config #################### - -from salome_download import * -from salome_compile import * - -def patchCMakeLists(topSrcDir,srcDir): +def __patchCMakeLists(topSrcDir,srcDir): realSrcDirSrc=os.path.join(srcDir,'src','Plugins','MEDReader') destReal=os.path.join(topSrcDir,'MEDReader') if os.path.exists(destReal): @@ -70,7 +47,6 @@ ENDIF() pos0=filter(lambda (x,y): "INCLUDE(SalomeMacros)" in y,enumerate(lines)) assert(len(pos0)==1) ; pos0=pos0[0] - print pos0 lines=lines[0:pos0[0]]+[linesToAdd0]+lines[pos0[0]:] pos1=filter(lambda (x,y): "INCLUDE(SalomeSetupPlatform)" in y,enumerate(lines)) @@ -83,189 +59,93 @@ ENDIF() f=file(cmakeToPatch,"w") ; f.writelines(lines) return os.path.abspath(destReal) +#################### +def __let_us_go(): + envAcc={} + config=__init() -########### FINI LA PARLOTE ! - -if not os.path.exists(rootDir): + # Prepare build + rootDir="SalomeMini" + if not os.path.exists(rootDir): os.mkdir(rootDir) + pass + zz=AutoChdir(rootDir) -zz=AutoChdir(rootDir) - - -topSrcDir="src" -topBuildDir="build" -topInstallDir="install" -for d in [topSrcDir,topBuildDir,topInstallDir]: + topSrcDir="src" + topBuildDir="build" + topInstallDir="install" + for d in [topSrcDir,topBuildDir,topInstallDir]: if not os.path.exists(d): - os.mkdir(d) + os.mkdir(d) + + # Build softwares + # + pattern="cmake" + srcDir=extractSrc(topSrcDir,pattern,config) + installDir=compileOld(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir,[],False) + accumulateEnv(installDir,pattern,config,envAcc) + # + pattern="python" + srcDir=extractSrc(topSrcDir,pattern,config) + installDir=compileOld(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir, + get_python_build_options(),False) + accumulateEnv(installDir,pattern,config,envAcc) + # + pattern="hdf5" + srcDir=extractSrc(topSrcDir,pattern,config) + installDir=compileNew(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir, + get_hdf5_build_options(),False) + accumulateEnv(installDir,pattern,config,envAcc) + # + pattern="swig" + srcDir=extractSrc(topSrcDir,pattern,config) + installDir=compileVeryOld(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir, + get_swig_build_options(),False) + accumulateEnv(installDir,pattern,config,envAcc) + # + pattern="qt" + srcDir=extractSrc(topSrcDir,pattern,config) + installDir=compileVeryOld(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir, + get_qt_build_options(),False) + accumulateEnv(installDir,pattern,config,envAcc) + # + pattern="med" + srcDir=extractSrc(topSrcDir,pattern,config) + installDir=compileOld(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir, + get_med_build_options(envAcc),False) + accumulateEnv(installDir,pattern,config,envAcc) + # + pattern="repoConfig" + srcDir=extractSrc(topSrcDir,pattern,config) + accumulateEnv(srcDir,pattern,config,envAcc) + # + pattern="medcoupling" + srcDir=extractSrc(topSrcDir,pattern,config) + installDir=compileNew(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir, + get_medcoupling_build_options(envAcc),False) + accumulateEnv(installDir,pattern,config,envAcc) + # + pattern="paraview" + srcDir=extractSrc(topSrcDir,pattern,config) + installDir=compileNew(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir, + get_paraview_build_options(envAcc),False) + accumulateEnv(installDir,pattern,config,envAcc) + # + pattern="paravis"# for MEDReader + srcDir=extractSrc(topSrcDir,pattern,config) + srcDir=__patchCMakeLists(topSrcDir,srcDir)# change Reference for source + installDir=compileNew(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir, + get_paravis_build_options(envAcc),False) + accumulateEnv(installDir,pattern,config,envAcc) + # -# -pattern="cmake" -srcDir=extractSrc(topSrcDir,pattern) + # generate env file + envFile=os.path.abspath(os.path.join(topInstallDir,"environment.sh")) + f=file(envFile,"w") + f.write(generateFileEnv(envAcc)) ; f.flush() ; del f + print("Env file generated : %s"%envFile) + pass -installDir=compileOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,[],False) -accumulateEnv(installDir,pattern,envAcc) -# -pattern="python" -srcDir=extractSrc(topSrcDir,pattern) -installDir=compileOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir, - ["--enable-shared", - "--enable-unicode=ucs4", - "-without-pymalloc" - ],False) -accumulateEnv(installDir,pattern,envAcc) -# -pattern="hdf5" -srcDir=extractSrc(topSrcDir,pattern) -installDir=compileNew(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir, - ['-DHDF5_BUILD_HL_LIB=ON', - '-DHDF5_BUILD_TOOLS=ON', - '-DBUILD_SHARED_LIBS=ON', - '-DHDF5_ENABLE_Z_LIB_SUPPORT=ON', - '-DCMAKE_BUILD_TYPE=Release' - ],False) -accumulateEnv(installDir,pattern,envAcc) -# -pattern="swig" -srcDir=extractSrc(topSrcDir,pattern) -installDir=compileVeryOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir, - ["--without-pcre", - "--without-octave" - ],False) -accumulateEnv(installDir,pattern,envAcc) -# -pattern="qt" -srcDir=extractSrc(topSrcDir,pattern) -installDir=compileVeryOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir, - ["-opensource", - "-confirm-license", - "-no-rpath", - "-qt-xcb" - ],False) -accumulateEnv(installDir,pattern,envAcc) -# -pattern="med" -srcDir=extractSrc(topSrcDir,pattern) -installDir=compileOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir, - ["--with-hdf5=%s"%(envAcc["HDF5HOME"]), - "--enable-production" - ],False) -accumulateEnv(installDir,pattern,envAcc) -# -pattern="repoConfig" -srcDir=extractSrc(topSrcDir,pattern) -accumulateEnv(srcDir,pattern,envAcc) -# -pattern="medcoupling" -srcDir=extractSrc(topSrcDir,pattern) -installDir=compileNew(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir, - ["-DCMAKE_BUILD_TYPE=Debug", - "-DMEDCOUPLING_BUILD_DOC=OFF", - "-DMEDCOUPLING_BUILD_TESTS=OFF", - "-DMEDCOUPLING_PARTITIONER_METIS=OFF", - "-DMEDCOUPLING_ENABLE_RENUMBER=OFF", - "-DMEDCOUPLING_PARTITIONER_SCOTCH=OFF", - "-DCONFIGURATION_ROOT_DIR=%s"%(envAcc["CONFIGURATION_ROOT_DIR"]), - "-DCONFIGURATION_CMAKE_DIR=%s/cmake"%(envAcc["CONFIGURATION_ROOT_DIR"]), - "-DPYTHONROOT_DIR=%s"%envAcc["PYTHONHOME"], - "-DPYTHONINTERP_ROOT_DIR=%s"%envAcc["PYTHONHOME"], - "-DPYTHONLIBS_ROOT_DIR=%s"%envAcc["PYTHONHOME"], - "-DHDF5_ROOT_DIR=%s"%(envAcc["HDF5HOME"]), - "-DMEDFICHIER_ROOT_DIR=%s"%(envAcc["MED3HOME"]), - "-DMEDFILE_ROOT_DIR=%s"%(envAcc["MED3HOME"]), - "-DSWIG_EXECUTABLE=%s"%(envAcc["SWIG_EXECUTABLE"]), - "-DSWIG_VERSION=%s"%(envAcc["SWIG_VERSION"]), - ],False) -accumulateEnv(installDir,pattern,envAcc) -# -pattern="paraview" -srcDir=extractSrc(topSrcDir,pattern) -installDir=compileNew(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir, - ['-DPYTHON_ROOT_DIR=%s'%(envAcc["PYTHONHOME"]), - '-DHDF5_ROOT_DIR=%s'%(envAcc["HDF5HOME"]), - '-DPYTHON_EXECUTABLE=%s/bin/python%s'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]), - '-DPYTHON_INCLUDE_DIR=%s'%(envAcc["PYTHON_INCLUDE"]), - '-DPYTHON_LIBRARY=%s/lib/libpython%s.so'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]), - '-DHDF5_LIBRARIES=%s/lib'%(envAcc["HDF5HOME"]), - '-DHDF5_INCLUDE_DIRS=%s/include'%(envAcc["HDF5HOME"]), - '-DHDF5_CXX_COMPILER_EXECUTABLE=%s/bin/h5pcc'%(envAcc["HDF5HOME"]), - '-DHDF5_HL_INCLUDE_DIR=%s/include'%(envAcc["HDF5HOME"]), - '-DHDF5_hdf5_hl_LIBRARY=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]), - '-DHDF5_hdf5_hl_LIBRARY_RELEASE=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]), - '-DHDF5_hdf5_hl_LIBRARY_DEBUG=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]), - '-DHDF5_HL_LIBRARY=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]), - '-DBUILD_SHARED_LIBS:BOOL=ON', - '-DCMAKE_BUILD_TYPE:STRING=Debug', - '-DPARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON', - '-DPARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=ON', - '-DVTK_USE_64BIT_IDS:BOOL=OFF', - '-DPARAVIEW_BUILD_QT_GUI:BOOL=ON', - '-DVTK_QT_USE_WEBKIT:BOOL=ON', - '-DQT_TESTING_INSTALL_DEVELOPMENT:BOOL=ON', - '-DPARAVIEW_ENABLE_PYTHON:BOOL=ON', - '-DVTK_USE_SYSTEM_HDF5:BOOL=ON', - '-DVTK_USE_GL2PS:BOOL=ON', - '-DPARAVIEW_BUILD_PLUGIN_Moments:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_SierraPlotTools:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_SLACTools:BOOL=OFF', - '-DPARAVIEW_INSTALL_DEVELOPMENT_FILES=ON', - '-DVTK_NO_PYTHON_THREADS=OFF', - '-DPARAVIEW_ENABLE_CATALYST:BOOL=ON', - '-DPARAVIEW_BUILD_PLUGIN_AnalyzeNIfTIIO:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_ArrowGlyph:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_CatalystScriptGeneratorPlugin:BOOL=ON', - '-DPARAVIEW_BUILD_PLUGIN_GMVReader:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_MobileRemoteControl:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_NonOrthogonalSource:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_QuadView:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_PacMan:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_PrismPlugin:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_RGBZView:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_SciberQuestToolKit:BOOL=OFF', - '-DPARAVIEW_BUILD_PLUGIN_StreamingParticles:BOOL=ON', - '-DPARAVIEW_BUILD_PLUGIN_UncertaintyRendering:BOOL=ON', - '-DPARAVIEW_ENABLE_MATPLOTLIB:BOOL=ON', - '-DPARAVIEW_BUILD_PLUGIN_EyeDomeLighting:BOOL=ON', - '-DPARAVIEW_BUILD_PLUGIN_ForceTime:BOOL=ON', - '-DPARAVIEW_BUILD_PLUGIN_H5PartReader:BOOL=ON', - '-DPARAVIEW_BUILD_PLUGIN_PointSprite:BOOL=ON', - '-DPARAVIEW_BUILD_PLUGIN_SurfaceLIC:BOOL=ON', - '-DCMAKE_BUILD_QT_GUI:BOOL=ON', - '-DVTK_USE_SYSTEM_LIBXML2:BOOL=ON', - '-DVTK_USE_OGGTHEORA_ENCODER:BOOL=ON', - '-DPARAVIEW_INSTALL_THIRD_PARTY_LIBRARIES:BOOL=OFF', - '-DBUILD_DOCUMENTATION:BOOL=ON', - '-DBUILD_EXAMPLES:BOOL=OFF', - '-DBUILD_TESTING:BOOL=OFF', - '-DPARAVIEW_GENERATE_PROXY_DOCUMENTATION:BOOL=ON', - '-DVTK_NO_PYTHON_THREADS=OFF', - '-DVTK_PYTHON_FULL_THREADSAFE=ON', - '-DPARAVIEW_QT_VERSION=%s'%(envAcc["QTVERSION"]), - '-DQT_HELP_GENERATOR=%s/bin/qhelpgenerator'%(envAcc["QTDIR"]), - '-DVTK_BUILD_QT_DESIGNER_PLUGIN:BOOL=OFF', - '-DBUILD_DOCUMENTATION=OFF' - ],False) -accumulateEnv(installDir,pattern,envAcc) -# -pattern="paravis"# for MEDReader -srcDir=extractSrc(topSrcDir,pattern) -srcDir=patchCMakeLists(topSrcDir,srcDir)# change Reference for source -installDir=compileNew(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir, - ["-DMEDCOUPLING_ROOT_DIR=%s"%(envAcc["MEDCOUPLINGHOME"]), - "-DCONFIGURATION_ROOT_DIR=%s"%(envAcc["CONFIGURATION_ROOT_DIR"]), - '-DPYTHON_ROOT_DIR=%s'%(envAcc["PYTHONHOME"]), - '-DHDF5_ROOT_DIR=%s'%(envAcc["HDF5HOME"]), - '-DPYTHON_EXECUTABLE=%s/bin/python%s'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]), - '-DPYTHON_INCLUDE_DIR=%s'%(envAcc["PYTHON_INCLUDE"]), - '-DPARAVIEW_QT_VERSION=5', - '-DQT_VERSION=5', - '-DSALOME_GUI_BUILD_WITH_QT5=ON', - '-DSALOME_INSTALL_SCRIPT_SCRIPTS=%s'%topInstallDir, - '-DPYTHON_LIBRARY=%s/lib/libpython%s.so'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"])],False) -accumulateEnv(installDir,pattern,envAcc) -# END -envFile=os.path.abspath(os.path.join(topInstallDir,"environment.sh")) -f=file(envFile,"w") -f.write(generateFileEnv(envAcc)) ; f.flush() ; del f -print("Env file generated : %s"%envFile) +if __name__ == "__main__": + __let_us_go() diff --git a/scripts/salome_build_options.py b/scripts/salome_build_options.py new file mode 100644 index 0000000..5a55170 --- /dev/null +++ b/scripts/salome_build_options.py @@ -0,0 +1,139 @@ +#! /usr/bin/env python + +def get_python_build_options(): + return [ + "--enable-shared", + "--enable-unicode=ucs4", + "-without-pymalloc" + ] + +def get_hdf5_build_options(): + return [ + '-DHDF5_BUILD_HL_LIB=ON', + '-DHDF5_BUILD_TOOLS=ON', + '-DBUILD_SHARED_LIBS=ON', + '-DHDF5_ENABLE_Z_LIB_SUPPORT=ON', + '-DCMAKE_BUILD_TYPE=Release' + ] + +def get_swig_build_options(): + return [ + "--without-pcre", + "--without-octave" + ] + +def get_qt_build_options(): + return [ + "-opensource", + "-confirm-license", + "-no-rpath", + "-qt-xcb" + ] + +def get_med_build_options(envAcc): + return [ + "--with-hdf5=%s"%(envAcc["HDF5HOME"]), + "--enable-production" + ] + +def get_medcoupling_build_options(envAcc): + return [ + "-DCMAKE_BUILD_TYPE=Debug", + "-DMEDCOUPLING_BUILD_DOC=OFF", + "-DMEDCOUPLING_BUILD_TESTS=OFF", + "-DMEDCOUPLING_PARTITIONER_METIS=OFF", + "-DMEDCOUPLING_ENABLE_RENUMBER=OFF", + "-DMEDCOUPLING_PARTITIONER_SCOTCH=OFF", + "-DCONFIGURATION_ROOT_DIR=%s"%(envAcc["CONFIGURATION_ROOT_DIR"]), + "-DCONFIGURATION_CMAKE_DIR=%s/cmake"%(envAcc["CONFIGURATION_ROOT_DIR"]), + "-DPYTHONROOT_DIR=%s"%envAcc["PYTHONHOME"], + "-DPYTHONINTERP_ROOT_DIR=%s"%envAcc["PYTHONHOME"], + "-DPYTHONLIBS_ROOT_DIR=%s"%envAcc["PYTHONHOME"], + "-DHDF5_ROOT_DIR=%s"%(envAcc["HDF5HOME"]), + "-DMEDFICHIER_ROOT_DIR=%s"%(envAcc["MED3HOME"]), + "-DMEDFILE_ROOT_DIR=%s"%(envAcc["MED3HOME"]), + "-DSWIG_EXECUTABLE=%s"%(envAcc["SWIG_EXECUTABLE"]), + "-DSWIG_VERSION=%s"%(envAcc["SWIG_VERSION"]) + ] + +def get_paraview_build_options(envAcc): + return [ + '-DBUILD_SHARED_LIBS:BOOL=ON', + '-DCMAKE_BUILD_TYPE:STRING=Debug', + '-DPARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON', + '-DPARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=ON', + '-DVTK_USE_64BIT_IDS:BOOL=OFF', + '-DPARAVIEW_BUILD_QT_GUI:BOOL=ON', + '-DVTK_QT_USE_WEBKIT:BOOL=ON', + '-DQT_TESTING_INSTALL_DEVELOPMENT:BOOL=ON', + '-DPARAVIEW_ENABLE_PYTHON:BOOL=ON', + '-DVTK_USE_SYSTEM_HDF5:BOOL=ON', + '-DVTK_USE_GL2PS:BOOL=ON', + '-DPARAVIEW_BUILD_PLUGIN_Moments:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_SierraPlotTools:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_SLACTools:BOOL=OFF', + '-DPARAVIEW_INSTALL_DEVELOPMENT_FILES=ON', + '-DVTK_NO_PYTHON_THREADS=OFF', + '-DPARAVIEW_ENABLE_CATALYST:BOOL=ON', + '-DPARAVIEW_BUILD_PLUGIN_AnalyzeNIfTIIO:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_ArrowGlyph:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_CatalystScriptGeneratorPlugin:BOOL=ON', + '-DPARAVIEW_BUILD_PLUGIN_GMVReader:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_MobileRemoteControl:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_NonOrthogonalSource:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_QuadView:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_PacMan:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_PrismPlugin:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_RGBZView:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_SciberQuestToolKit:BOOL=OFF', + '-DPARAVIEW_BUILD_PLUGIN_StreamingParticles:BOOL=ON', + '-DPARAVIEW_BUILD_PLUGIN_UncertaintyRendering:BOOL=ON', + '-DPARAVIEW_ENABLE_MATPLOTLIB:BOOL=ON', + '-DPARAVIEW_BUILD_PLUGIN_EyeDomeLighting:BOOL=ON', + '-DPARAVIEW_BUILD_PLUGIN_ForceTime:BOOL=ON', + '-DPARAVIEW_BUILD_PLUGIN_H5PartReader:BOOL=ON', + '-DPARAVIEW_BUILD_PLUGIN_PointSprite:BOOL=ON', + '-DPARAVIEW_BUILD_PLUGIN_SurfaceLIC:BOOL=ON', + '-DCMAKE_BUILD_QT_GUI:BOOL=ON', + '-DVTK_USE_SYSTEM_LIBXML2:BOOL=ON', + '-DVTK_USE_OGGTHEORA_ENCODER:BOOL=ON', + '-DPARAVIEW_INSTALL_THIRD_PARTY_LIBRARIES:BOOL=OFF', + '-DBUILD_DOCUMENTATION:BOOL=ON', + '-DBUILD_EXAMPLES:BOOL=OFF', + '-DBUILD_TESTING:BOOL=OFF', + '-DPARAVIEW_GENERATE_PROXY_DOCUMENTATION:BOOL=ON', + '-DVTK_NO_PYTHON_THREADS=OFF', + '-DVTK_PYTHON_FULL_THREADSAFE=ON', + '-DVTK_BUILD_QT_DESIGNER_PLUGIN:BOOL=OFF', + '-DBUILD_DOCUMENTATION=OFF', + '-DPYTHON_ROOT_DIR=%s'%(envAcc["PYTHONHOME"]), + '-DHDF5_ROOT_DIR=%s'%(envAcc["HDF5HOME"]), + '-DPYTHON_EXECUTABLE=%s/bin/python%s'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]), + '-DPYTHON_INCLUDE_DIR=%s'%(envAcc["PYTHON_INCLUDE"]), + '-DPYTHON_LIBRARY=%s/lib/libpython%s.so'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]), + '-DHDF5_LIBRARIES=%s/lib'%(envAcc["HDF5HOME"]), + '-DHDF5_INCLUDE_DIRS=%s/include'%(envAcc["HDF5HOME"]), + '-DHDF5_CXX_COMPILER_EXECUTABLE=%s/bin/h5pcc'%(envAcc["HDF5HOME"]), + '-DHDF5_HL_INCLUDE_DIR=%s/include'%(envAcc["HDF5HOME"]), + '-DHDF5_hdf5_hl_LIBRARY=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]), + '-DHDF5_hdf5_hl_LIBRARY_RELEASE=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]), + '-DHDF5_hdf5_hl_LIBRARY_DEBUG=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]), + '-DHDF5_HL_LIBRARY=%s/lib/libhdf5_hl.so'%(envAcc["HDF5HOME"]), + '-DPARAVIEW_QT_VERSION=%s'%(envAcc["QTVERSION"]), + '-DQT_HELP_GENERATOR=%s/bin/qhelpgenerator'%(envAcc["QTDIR"]) + ] + +def get_paravis_build_options(envAcc): + return [ + '-DPARAVIEW_QT_VERSION=5', + '-DQT_VERSION=5', + '-DSALOME_GUI_BUILD_WITH_QT5=ON', + "-DMEDCOUPLING_ROOT_DIR=%s"%(envAcc["MEDCOUPLINGHOME"]), + "-DCONFIGURATION_ROOT_DIR=%s"%(envAcc["CONFIGURATION_ROOT_DIR"]), + '-DPYTHON_ROOT_DIR=%s'%(envAcc["PYTHONHOME"]), + '-DHDF5_ROOT_DIR=%s'%(envAcc["HDF5HOME"]), + '-DPYTHON_EXECUTABLE=%s/bin/python%s'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]), + '-DPYTHON_INCLUDE_DIR=%s'%(envAcc["PYTHON_INCLUDE"]), +# '-DSALOME_INSTALL_SCRIPT_SCRIPTS=%s'%topInstallDir, + '-DPYTHON_LIBRARY=%s/lib/libpython%s.so'%(envAcc["PYTHONHOME"],envAcc["PYTHON_VERSION"]) + ] diff --git a/scripts/salome_check_version.py b/scripts/salome_check_version.py index 8781ec8..c7c0b68 100644 --- a/scripts/salome_check_version.py +++ b/scripts/salome_check_version.py @@ -7,7 +7,7 @@ import re from salome_misc import compare_num from salome_environ import computeEnv -def compare_versions(a, b): +def __compare_versions(a, b): a1,a2,a3 = a.split('.') b1,b2,b3 = b.split('.') c = compare_num(a1, b1) @@ -37,7 +37,7 @@ def check_gcc_version(gcc_version_ref, envAcc): print out sys.exit(1) pass - c = compare_versions(xyz[0], gcc_version_ref) + c = __compare_versions(xyz[0], gcc_version_ref) if c == -1: print "Error: too old gcc version: %s"%xyz[0] print "gcc version must be >= %s"%gcc_version_ref diff --git a/scripts/salome_compile.py b/scripts/salome_compile.py index 67afea1..587955e 100644 --- a/scripts/salome_compile.py +++ b/scripts/salome_compile.py @@ -8,9 +8,8 @@ import datetime from salome_environ import computeEnv from salome_misc import * -def getCurrentVersion(srcDir,pattern): +def __getCurrentVersion(srcDir,pattern, config): zz=AutoChdir(srcDir) - from salome_config import config srcLoc=eval("config['%sLoc']"%pattern) if isinstance(srcLoc,str): s = os.path.splitext(os.path.basename(srcLoc))[0] @@ -22,18 +21,17 @@ def getCurrentVersion(srcDir,pattern): p=subprocess.Popen(["git","rev-parse","--verify","HEAD"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE) p_out,p_err=p.communicate() if p.returncode != 0: - msg = "Error in getCurrentVersion\n" + p_err + msg = "Error in __getCurrentVersion\n" + p_err raise Exception(msg) return p_out.strip() -def some_dependency_has_changed(software): - from salome_config import config +def __some_dependency_has_changed(software,config): for x in config["dependencies"][software]: if config["softwareChanged"][x]: return True return False -def compilePart0(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild): +def __compilePart0(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild): assert(os.path.isdir(srcDir)) baseName=os.path.basename(srcDir) myBuildDir=os.path.realpath(os.path.join(topBuildDir,baseName)) @@ -50,7 +48,7 @@ def compilePart0(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCf with open(os.path.join(myBuildDir,okFlag)) as f: built_version = f.readline() built_version = built_version.strip() - current_version = getCurrentVersion(topSrcDir,pattern) + current_version = __getCurrentVersion(topSrcDir,pattern,config) if current_version != built_version: print("For \"%s\" : Version has changed !"%srcDir) print(" Built version: %s"%built_version) @@ -58,7 +56,7 @@ def compilePart0(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCf shutil.rmtree(myBuildDir) os.mkdir(myBuildDir) else: - if some_dependency_has_changed(pattern): + if __some_dependency_has_changed(pattern,config): print("For \"%s\" : Some dependencies have changed !"%srcDir) shutil.rmtree(myBuildDir) os.mkdir(myBuildDir) @@ -68,11 +66,10 @@ def compilePart0(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCf else: os.mkdir(myBuildDir) pass - from salome_config import config config["softwareChanged"][pattern] = True return myBuildDir,myInstallDir,True -def compilePart1(p,buildDir): +def __compilePart1(p,buildDir): a,b=p.communicate() f=file(os.path.join(buildDir,cfgOut),"w") ; f.write(a) ; f.flush() f=file(os.path.join(buildDir,cfgErr),"w") ; f.write(b) ; f.flush() @@ -80,9 +77,8 @@ def compilePart1(p,buildDir): msg = "Error in build step. See details in %s and %s\n"%(os.path.join(buildDir,cfgOut), os.path.join(buildDir,cfgErr)) raise Exception(msg) -def compilePart2(topSrcDir,pattern,envAcc,buildDir,splitInstall): +def __compilePart2(topSrcDir,pattern,config,envAcc,buildDir,splitInstall): print("make in %s"%(buildDir)) - from salome_config import config paraCompFlag = config["paraCompFlag"] if not splitInstall: p=subprocess.Popen(["make",paraCompFlag,"install"],cwd=buildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE) @@ -108,37 +104,37 @@ def compilePart2(topSrcDir,pattern,envAcc,buildDir,splitInstall): msg = "Error in build step. See details in %s and %s\n"%(os.path.join(buildDir,compOut), os.path.join(buildDir,compErr)) raise Exception(msg) pass - current_version = getCurrentVersion(topSrcDir,pattern) + current_version = __getCurrentVersion(topSrcDir,pattern,config) with open(os.path.join(buildDir,okFlag),"w") as f: f.write(current_version + "\n") f.write(str(datetime.datetime.now())) f.flush() pass -def compileOldCommon(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild,splitInstall): - myBuildDir,myInstallDir,shouldContinue=compilePart0(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild) +def __compileOldCommon(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild,splitInstall): + myBuildDir,myInstallDir,shouldContinue=__compilePart0(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild) if not shouldContinue: return myInstallDir myCmd=[os.path.join(srcDir,"configure"),"--prefix=%s"%(myInstallDir)]+addCfgParam print "Command: ", " ".join(myCmd) p=subprocess.Popen(myCmd,cwd=myBuildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE) - compilePart1(p,myBuildDir) - compilePart2(topSrcDir,pattern,envAcc,myBuildDir,splitInstall) + __compilePart1(p,myBuildDir) + __compilePart2(topSrcDir,pattern,config,envAcc,myBuildDir,splitInstall) return myInstallDir -def compileOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild): - return compileOldCommon(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild,False) +def compileOld(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild): + return __compileOldCommon(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild,False) -def compileVeryOld(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild): - return compileOldCommon(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild,True) +def compileVeryOld(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild): + return __compileOldCommon(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild,True) -def compileNew(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild): - myBuildDir,myInstallDir,shouldContinue=compilePart0(topSrcDir,pattern,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild) +def compileNew(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild): + myBuildDir,myInstallDir,shouldContinue=__compilePart0(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir,addCfgParam,forceRebuild) if not shouldContinue: return myInstallDir myCmd=["cmake","-DCMAKE_INSTALL_PREFIX=%s"%(myInstallDir)]+addCfgParam+[srcDir] print(" ".join(myCmd)) p=subprocess.Popen(myCmd,cwd=myBuildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE) - compilePart1(p,myBuildDir) - compilePart2(topSrcDir,pattern,envAcc,myBuildDir,False) + __compilePart1(p,myBuildDir) + __compilePart2(topSrcDir,pattern,config,envAcc,myBuildDir,False) return myInstallDir diff --git a/scripts/salome_config.py b/scripts/salome_config.py index 0bdbac2..8326f60 100644 --- a/scripts/salome_config.py +++ b/scripts/salome_config.py @@ -3,10 +3,8 @@ import os import ConfigParser -config={} - def read_config_file(config_filename): - global config + config={} c = ConfigParser.SafeConfigParser() c.optionxform = str # case sensitive c.read(config_filename) @@ -38,16 +36,29 @@ def read_config_file(config_filename): config["make_nb_jobs"] = c.get('Build options', 'make_nb_jobs', 0) config["do_archive_download"] = c.getboolean('Build options', 'do_archive_download') config["gcc_version_min"] = c.get('System', 'gcc_version_min') - pass + return config + +__softwares = ["cmake","python","hdf5","swig","qt","med","medcoupling","paraview","paravis"] + +__dependencies={ + "cmake": [], + "python": ["cmake"], + "hdf5": ["cmake"], + "swig": ["python"], + "qt": ["cmake"], + "med": ["hdf5","python"], + "medcoupling": ["python","med","swig"], + "paraview": ["hdf5","python","qt","cmake"], + "paravis": ["paraview","medcoupling"], +} -def initialize(softwares, dependencies): - global config +def initialize(config): softwareChanged = {} - for s in softwares: + for s in __softwares: softwareChanged[s] = False pass config["softwareChanged"] = softwareChanged - config["dependencies"] = dependencies + config["dependencies"] = __dependencies config["paraCompFlag"] = "-j%s"%config["make_nb_jobs"] diff --git a/scripts/salome_download.py b/scripts/salome_download.py index c06fb7b..55d6e06 100644 --- a/scripts/salome_download.py +++ b/scripts/salome_download.py @@ -7,7 +7,7 @@ import subprocess from salome_misc import AutoChdir -def extractSrcFromArchive(srcLoc,srcDir,pattern): +def __extractSrcFromArchive(srcLoc,srcDir,pattern): print "Extracting archive: ", srcLoc tmpDir="tmp" zz=AutoChdir(srcDir) @@ -43,7 +43,7 @@ def extractSrcFromArchive(srcLoc,srcDir,pattern): os.rmdir(tmpDir) return ret -def extractSrcFromGit(gitLoc,srcDir,pattern): +def __extractSrcFromGit(gitLoc,srcDir,pattern): print "Connecting to git repository: ", gitLoc[0] zz=AutoChdir(srcDir) assert(isinstance(gitLoc,tuple)) @@ -86,18 +86,17 @@ def extractSrcFromGit(gitLoc,srcDir,pattern): raise Exception(msg) return ret -def extractSrc(srcDir,pattern): - from salome_config import config +def extractSrc(srcDir,pattern,config): srcLoc=eval("config['%sLoc']"%pattern) if isinstance(srcLoc,str): - return extractSrcFromArchive(srcLoc,srcDir,pattern) + return __extractSrcFromArchive(srcLoc,srcDir,pattern) elif isinstance(srcLoc,tuple): - return extractSrcFromGit(srcLoc,srcDir,pattern) + return __extractSrcFromGit(srcLoc,srcDir,pattern) else: raise Exception("Unrecognized localization of source : %s"%srcLoc) import urllib2 -def download(url, outfile): +def __download(url, outfile): print "Downloading",outfile,"..." if os.path.exists(outfile): print "Already downloaded" # :TODO: should include MD5 check @@ -118,8 +117,7 @@ def download(url, outfile): remotefile.close() pass -def download_archives(current_directory): - from salome_config import config +def download_archives(current_directory, config): do_archive_download = config["do_archive_download"] local_archives_path = os.path.join(current_directory,"archives") @@ -145,12 +143,12 @@ def download_archives(current_directory): pass if do_archive_download: - download(config["cmake_url"], cmakeLoc) - download(config["med_url"], medLoc) - download(config["hdf5_url"], hdf5Loc) - download(config["swig_url"], swigLoc) - download(config["qt_url"], qtLoc) - download(config["python_url"], pythonLoc) + __download(config["cmake_url"], cmakeLoc) + __download(config["med_url"], medLoc) + __download(config["hdf5_url"], hdf5Loc) + __download(config["swig_url"], swigLoc) + __download(config["qt_url"], qtLoc) + __download(config["python_url"], pythonLoc) pass config["cmakeLoc"] = cmakeLoc diff --git a/scripts/salome_environ.py b/scripts/salome_environ.py index e9b15b1..9ef4525 100644 --- a/scripts/salome_environ.py +++ b/scripts/salome_environ.py @@ -2,134 +2,104 @@ import os -def cmake_Environ(installDir,envAcc): +def __addEnv(dico,key,val): + if key not in dico.keys(): + dico[key]=val + else: + dico[key]=val+dico[key] + +def __cmake_Environ(installDir,config,envAcc): pathAdd=[os.path.join(installDir,"bin")] - addEnv(envAcc,"PATH",pathAdd) + __addEnv(envAcc,"PATH",pathAdd) pass -def python_Environ(installDir,envAcc): +def __python_Environ(installDir,config,envAcc): pathAdd=[os.path.join(installDir,"bin")] ldPathAdd=[os.path.join(installDir,"lib")] - addEnv(envAcc,"PATH",pathAdd) - addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) + __addEnv(envAcc,"PATH",pathAdd) + __addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) envAcc["PYTHONHOME"]=installDir envAcc["PYTHONSTARTUP"]=os.path.join(installDir,"pythonrc.py") - from salome_config import config envAcc["PYTHON_VERSION"]=config["python_version_short"] envAcc["PYTHON_INCLUDE"]=os.path.join(installDir,"include","python%s"%envAcc["PYTHON_VERSION"]) pass -def hdf5_Environ(installDir,envAcc): +def __hdf5_Environ(installDir,config,envAcc): envAcc["HDF5HOME"]=installDir envAcc["HDF5_DISABLE_VERSION_CHECK"]="1" pathAdd=[os.path.join(installDir,"bin")] ldPathAdd=[os.path.join(installDir,"lib")] - addEnv(envAcc,"PATH",pathAdd) - addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) + __addEnv(envAcc,"PATH",pathAdd) + __addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) pass -def swig_Environ(installDir,envAcc): +def __swig_Environ(installDir,config,envAcc): pathAdd=[os.path.join(installDir,"bin")] - addEnv(envAcc,"PATH",pathAdd) + __addEnv(envAcc,"PATH",pathAdd) envAcc["SWIG_ROOT_DIR"]=installDir - from salome_config import config envAcc["SWIG_LIB"]=os.path.join(installDir,"share","swig",config["swig_version"]) envAcc["SWIG_EXECUTABLE"]=os.path.join(installDir,"bin","swig") envAcc["SWIG_VERSION"]=config["swig_version"] pass -def qt_Environ(installDir,envAcc): +def __qt_Environ(installDir,config,envAcc): pathAdd=[os.path.join(installDir,"bin")] ldPathAdd=[os.path.join(installDir,"lib")] - addEnv(envAcc,"PATH",pathAdd) - addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) + __addEnv(envAcc,"PATH",pathAdd) + __addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) envAcc["QTDIR"]=installDir envAcc["QT_PLUGIN_PATH"]=os.path.join(installDir,"plugins") - from salome_config import config envAcc["QTVERSION"]=config["qt_version_major"] pass -def med_Environ(installDir,envAcc): +def __med_Environ(installDir,config,envAcc): pathAdd=[os.path.join(installDir,"bin")] ldPathAdd=[os.path.join(installDir,"lib")] - from salome_config import config pyPathAdd=[os.path.join(installDir,"lib","python%s"%config["python_version_short"],"site-packages")] - addEnv(envAcc,"PATH",pathAdd) - addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) - addEnv(envAcc,"PYTHONPATH",pyPathAdd) + __addEnv(envAcc,"PATH",pathAdd) + __addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) + __addEnv(envAcc,"PYTHONPATH",pyPathAdd) envAcc["MED3HOME"]=installDir pass -def repoConfig_Environ(installDir,envAcc): +def __repoConfig_Environ(installDir,config,envAcc): envAcc["CONFIGURATION_ROOT_DIR"]=installDir envAcc["CONFIGURATION_CMAKE_DIR"]=os.path.join(installDir,"cmake") pass -def medcoupling_Environ(installDir,envAcc): +def __medcoupling_Environ(installDir,config,envAcc): pathAdd=[os.path.join(installDir,"bin")] ldPathAdd=[os.path.join(installDir,"lib")] - from salome_config import config pyPathAdd=[os.path.join(installDir,"lib","python%s"%config["python_version_short"],"site-packages")] - addEnv(envAcc,"PATH",pathAdd) - addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) - addEnv(envAcc,"PYTHONPATH",pyPathAdd) + __addEnv(envAcc,"PATH",pathAdd) + __addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) + __addEnv(envAcc,"PYTHONPATH",pyPathAdd) envAcc["MEDCOUPLINGHOME"]=installDir pass -def paraview_Environ(installDir,envAcc): +def __paraview_Environ(installDir,config,envAcc): envAcc["PVHOME"]=installDir - from salome_config import config paraview_version = config["paraview_version"] envAcc["PVVERSION"]=paraview_version pathAdd=[os.path.join(installDir,"bin")] - addEnv(envAcc,"PATH",pathAdd) + __addEnv(envAcc,"PATH",pathAdd) ldPathAdd=[os.path.join(installDir,"lib","paraview-%s"%paraview_version)] - addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) + __addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) pyPathAdd =[os.path.join(installDir,"lib","paraview-%s"%paraview_version,"site-packages")] pyPathAdd+=[os.path.join(installDir,"lib","paraview-%s"%paraview_version,"site-packages","vtk")] pyPathAdd+=[os.path.join(installDir,"lib","paraview-%s"%paraview_version,"site-packages","paraview","vtk")] - addEnv(envAcc,"PYTHONPATH",pyPathAdd) + __addEnv(envAcc,"PYTHONPATH",pyPathAdd) pvPlgPathAdd=[os.path.join(installDir,"lib","paraview-%s"%paraview_version)] - addEnv(envAcc,"PV_PLUGIN_PATH",pvPlgPathAdd) + __addEnv(envAcc,"PV_PLUGIN_PATH",pvPlgPathAdd) pass -def paravis_Environ(installDir,envAcc): +def __paravis_Environ(installDir,config,envAcc): ldPathAdd=[os.path.join(installDir,"lib","salome")] pvPlgPathAdd=[os.path.join(installDir,"lib","paraview")] - addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) - addEnv(envAcc,"PV_PLUGIN_PATH",pvPlgPathAdd) + __addEnv(envAcc,"LD_LIBRARY_PATH",ldPathAdd) + __addEnv(envAcc,"PV_PLUGIN_PATH",pvPlgPathAdd) pass -def addEnv(dico,key,val): - if key not in dico.keys(): - dico[key]=val - else: - dico[key]=val+dico[key] - -def computeEnv_1(envAcc,withDft=True): - import os,copy - if withDft: - d=copy.deepcopy(os.environ) - for k in os.environ.keys(): - if k not in envAcc.keys(): - del d[k] - else: - d={} - for k in envAcc.keys(): - l=[] - if k in d.keys(): - l=d[k].split(os.pathsep) - tmp=envAcc[k] - if not isinstance(tmp,list): - tmp=[tmp] - l=tmp+l - if k!="PYTHONSTARTUP": - d[k]=os.pathsep.join(l) - else: - d[k]=l[-1] - # - return d - def computeEnv(envAcc): import os, copy d = copy.deepcopy(os.environ) @@ -148,16 +118,12 @@ def computeEnv(envAcc): return d pass -def accumulateEnv(installDir,pattern,envAcc): +def accumulateEnv(installDir,pattern,config,envAcc): """ envAcc out parameter""" - zeAccumulator=eval("%s_Environ"%pattern) - zeAccumulator(installDir,envAcc) + zeAccumulator=eval("__%s_Environ"%pattern) + zeAccumulator(installDir,config,envAcc) pass -def generateInlineEnv(envAcc): - d=computeEnv(envAcc) - return "env "+" ".join(["%s=%s"%(k,d[k]) for k in d.keys()]) - def generateFileEnv(envAcc): d=computeEnv(envAcc) return "\n".join(["export %s=\"%s\""%(k,d[k]) for k in d.keys()])