From ac491cbf88a04e4829c7f03e11322d5220ebadd6 Mon Sep 17 00:00:00 2001 From: Peter Heesterman Date: Thu, 30 Jul 2026 18:51:38 +0100 Subject: [PATCH 1/2] Re-created from old fork. --- .github/workflows/ci-scripts-build.yml | 4 +++- devsupApp/src/dbfield.c | 17 ++++++++--------- devsupApp/src/devsup/disect.py | 1 + pyIocApp/setup.c | 3 +++ requirements-deb10.txt | 1 - 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-scripts-build.yml b/.github/workflows/ci-scripts-build.yml index c46ce43..0bbc685 100644 --- a/.github/workflows/ci-scripts-build.yml +++ b/.github/workflows/ci-scripts-build.yml @@ -1,7 +1,7 @@ name: pyDevSup # Trigger on pushes and PRs to any branch -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] env: SETUP_PATH: .ci-local:.ci @@ -159,6 +159,8 @@ jobs: python: "3.7" container: "python:3.7" profile: deb10 + test: # no - RuntimeError: Requires Base >=3.15 for iocBuildIsolated() + steps: - uses: actions/checkout@v3 with: diff --git a/devsupApp/src/dbfield.c b/devsupApp/src/dbfield.c index 94da410..abca9f0 100644 --- a/devsupApp/src/dbfield.c +++ b/devsupApp/src/dbfield.c @@ -3,7 +3,6 @@ #undef _POSIX_C_SOURCE #undef _XOPEN_SOURCE -#include #ifdef HAVE_NUMPY #include #endif @@ -118,21 +117,21 @@ static int assign_array(DBADDR *paddr, PyObject *arr) #ifdef HAVE_NUMPY void *rawfield = paddr->pfield; rset *prset; - PyObject *aval; - PyArrayObject *array = (PyArrayObject *)arr; + PyArrayObject *aval; + PyArrayObject * array = (PyArrayObject *)arr; unsigned elemsize = dbValueSize(paddr->field_type); unsigned long maxlen = paddr->no_elements, insize; PyArray_Descr *desc = dbf2np[paddr->field_type]; if(paddr->field_type==DBF_STRING && - (PyArray_NDIM(array) != 2 || - PyArray_DIM(array, 0) > (npy_intp) maxlen || + (PyArray_NDIM(array) != 2 || + PyArray_DIM(array, 0) > (npy_intp) maxlen || PyArray_DIM(array, 1) != MAX_STRING_SIZE)) { PyErr_Format(PyExc_ValueError, "String array has incorrect shape or is too large"); return 1; - } else if(PyArray_NDIM(array) != 1 || PyArray_DIM(array, 0) > (npy_intp) maxlen) { + } else if(PyArray_NDIM(array)!=1 || PyArray_DIM(array,0)>maxlen) { PyErr_Format(PyExc_ValueError, "Array has incorrect shape or is too large"); return 1; } @@ -162,14 +161,14 @@ static int assign_array(DBADDR *paddr, PyObject *arr) if(!(aval = PyArray_FromAny(arr, desc, 1, 2, NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED | NPY_ARRAY_WRITEABLE, arr))) return 1; - if(elemsize!=PyArray_ITEMSIZE((PyArrayObject *)aval)) { + if(elemsize!=PyArray_ITEMSIZE(aval)) { PyErr_Format(PyExc_AssertionError, "item size mismatch %u %u", - elemsize, (unsigned)PyArray_ITEMSIZE((PyArrayObject *)aval)); + elemsize, (unsigned)PyArray_ITEMSIZE(aval) ); Py_DECREF(aval); return 1; } - memcpy(rawfield, PyArray_GETPTR1((PyArrayObject *)aval, 0), insize*elemsize); + memcpy(rawfield, PyArray_GETPTR1(aval, 0), insize*elemsize); Py_DECREF(aval); diff --git a/devsupApp/src/devsup/disect.py b/devsupApp/src/devsup/disect.py index d166f74..b826361 100644 --- a/devsupApp/src/devsup/disect.py +++ b/devsupApp/src/devsup/disect.py @@ -4,6 +4,7 @@ import sys, gc, inspect, time try: + InstanceType = None from types import InstanceType except ImportError: pass # py3 diff --git a/pyIocApp/setup.c b/pyIocApp/setup.c index 61c3861..0f87fe2 100644 --- a/pyIocApp/setup.c +++ b/pyIocApp/setup.c @@ -130,7 +130,10 @@ static void cleanupPrep(initHookState state) static void pySetupReg(void) { Py_InitializeEx(0); +#if NPY_TARGET_VERSION < NPY_1_9_API_VERSION + /* See https://docs.python.org/3/whatsnew/3.9.html */ PyEval_InitThreads(); +#endif setupPyPath(); diff --git a/requirements-deb10.txt b/requirements-deb10.txt index 91aeff2..039a17d 100644 --- a/requirements-deb10.txt +++ b/requirements-deb10.txt @@ -1,3 +1,2 @@ numpy==1.16.2 -#nose==1.3.7 nose2 From 00d9f1cc51724bc400f5d49c99b2bc135a1c6d5b Mon Sep 17 00:00:00 2001 From: Peter Heesterman Date: Tue, 4 Aug 2026 14:22:50 +0100 Subject: [PATCH 2/2] Added typecast in dbfield.c to address compilation on stricter compilers. Added comment in index.rst to note that static builds cannot be used with the module (and why). --- devsupApp/src/dbfield.c | 4 ++-- documentation/index.rst | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/devsupApp/src/dbfield.c b/devsupApp/src/dbfield.c index abca9f0..5e9e269 100644 --- a/devsupApp/src/dbfield.c +++ b/devsupApp/src/dbfield.c @@ -131,7 +131,7 @@ static int assign_array(DBADDR *paddr, PyObject *arr) PyErr_Format(PyExc_ValueError, "String array has incorrect shape or is too large"); return 1; - } else if(PyArray_NDIM(array)!=1 || PyArray_DIM(array,0)>maxlen) { + } else if(PyArray_NDIM(array) != 1 || PyArray_DIM(array, 0) > (npy_intp) maxlen) { PyErr_Format(PyExc_ValueError, "Array has incorrect shape or is too large"); return 1; } @@ -158,7 +158,7 @@ static int assign_array(DBADDR *paddr, PyObject *arr) } Py_XINCREF(desc); - if(!(aval = PyArray_FromAny(arr, desc, 1, 2, NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED | NPY_ARRAY_WRITEABLE, arr))) + if(!(aval = (PyArrayObject *)PyArray_FromAny(arr, desc, 1, 2, NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED | NPY_ARRAY_WRITEABLE, arr))) return 1; if(elemsize!=PyArray_ITEMSIZE(aval)) { diff --git a/documentation/index.rst b/documentation/index.rst index e3a86d1..fd5ad57 100644 --- a/documentation/index.rst +++ b/documentation/index.rst @@ -11,9 +11,18 @@ pydevsup documentation It currently supports EPICS >=3.14.12 and python versions >=3.6 The numpy package is also required. -The source can be found at http://github.com/mdavidsaver/pyDevSup - -File releases are available at https://github.com/mdavidsaver/pyDevSup/releases +It is not possible to use the module with a static build configuration. +The code will build, but it will not work. +The reason is that EPICS database defintions are created in two modules: +1. The _dbapi module creates the defintion of 'Python Device'. +2. The softIocPy module implements device types such as longin that use 'Python Device'. + In a static build, these are held in seperate EPICS databases. + Consequently the softIocPy module does not know what a 'Python Device' is. + In a shared library build there is ony one database, held by the underlying EPICS base library. + +The source can be found at http://github.com/epics-modules/pyDevSup + +File releases are available at https://github.com/epics-modules/pyDevSup/releases Contents: