From 67217c1ef7efe93e67224557828f675d8271866e Mon Sep 17 00:00:00 2001 From: cloud Date: Thu, 16 Sep 2021 14:50:02 +0200 Subject: [PATCH] Fix: drop read and trigger install by env var, default should be by PYTHONPATH --- python/MDSplus/setup.py | 2 +- rpm/python_module_install.sh | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/python/MDSplus/setup.py b/python/MDSplus/setup.py index b4dee909e1..87cd4c496a 100644 --- a/python/MDSplus/setup.py +++ b/python/MDSplus/setup.py @@ -98,5 +98,5 @@ def use_setuptools(): sys.exit(1) try: use_setuptools() - except ImportError: + except (ImportError, RuntimeError): use_distutils() diff --git a/rpm/python_module_install.sh b/rpm/python_module_install.sh index e537d4420b..00c17e6946 100755 --- a/rpm/python_module_install.sh +++ b/rpm/python_module_install.sh @@ -3,24 +3,23 @@ mdsplus_dir=$(readlink -f $(dirname ${0})/..) module=${1} if test "${module}" = "MDSplus"; then + setup_install=${MDSPLUS_SETUP_PY} srcdir=${mdsplus_dir}/python if test "$(${mdsplus_dir}/rpm/python_module_remove.sh ${module} y)" = "y"; then setup_install=y - elif ( echo ${PYTHONPATH} | grep ${mdsplus_dir}/python >/dev/null ); then - setup_install=n - else - read -t 10 -p "Do you wish to run setup.py install? (y/N) " setup_install + elif test -z "${MDSPLUS_SETUP_PY}"; then + echo "Set MDSPLUS_SETUP_PY=y if you wish to run setup.py install." fi else + setup_install= srcdir=${mdsplus_dir}/pydevices - setup_install=n fi for python in python2 python3; do if ( ${python} -c pass >/dev/null 2>&1 ); then ${python} -m compileall -q -f ${srcdir}/${module} >/dev/null 2>&1 if test "${setup_install}" = "y"; then - if ! ${python} ${mdsplus_dir}/python/MDSplus/setup.py -q install >/dev/null; then + if ! ${python} ${srcdir}/${module}/setup.py -q install >/dev/null; then echo "Could not 'setup.py install' MDSplus for ${python}" fi fi