Skip to content

Commit

Permalink
Merge pull request #62 from antjost/patch-6
Browse files Browse the repository at this point in the history
Create moveDist
  • Loading branch information
benoit128 authored Jun 21, 2024
2 parents d005cab + af1e8ad commit 55c2053
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions tools/moveDist
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#! /bin/sh
# moveDist <dir>
# moveDist <module> <dir>
# recopie le module dans un nouveau directory d'installation
# ex: moveDist Transform /home/benoit/Cassiopee/Dist/bin/x86_r8

if [ "$CASSIOPEE" = "" ]; then
echo "You must specify a CASSIOPEE variable in your environment."
echo "This variable specifies the installation path of *Cassiopee*."
exit
fi
if [ "$ELSAPROD" = "" ]; then
echo "You must specify a ELSAPROD in your environment."
echo "This variable identifies the processor type."
exit
fi

if [ "$PYTHONEXE" = "python3" ]; then
pyversion="python"`python3 -c "import sys; print('.'.join(str(n) for n in sys.version_info[:2]))"`
alias python=python3
else
pyversion="python"`python -c "import sys; print('.'.join(str(n) for n in sys.version_info[:2]))"`
fi

if ([ $# -eq 0 ]); then
echo "moveDist <dir>"
echo "moveDist /tmp/Cassiopee/Dist/bin/x86_r8"
echo "Recopie le Dist dans <dir>"
echo "moveDist <module> <dir>"
echo "ex: moveDist Transform /tmp/Cassiopee/Dist/bin/x86_r8"
echo "Recopie le Dist du module dans <dir>/lib/$pyversion/site-packages"
fi

# push module a la position dir
if [ $# -eq 2 ]; then
module=$1
path=$2
mkdir -p $path

here=`pwd`
cd "$CASSIOPEE/Dist/bin/$ELSAPROD/lib/$pyversion/site-packages"
tar cvf $module.tar $module
mv $module.tar $path
cd $path
mkdir -p lib/$pyversion/site-packages
if [ -L lib64 ]; then
rm lib64
ln -s lib lib64
else
ln -s lib lib64
fi
mv $module.tar lib/$pyversion/site-packages
cd lib/$pyversion/site-packages
tar xvf $module.tar
rm $module.tar
cd $here
fi

# push all modules a la position dir
if [ $# -eq 1 ]; then
path=$1
mkdir -p $path
here=`pwd`
cd "$CASSIOPEE/Dist/bin/$ELSAPROD"
tar cvf all.tar .
mv all.tar $path
cd $path
tar xvf all.tar
rm all.tar
if [ -L lib64 ]; then
rm lib64
ln -s lib lib64
else
ln -s lib lib64
fi
# Change installPath
cd lib/$pyversion/site-packages
cd KCore
cp "$CASSIOPEE/Dist/bin/$ELSAPROD/lib/$pyversion/site-packages/KCore/installPath.py" .

cp installPath.py installPath_old.py
dirname=$(dirname $(dirname $(dirname $path)))
s1=$(sed 's/[\/&]/\\&/g' <<< $CASSIOPEE)
s2=$(sed 's/[\/&]/\\&/g' <<< $dirname)
# Remplace $CASSIOPEE par $dirname
sed -i "s/$s1/$s2/g" installPath.py
more installPath.py
cd $here
fi

0 comments on commit 55c2053

Please sign in to comment.