From 3954ff0001d654a44a2f9cdcbe12a5dde618a8a1 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Wed, 9 Mar 2022 16:27:03 +0100 Subject: [PATCH] Examples in sessionless mode. --- Examples/README.txt | 2 +- Examples/build.sh | 2 +- Examples/calcium1/build.sh | 2 -- Examples/calcium2/build.sh | 2 -- Examples/context.py | 10 +++++----- Examples/cpp1/build.sh | 2 -- Examples/cpp2/build.sh | 2 -- Examples/exec.sh | 14 ++++---------- Examples/fort1/build.sh | 2 -- Examples/fort2/build.sh | 2 -- Examples/pyth1/build.sh | 2 -- Examples/pyth2/build.sh | 2 -- Examples/salome_env_exec.sh | 4 ++++ Examples/types1/build.sh | 2 -- 14 files changed, 15 insertions(+), 35 deletions(-) create mode 100644 Examples/salome_env_exec.sh diff --git a/Examples/README.txt b/Examples/README.txt index 415d042..2b0183c 100644 --- a/Examples/README.txt +++ b/Examples/README.txt @@ -1,7 +1,7 @@ Here you find examples of use of YACSGEN for every type of component. In order to build and test the examples, you have to: -- change the SALOME installation directory in exec.sh (SALOME_DIR) +- change the SALOME installation directory in exec.sh (SALOME_APPLI_PATH) - run "build.sh" Every example contains a "build.sh" script which shows you how to build and diff --git a/Examples/build.sh b/Examples/build.sh index b002ccd..858f902 100755 --- a/Examples/build.sh +++ b/Examples/build.sh @@ -9,7 +9,7 @@ script_dir=`dirname $0` #set -e cd $script_dir - +$script_dir/clean.sh list_dirs="calcium1 calcium2 cpp1 cpp2 cppgui1 fort1 fort2 pydoc1 pygui1 pyth1 pyth2 types1" #" mpi1 parahxx1 hxx1" for dir in $list_dirs ; do diff --git a/Examples/calcium1/build.sh b/Examples/calcium1/build.sh index f0eb4f5..324e6ae 100755 --- a/Examples/calcium1/build.sh +++ b/Examples/calcium1/build.sh @@ -2,6 +2,4 @@ ../exec.sh python components.py # test -appli/salome -t appli/salome shell ../test_compo.py -appli/salome killall diff --git a/Examples/calcium2/build.sh b/Examples/calcium2/build.sh index f0eb4f5..324e6ae 100755 --- a/Examples/calcium2/build.sh +++ b/Examples/calcium2/build.sh @@ -2,6 +2,4 @@ ../exec.sh python components.py # test -appli/salome -t appli/salome shell ../test_compo.py -appli/salome killall diff --git a/Examples/context.py b/Examples/context.py index ec4c15c..3379628 100644 --- a/Examples/context.py +++ b/Examples/context.py @@ -19,10 +19,8 @@ import os,sys -SALOME_ROOT=os.getenv("SALOME_DIR") -SALOME_PACKAGES=os.getenv("SALOME_DIR") -SALOME_PREREQ=os.path.join(SALOME_PACKAGES, "salome_prerequisites.sh") -#SALOME_PREREQ=os.path.join(SALOME_ROOT, "salome_prerequisites_appli.sh") +SALOME_ROOT=os.getenv("ROOT_SALOME_INSTALL") +SALOME_PREREQ=os.path.join(SALOME_ROOT, "env.d", "envProducts.sh") KERNEL_ROOT_DIR=os.getenv("KERNEL_ROOT_DIR","") GUI_ROOT_DIR=os.getenv("GUI_ROOT_DIR","") @@ -37,4 +35,6 @@ context={'update':1, "geom":GEOM_ROOT_DIR, } -SYS_MODULES=[] +sys.path.insert(0, SALOME_ROOT) +import salome_common +SYS_MODULES=salome_common.MODULES diff --git a/Examples/cpp1/build.sh b/Examples/cpp1/build.sh index b3393d2..643ad6d 100755 --- a/Examples/cpp1/build.sh +++ b/Examples/cpp1/build.sh @@ -1,6 +1,4 @@ ../exec.sh python components.py # test -appli/salome -t appli/salome shell ../test_compo.py -appli/salome killall diff --git a/Examples/cpp2/build.sh b/Examples/cpp2/build.sh index fb9970b..48d171b 100755 --- a/Examples/cpp2/build.sh +++ b/Examples/cpp2/build.sh @@ -2,6 +2,4 @@ ../exec.sh make # test -appli/salome -t appli/salome shell ../test_compo.py -appli/salome killall diff --git a/Examples/exec.sh b/Examples/exec.sh index 8a3d149..b8d1ca1 100755 --- a/Examples/exec.sh +++ b/Examples/exec.sh @@ -2,14 +2,8 @@ # execute a command within SALOME environment com=$* +SCRIPT_DIR=`dirname $0` -# Modify to your SALOME installation -export SALOME_DIR=__YACSGEN_INSTALL_PATH__ -export SALOME_PACKAGES=__YACSGEN_INSTALL_PATH__ - -source $SALOME_PACKAGES/salome_prerequisites.sh -source $SALOME_PACKAGES/salome_modules.sh - -echo execution: $com -$com - +SALOME_APPLI_PATH=/home/I35256/salome/base/appli_DEV_package +$SALOME_APPLI_PATH/salome shell -- bash $SCRIPT_DIR/salome_env_exec.sh $com +exit $? diff --git a/Examples/fort1/build.sh b/Examples/fort1/build.sh index f0eb4f5..324e6ae 100755 --- a/Examples/fort1/build.sh +++ b/Examples/fort1/build.sh @@ -2,6 +2,4 @@ ../exec.sh python components.py # test -appli/salome -t appli/salome shell ../test_compo.py -appli/salome killall diff --git a/Examples/fort2/build.sh b/Examples/fort2/build.sh index fb9970b..48d171b 100755 --- a/Examples/fort2/build.sh +++ b/Examples/fort2/build.sh @@ -2,6 +2,4 @@ ../exec.sh make # test -appli/salome -t appli/salome shell ../test_compo.py -appli/salome killall diff --git a/Examples/pyth1/build.sh b/Examples/pyth1/build.sh index b3393d2..643ad6d 100755 --- a/Examples/pyth1/build.sh +++ b/Examples/pyth1/build.sh @@ -1,6 +1,4 @@ ../exec.sh python components.py # test -appli/salome -t appli/salome shell ../test_compo.py -appli/salome killall diff --git a/Examples/pyth2/build.sh b/Examples/pyth2/build.sh index b3393d2..643ad6d 100755 --- a/Examples/pyth2/build.sh +++ b/Examples/pyth2/build.sh @@ -1,6 +1,4 @@ ../exec.sh python components.py # test -appli/salome -t appli/salome shell ../test_compo.py -appli/salome killall diff --git a/Examples/salome_env_exec.sh b/Examples/salome_env_exec.sh new file mode 100644 index 0000000..cae5d14 --- /dev/null +++ b/Examples/salome_env_exec.sh @@ -0,0 +1,4 @@ +com=$* + +source $ROOT_SALOME/salome_modules.sh +$com diff --git a/Examples/types1/build.sh b/Examples/types1/build.sh index b3393d2..643ad6d 100755 --- a/Examples/types1/build.sh +++ b/Examples/types1/build.sh @@ -1,6 +1,4 @@ ../exec.sh python components.py # test -appli/salome -t appli/salome shell ../test_compo.py -appli/salome killall -- 2.39.2