]> https://gitweb.dealii.org/ - candi.git/commitdiff
handle python3 correctly 162/head
authorTimo Heister <timo.heister@gmail.com>
Sun, 20 Dec 2020 16:53:10 +0000 (11:53 -0500)
committerTimo Heister <timo.heister@gmail.com>
Sat, 9 Jan 2021 19:11:27 +0000 (14:11 -0500)
If "python" does not exist in the environment, we set PYTHONVER to the
empty string, which makes configuration fail. Fix this.

candi.cfg
candi.sh
deal.II-toolchain/packages/petsc.package
deal.II-toolchain/packages/slepc.package

index 25555b9b87e56d69999dde1e4c1078bb9cddce2b..35965820c0fa95c34b274a9c05bcd8b6974571f6 100644 (file)
--- a/candi.cfg
+++ b/candi.cfg
@@ -31,6 +31,12 @@ DEAL_CONFOPTS=""
 # enable machine-specific optimizations (implies -march=native etc.)?
 #NATIVE_OPTIMIZATIONS=true
 
+# Choose the python interpreter to use. We pick python2, python3,
+# python in that order by default. If you want to override this
+# choice, uncomment the following:
+#PYTHON_INTERPRETER=python3
+
+# Now we pick the packages to install:
 PACKAGES="load:dealii-prepare"
 
 # These are system dependencies that are often pre-installed:
index 86eb06970a37a0d00339c598be3c28a8349e786f..391a138ac27b2965c88c14b4c445389c9f429039 100755 (executable)
--- a/candi.sh
+++ b/candi.sh
@@ -497,7 +497,7 @@ package_build() {
 
     elif [ ${BUILDCHAIN} = "python" ]; then
         echo cp -rf ${UNPACK_PATH}/${EXTRACTSTO}/* . >>candi_configure
-        echo python setup.py install --prefix=${INSTALL_PATH} >>candi_build
+        echo ${PYTHON_INTERPRETER} setup.py install --prefix=${INSTALL_PATH} >>candi_build
 
     elif [ ${BUILDCHAIN} = "scons" ]; then
         echo cp -rf ${UNPACK_PATH}/${EXTRACTSTO}/* . >>candi_configure
@@ -975,9 +975,22 @@ cecho ${GOOD} "Project:  ${PROJECT}"
 cecho ${GOOD} "Platform: ${PLATFORM}"
 echo
 
-# If the platform doesn't override the system python by installing its
-# own, figure out the version of the existing python
-default PYTHONVER=`python -c "import sys; print(sys.version[:3])"`
+
+# Figure out what binary to use for python support. Note that older PETSc ./configure only supports python2. For now, prefer
+# using python2 but use what the user supplies as PYTHON_INTERPRETER.
+if builtin command -v python2 --version > /dev/null; then
+  default PYTHON_INTERPRETER="python2"
+fi
+if builtin command -v python2.7 --version > /dev/null; then
+  default PYTHON_INTERPRETER="python2.7"
+fi
+if builtin command -v python3 --version > /dev/null; then
+  default PYTHON_INTERPRETER="python3"
+fi
+default PYTHON_INTERPRETER="python"
+
+# Figure out the version of the existing python:
+default PYTHONVER=`${PYTHON_INTERPRETER} -c "import sys; print(sys.version[:3])"`
 
 # Create necessary directories and set appropriate variables
 mkdir -p ${DOWNLOAD_PATH}
index ed434c7484c7d62bb365db60d5c3aeebedbf4084..e54dad956ed9bb9cf99bd1b2d6dd1519cae5f4bd 100644 (file)
@@ -19,19 +19,6 @@ BUILDCHAIN=custom
 
 INSTALL_PATH=${INSTALL_PATH}/${EXTRACTSTO}
 
-# Note that older PETSc ./configure only supports python2. For now, prefer
-# using python2 but use what the user supplies as PYTHON_INTERPRETER.
-if builtin command -v python2 --version > /dev/null; then
-  default PYTHON_INTERPRETER="python2"
-fi
-if builtin command -v python2.7 --version > /dev/null; then
-  default PYTHON_INTERPRETER="python2.7"
-fi
-if builtin command -v python3 --version > /dev/null; then
-  default PYTHON_INTERPRETER="python3"
-fi
-default PYTHON_INTERPRETER="python"
-
 
 #########################################################################
 
index 5f6e49a3c8973451c58187e97436210facb71626..703e634de60243a7f9b2c2c41b52aee371810aa9 100644 (file)
@@ -18,19 +18,6 @@ BUILDCHAIN=custom
 
 INSTALL_PATH=${INSTALL_PATH}/${NAME}
 
-# Note that older SLEPc ./configure only supports python2. For now, prefer
-# using python2 but use what the user supplies as PYTHON_INTERPRETER.
-if builtin command -v python2 --version > /dev/null; then
-  default PYTHON_INTERPRETER="python2"
-fi
-if builtin command -v python2.7 --version > /dev/null; then
-  default PYTHON_INTERPRETER="python2.7"
-fi
-if builtin command -v python3 --version > /dev/null; then
-  default PYTHON_INTERPRETER="python3"
-fi
-default PYTHON_INTERPRETER="python"
-
 
 ##############################################################################
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.