Merge branch 'master' of https://git.ipr.univ-rennes1.fr/epsi/msspec_python3
This commit is contained in:
commit
ad52398853
188
src/install.sh
188
src/install.sh
|
@ -60,7 +60,12 @@ error_exit () {
|
||||||
printf " for more informations.\n"
|
printf " for more informations.\n"
|
||||||
printf " Below is an excerpt of the last 10 lines:\n"
|
printf " Below is an excerpt of the last 10 lines:\n"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
<<<<<<< HEAD
|
||||||
tail "${LOGFILE}"
|
tail "${LOGFILE}"
|
||||||
|
=======
|
||||||
|
# tail -v -n 10 "${LOGFILE}"
|
||||||
|
tail -n 10 "${LOGFILE}"
|
||||||
|
>>>>>>> 1e676167338c9fe5ee07a649dea05da2a18eebbd
|
||||||
|
|
||||||
# uninstall if needed
|
# uninstall if needed
|
||||||
pip uninstall -y msspec
|
pip uninstall -y msspec
|
||||||
|
@ -68,6 +73,23 @@ error_exit () {
|
||||||
cleanup && exit 1
|
cleanup && exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
|
||||||
|
get_os () {
|
||||||
|
for os in "ubuntu" "mageia" "archlinux"; do
|
||||||
|
cat /etc/*release /etc/*version /etc/*issue 2>/dev/null | grep -i "$os" 2>/dev/null 1>/dev/null
|
||||||
|
if test $? -eq 0; then
|
||||||
|
LINUX_OS="$os"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
>>>>>>> 1e676167338c9fe5ee07a649dea05da2a18eebbd
|
||||||
read_yes_no () {
|
read_yes_no () {
|
||||||
DEFAULT="$2"
|
DEFAULT="$2"
|
||||||
PROMPT="$1 (y/n) [${DEFAULT}]? "
|
PROMPT="$1 (y/n) [${DEFAULT}]? "
|
||||||
|
@ -77,9 +99,15 @@ read_yes_no () {
|
||||||
|
|
||||||
VALID=1
|
VALID=1
|
||||||
while test $VALID -ne 0; do
|
while test $VALID -ne 0; do
|
||||||
|
<<<<<<< HEAD
|
||||||
printf "%s" "${PROMPT}"
|
printf "%s" "${PROMPT}"
|
||||||
if [ x"$BYPASS" = xn ]; then
|
if [ x"$BYPASS" = xn ]; then
|
||||||
read -r "INPUT"
|
read -r "INPUT"
|
||||||
|
=======
|
||||||
|
printf "${PROMPT}"
|
||||||
|
if [ x"$BYPASS" = "xn" ]; then
|
||||||
|
read "RESPONSE"
|
||||||
|
>>>>>>> 1e676167338c9fe5ee07a649dea05da2a18eebbd
|
||||||
else
|
else
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
|
@ -93,13 +121,66 @@ read_yes_no () {
|
||||||
log_message "ANSWER : $ANSWER"
|
log_message "ANSWER : $ANSWER"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
read_folder () {
|
||||||
|
DEFAULT="$2"
|
||||||
|
PROMPT="$1 [${DEFAULT}]: "
|
||||||
|
|
||||||
|
ANSWER=""
|
||||||
|
unset FOLDER
|
||||||
|
printf "${PROMPT}"
|
||||||
|
if [ x"$BYPASS" = "xn" ]; then
|
||||||
|
read "ANSWER"
|
||||||
|
else
|
||||||
|
printf "\n"
|
||||||
|
fi
|
||||||
|
export FOLDER="${ANSWER:-$DEFAULT}"
|
||||||
|
log_message "QUESTION: $PROMPT"
|
||||||
|
log_message "ANSWER : $FOLDER"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create_folder () {
|
||||||
|
FOLDER="$1"
|
||||||
|
|
||||||
|
ERR_MKDIR=1
|
||||||
|
ERR_ABORT=2
|
||||||
|
ERR_PERMS=3
|
||||||
|
|
||||||
|
if ! test -d "${FOLDER}" ; then
|
||||||
|
read_yes_no "The folder \"${FOLDER}\" does not exist. Should I create it" "y" #"$BYPASS"
|
||||||
|
|
||||||
|
case "${ANSWER}" in
|
||||||
|
y) mkdir -p "${FOLDER}" 2>>${LOGFILE} 1>>${LOGFILE} || return $ERR_MKDIR;;
|
||||||
|
n) log_message2 "Installation aborted by the user" && return $ERR_ABORT ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! test -w "${FOLDER}" ; then
|
||||||
|
log_message2 "You do not have permission to write into \"${FOLDER}\"."
|
||||||
|
return $ERR_PERMS
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
>>>>>>> 1e676167338c9fe5ee07a649dea05da2a18eebbd
|
||||||
wrap () {
|
wrap () {
|
||||||
log_message "================================================================================"
|
log_message "================================================================================"
|
||||||
log_message "$2"
|
log_message "$2"
|
||||||
log_message "================================================================================"
|
log_message "================================================================================"
|
||||||
|
<<<<<<< HEAD
|
||||||
if [ "$DEBUG" = y ]; then
|
if [ "$DEBUG" = y ]; then
|
||||||
printf "%s...\n" "$2"
|
printf "%s...\n" "$2"
|
||||||
(eval "$1" || echo $? >"${GETOUTFILE}") | tee -a "${LOGFILE}"
|
(eval "$1" || echo $? >"${GETOUTFILE}") | tee -a "${LOGFILE}"
|
||||||
|
=======
|
||||||
|
if [ "$DEBUG" = "y" ]; then
|
||||||
|
eval "($1) 2>&1" | tee -a ${LOGFILE}
|
||||||
|
echo ${PIPESTATUS[0]} >${GETOUTFILE}
|
||||||
|
|
||||||
|
>>>>>>> 1e676167338c9fe5ee07a649dea05da2a18eebbd
|
||||||
rc=$(cat $GETOUTFILE)
|
rc=$(cat $GETOUTFILE)
|
||||||
if [ $rc != 0 ]; then
|
if [ $rc != 0 ]; then
|
||||||
error_exit
|
error_exit
|
||||||
|
@ -110,6 +191,26 @@ wrap () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
update_path () {
|
||||||
|
# check if the shell path contains $BIN_FOLDER
|
||||||
|
SHELLRC="$HOME/.$(basename $SHELL)rc"
|
||||||
|
${ECHO} "$PATH" | grep "${BIN_FOLDER}" 2>/dev/null 1>/dev/null
|
||||||
|
if test $? -ne 0; then
|
||||||
|
${ECHO} "" >> $SHELLRC
|
||||||
|
${ECHO} "# Add the user's local binary folder" >> $SHELLRC
|
||||||
|
${ECHO} "export PATH=${BIN_FOLDER}:\$PATH" >> $SHELLRC
|
||||||
|
${ECHO} "Your PATH variable has been updated, the folder"
|
||||||
|
${ECHO} "${BIN_FOLDER} has been added to it."
|
||||||
|
${ECHO} ""
|
||||||
|
${ECHO} "Please source again your shell configuration file by typing:"
|
||||||
|
${ECHO} "source $SHELLRC"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
>>>>>>> 1e676167338c9fe5ee07a649dea05da2a18eebbd
|
||||||
success_message () {
|
success_message () {
|
||||||
log_message "========================================================"
|
log_message "========================================================"
|
||||||
log_message "MsSpec was successfully installed."
|
log_message "MsSpec was successfully installed."
|
||||||
|
@ -159,7 +260,8 @@ check_dependencies () {
|
||||||
gcc_ver_min=7
|
gcc_ver_min=7
|
||||||
log_message "Checking if gfortran >= $gcc_ver_min is installed..."
|
log_message "Checking if gfortran >= $gcc_ver_min is installed..."
|
||||||
command -V gfortran || return 1
|
command -V gfortran || return 1
|
||||||
gcc_ver=$(gcc -dumpversion)
|
# gcc_ver=$(gcc -dumpversion)
|
||||||
|
gcc_ver=$(echo $(gcc -dumpversion)| cut -d. -f1)
|
||||||
echo "You have gfortran version $gcc_ver installed"
|
echo "You have gfortran version $gcc_ver installed"
|
||||||
test "$gcc_ver" -ge "$gcc_ver_min" || return 1
|
test "$gcc_ver" -ge "$gcc_ver_min" || return 1
|
||||||
log_message "Ok\n"
|
log_message "Ok\n"
|
||||||
|
@ -183,10 +285,17 @@ check_dependencies () {
|
||||||
log_message "Ok\n"
|
log_message "Ok\n"
|
||||||
|
|
||||||
# we need virtualenv
|
# we need virtualenv
|
||||||
|
<<<<<<< HEAD
|
||||||
#log_message "Checking if virtualenv is installed..."
|
#log_message "Checking if virtualenv is installed..."
|
||||||
#command -V virtualenv || return 1
|
#command -V virtualenv || return 1
|
||||||
#log_message "Ok\n"
|
#log_message "Ok\n"
|
||||||
|
|
||||||
|
=======
|
||||||
|
log_message "Checking if virtualenv is installed..."
|
||||||
|
#command -V virtualenv || return 1
|
||||||
|
log_message "Ok\n"
|
||||||
|
|
||||||
|
>>>>>>> 1e676167338c9fe5ee07a649dea05da2a18eebbd
|
||||||
}
|
}
|
||||||
|
|
||||||
local_install () {
|
local_install () {
|
||||||
|
@ -196,6 +305,7 @@ local_install () {
|
||||||
# check dependencies
|
# check dependencies
|
||||||
wrap "check_dependencies" "Checking dependencies"
|
wrap "check_dependencies" "Checking dependencies"
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
# build the Fortran code
|
# build the Fortran code
|
||||||
wrap "make pybinding VERBOSE=1" "Building Phagen and Spec Python dynamic library"
|
wrap "make pybinding VERBOSE=1" "Building Phagen and Spec Python dynamic library"
|
||||||
|
|
||||||
|
@ -205,6 +315,82 @@ local_install () {
|
||||||
# install the package
|
# install the package
|
||||||
wrap "make install VERBOSE=1" "Installing the msspec package"
|
wrap "make install VERBOSE=1" "Installing the msspec package"
|
||||||
|
|
||||||
|
=======
|
||||||
|
# ask for a place to put the binary
|
||||||
|
#read_folder "Please, type in the folder where to place the binary" "${DEFAULT_BIN}"
|
||||||
|
#BIN_FOLDER=${FOLDER}
|
||||||
|
#create_folder "${BIN_FOLDER}" || error_exit
|
||||||
|
#export BIN_FOLDER
|
||||||
|
|
||||||
|
# If in a virtualenv, ask if we should install inside
|
||||||
|
if [ x"$VIRTUAL_ENV" != x ]; then
|
||||||
|
read_yes_no "You are running a Python virtual environment. Do you wish to install msspec inside ?" "y"
|
||||||
|
case ${ANSWER} in
|
||||||
|
y) # get the python version of this venv...
|
||||||
|
v=$(python -V 2>&1 | cut -d" " -f2 | cut -d. -f1)
|
||||||
|
# and stops if < 3
|
||||||
|
if [ $v -lt 3 ]; then
|
||||||
|
log_message "The Python version of this venv is < 3"
|
||||||
|
error_exit
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
n) # The user decided to stop there
|
||||||
|
log_message "Please deactivate your virtual environment and restart the setup program."
|
||||||
|
error_exit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# Else, we are not in a virtualenv
|
||||||
|
else
|
||||||
|
pip_opt=""
|
||||||
|
# so ask if we should create one
|
||||||
|
read_yes_no "Do you wish to create a virtual environment to install MsSpec inside" "y"
|
||||||
|
case ${ANSWER} in
|
||||||
|
y) # Create the destination folder
|
||||||
|
read_folder "Please, type in the base installation folder" "${DEFAULT_DEST}"
|
||||||
|
DEST_FOLDER=${FOLDER}/MsSpec-${VERSION}
|
||||||
|
if [ -d $DEST_FOLDER ]; then
|
||||||
|
export DEST_ALREADY_EXISTS="y" # to avoid cleaning the existing DEST_FOLDER in case of any problem
|
||||||
|
read_yes_no "The folder $DEST_FOLDER already exists. Overwrite" "y"
|
||||||
|
case ${ANSWER} in
|
||||||
|
y) # overwrite
|
||||||
|
create_folder "${DEST_FOLDER}" || error_exit
|
||||||
|
;;
|
||||||
|
n) # stop here otherwise
|
||||||
|
error_exit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
export DEST_FOLDER
|
||||||
|
wrap "virtualenv -vvv --python=${PYTHON} --system-site-packages --prompt=\"(msspec-${VERSION}) \" ${DEST_FOLDER}/venv" \
|
||||||
|
"Create a Python virtual environment"
|
||||||
|
. ${DEST_FOLDER}/venv/bin/activate
|
||||||
|
;;
|
||||||
|
n) # install in the user $HOME
|
||||||
|
pip_opt="--user"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# build and run setuptools to create a source distribution
|
||||||
|
wrap "make sdist" \
|
||||||
|
"Building MsSpec python package"
|
||||||
|
|
||||||
|
# install the package with pip
|
||||||
|
wrap "pip install $pip_opt dist/msspec-*.tar.gz" \
|
||||||
|
"Installing pymsspec python package and its dependencies"
|
||||||
|
|
||||||
|
#
|
||||||
|
## move the frontend to the binary folder
|
||||||
|
##wrap "mkdir -p ${LOCALBIN} && \
|
||||||
|
## cp ./msspec ${LOCALBIN} && chmod u+x ${LOCALBIN}/msspec && \
|
||||||
|
## ${ECHO} \"msspec installed in ${LOCALBIN}\"" \
|
||||||
|
## "Installing the msspec frontend"
|
||||||
|
# "cp ./msspec ${BIN_FOLDER} && chmod ugo+rx ${BIN_FOLDER}/msspec" "Installing the msspec frontend"
|
||||||
|
#
|
||||||
|
## move the uninstal script
|
||||||
|
#wrap "cp ./uninstall.sh ${DEST}" "Moving the uninstall script"
|
||||||
|
#
|
||||||
|
>>>>>>> 1e676167338c9fe5ee07a649dea05da2a18eebbd
|
||||||
# Run unit tests ?
|
# Run unit tests ?
|
||||||
read_yes_no "Do you wish to run unit tests" "y"
|
read_yes_no "Do you wish to run unit tests" "y"
|
||||||
if [ x"${ANSWER}" = xy ]; then
|
if [ x"${ANSWER}" = xy ]; then
|
||||||
|
|
|
@ -2352,7 +2352,8 @@ c dgc contains large component radial functions
|
||||||
c common /deux/ dvn(251), dvf(251), d(251), dc(251), dgc(251,30)
|
c common /deux/ dvn(251), dvf(251), d(251), dc(251), dgc(251,30)
|
||||||
c passc and rho0 contain 4*pi*r^2*rho(r)
|
c passc and rho0 contain 4*pi*r^2*rho(r)
|
||||||
c
|
c
|
||||||
dimension r(mp),r_hs(441),rho0_hs(441)
|
cKMD dimension r(mp),r_hs(441),rho0_hs(441)
|
||||||
|
dimension r(mp),r_hs(*),rho0_hs(*)
|
||||||
C
|
C
|
||||||
dimension dum1(mp), dum2(mp)
|
dimension dum1(mp), dum2(mp)
|
||||||
dimension vcoul(mp), rho0(mp), enp(ms)
|
dimension vcoul(mp), rho0(mp), enp(ms)
|
||||||
|
|
Loading…
Reference in New Issue