From 4a2b25e6ab8bd4d28d3d344e1003e882811331a4 Mon Sep 17 00:00:00 2001 From: edoapra Date: Thu, 7 Mar 2024 11:30:32 -0800 Subject: [PATCH] detect python3 and python3 --- src/python/GNUmakefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/python/GNUmakefile b/src/python/GNUmakefile index be7af11fe7..3a88e49052 100644 --- a/src/python/GNUmakefile +++ b/src/python/GNUmakefile @@ -7,7 +7,16 @@ LIBRARY = libnwpython.a OBJ = python_input.o task_python.o nwchem_wrap.o nw_inp_from_string.o ifndef PYTHONVERSION - PYTHONVERSION=$(shell python -V| cut -d ' ' -f 2 |cut -d . -f 1-2) + GOTPYTHON := $(shell command -v python 2> /dev/null) + GOTPYTHON2 := $(shell command -v python2 2> /dev/null) + GOTPYTHON3 := $(shell command -v python3 2> /dev/null) + ifdef GOTPYTHON3 + PYTHONVERSION=$(shell python3 -V| cut -d ' ' -f 2 |cut -d . -f 1-2) + else ifdef GOTPYTHON2 + PYTHONVERSION=$(shell python2 -V| cut -d ' ' -f 2 |cut -d . -f 1-2) + else ifdef GOTPYTHON + PYTHONVERSION=$(shell python -V| cut -d ' ' -f 2 |cut -d . -f 1-2) + endif endif LIB_INCLUDES = $(shell python$(PYTHONVERSION)-config --includes| sed -e "s/\-iwithsysroot/\-I/g")