diff --git a/src/config/makefile.h b/src/config/makefile.h index 082ab0dba0..c544fa7760 100644 --- a/src/config/makefile.h +++ b/src/config/makefile.h @@ -1322,7 +1322,8 @@ ifeq ($(BUILDING_PYTHON),python) # EXTRA_LIBS += -L/home/edo/tcltk/lib/LINUX -ltk8.3 -ltcl8.3 -L/usr/X11R6/lib -lX11 -ldl # needed if python was built with pthread support ifneq ($(GOTMINGW32),1) - PYMAJOR = $(echo $PYTHONVERSION | cut -d. -f1) + PYMAJOR:=$(word 1, $(subst ., ,$(PYTHONVERSION))) + $(error pyversion is $(echo $PYTHONVERSION | cut -d. -f1)) ifeq (${PYMAJOR},3) EXTRA_LIBS += $(shell $(PYTHONHOME)/bin/python3-config --libs) -lnwcutil else @@ -2404,7 +2405,8 @@ ifeq ($(_CPU),$(findstring $(_CPU), ppc64 ppc64le)) ifeq ($(BUILDING_PYTHON),python) # EXTRA_LIBS += -ltk -ltcl -L/usr/X11R6/lib -lX11 -ldl - PYMAJOR = $(echo $PYTHONVERSION | cut -d. -f1) + PYMAJOR:=$(word 1, $(subst ., ,$(PYTHONVERSION))) + $(error pyversion is ${PYMAJOR}) ifeq (${PYMAJOR},3) EXTRA_LIBS += -lnwcutil $(shell $(PYTHONHOME)/bin/python3-config --libs) #-lz else @@ -2586,7 +2588,7 @@ $(error ) endif # ifdef USE_PYTHONCONFIG -PYMAJOR = $(echo $PYTHONVERSION | cut -d. -f1) +PYMAJOR:=$(word 1, $(subst ., ,$(PYTHONVERSION))) ifeq (${PYMAJOR},3) EXTRA_LIBS += $(shell $(PYTHONHOME)/bin/python3-config --ldflags) else diff --git a/src/python/GNUmakefile b/src/python/GNUmakefile index 2c07c335c9..3368978e23 100644 --- a/src/python/GNUmakefile +++ b/src/python/GNUmakefile @@ -19,7 +19,7 @@ error1: @exit 1 endif -PYMAJOR = $(echo $PYTHONVERSION | cut -d. -f1) +PYMAJOR:=$(word 1, $(subst ., ,$(PYTHONVERSION))) ifeq (${PYMAJOR},3) LIB_INCLUDES = $(shell $(PYTHONHOME)/bin/python3-config --includes) else diff --git a/src/python/nwchem_wrap.c b/src/python/nwchem_wrap.c index 373975be55..c7b202494f 100644 --- a/src/python/nwchem_wrap.c +++ b/src/python/nwchem_wrap.c @@ -150,7 +150,7 @@ char *Parse_String(PyObject *arg) if (PyUnicode_Check(arg)) { ascii_string = PyUnicode_AsASCIIString(arg); out = PyBytes_AsString(ascii_string); - Py_DECREF(ascii_string) + Py_DECREF(ascii_string); } else if (PyBytes_Check(arg)) { out = PyBytes_AsString(arg); } else { @@ -240,8 +240,8 @@ static PyObject *wrap_rtdb_put(PyObject *self, PyObject *args) void *array = 0; PyObject *obj, *obj_item, *ascii_string; - ma_type = -1 - PyArg_ParseTuple(args, "so|i", &name, &obj, &ma_type) + ma_type = -1; + PyArg_ParseTuple(args, "so|i", &name, &obj, &ma_type); if (PyList_Check(obj)) list = 1; @@ -1709,7 +1709,7 @@ static struct module_state _state; #endif static PyObject* error_out(PyObject *m) { - struct module-state *st = GETSTATE(m); + struct module_state *st = GETSTATE(m); PyErr_SetString(st->error, "something bad happened"); return NULL; } diff --git a/src/python/task_python.c b/src/python/task_python.c index e0de420d5d..5fd5747c1f 100644 --- a/src/python/task_python.c +++ b/src/python/task_python.c @@ -11,7 +11,11 @@ #include #include "typesf2c.h" +#if PY_MAJOR_VERSION >= 3 +extern PyMODINIT_FUNC PyInit_nwchem(); +#else extern void initnwchem(); +#endif extern void util_file_parallel_copy(const char *, const char *);