Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
0c6f13c
Partially working on Windows.
pheest Oct 28, 2022
3c9a62f
Re-tested on Windows and Linux.
pheest Nov 1, 2022
1cbc7ad
Corrected _dbapi VS project name.
pheest Nov 2, 2022
102eecf
Added report pyDevSup.docx
pheest Jan 9, 2023
704c483
Follows document review by kwoods.
pheest Feb 1, 2023
020f760
Updated to VS2022 and Python 3.11
pheest Mar 4, 2023
9347091
Got it working with Michael's help.
pheest Mar 9, 2023
f4fe548
Deleted report document.
pheest Apr 1, 2023
2cdd8e3
Was able to run from makefiles in cmd.
pheest Apr 4, 2023
e2ab3ed
Built & ran hidenrga project.
pheest Apr 4, 2023
d78e913
Makefile build and test on Windows.
pheest Jul 25, 2023
b65a54b
* The construct @[ -d $(dir $@) ] and install command fail on Windows…
pheest Aug 7, 2023
66f3aff
Compared and merged with later changes made by mdavidsaver.
pheest Aug 7, 2023
9b435c5
Moved tempoary database file in to permanent file _dbapi.dbd.
pheest Aug 31, 2023
7107958
Separated int64 and lsi/lso from the main _dbapi.dbd file in order to…
pheest Aug 31, 2023
bc40ea6
Removed unnecessary debug print statements.
pheest Aug 31, 2023
2aa44cc
Corrected address operator mistake.
pheest Sep 5, 2023
713b2ea
For the purpose of making a pull request, discarded changes that I wa…
pheest Sep 5, 2023
44df05a
Updated following review comments by @mdavidsaver.
pheest Sep 5, 2023
1ddfe7b
Merge branch 'win32' into win32-merge
pheest Sep 7, 2023
fa31fda
Updated RULES_PY to use @$(INSTALL). This requires include $(CONFIG)/…
pheest Sep 11, 2023
c538a47
Merge branch 'win32-merge' of https://github.com/pheest/pyDevSup into…
pheest Sep 11, 2023
2fcf37a
Added use of the PY_LDLIBS variable to locate the Python import library.
pheest Sep 14, 2023
736a7fd
Reverted change to apply the Python library through LDFLAGS only due …
pheest Sep 18, 2023
7a18574
Reverted change to use get_python_lib - it seems not to work correctl…
pheest Oct 10, 2023
e8b96fb
Does it need __init__.py?
pheest Oct 10, 2023
3e828ee
__init__.py needed in build directory?
pheest Oct 11, 2023
7997858
Removed @ from Windows nose test command - so I can see what command …
pheest Oct 12, 2023
c301756
Additional debugging added to check directory paths.
pheest Oct 13, 2023
26df4eb
/c/hostedtoolcache/ syntax?
pheest Oct 13, 2023
312add7
Oops, always the slashes that get you.
pheest Oct 13, 2023
cf1d31c
Make sure we use any existing PYTHONPATH.
pheest Oct 13, 2023
f73a5a9
Silly syntax mistake.
pheest Oct 13, 2023
c6af763
Silly, PYTHONPATH doesn't exist until we define it.
pheest Oct 13, 2023
dd2c1ec
Try pushd / popd instead of set PYTHONPATH.
pheest Oct 20, 2023
868e51d
Removed debugging statements - these are not helping.
pheest Oct 23, 2023
de7ab4c
Updated CI-scripts as advised by mdavidsaver.
pheest Oct 24, 2023
d44bb09
Put debug messages back in __init__.py and replaced slashes to use Wi…
pheest Oct 24, 2023
69f6bb9
Removed use of XEPICS_BASE env variable as EPICS_BASE is already an e…
pheest Oct 24, 2023
cdb92e4
Removed debug print statements again.
pheest Oct 24, 2023
39a3e7f
Added tests & logic for lsi, lso and int64 types.
pheest Nov 21, 2023
7021a38
Resolved merge conflict of makehelper.py
pheest Aug 9, 2024
0f70191
Addressed numpy 2.0 build error - see https://github.com/pytorch/pyto…
pheest Aug 9, 2024
6399fd2
Corrected comment typo.
pheest Aug 9, 2024
edfa412
Changed to use master branch of .ci
pheest Aug 9, 2024
a1ae41c
Reverted undesired change of distutils.sysconfig
pheest Aug 10, 2024
5953d33
Updated makehelper.py with support for Windows using the file version…
pheest Aug 13, 2024
ff4392b
Also updated the Github build configuration which now includes Python…
pheest Aug 13, 2024
b9eca93
Updated at end of project.
pheest Mar 24, 2025
cbadf2a
Update ci-scripts-build.yml to allow manual workflow
pheest Sep 11, 2025
fc9d696
Fixed problem with NPY_CARRAY and NPY_CARRAY_RO being unavailable in …
Sep 12, 2025
13e5cbe
Windows server 2019 no longer available.
Sep 12, 2025
2536321
Tested Windows (and Linux) builds with Base 3.15.
Oct 10, 2025
0e3d6b2
Oops, corrected mistakes.
Oct 10, 2025
bda892e
Moved toward tford's branch with some small changes.
Oct 31, 2025
a2fec4c
Re-engineered the alarm handling stuff.
Dec 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci
131 changes: 107 additions & 24 deletions .github/workflows/ci-scripts-build.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -11,8 +11,9 @@ env:

jobs:
build-base:
name: ${{ matrix.base }}/${{ matrix.os }}/${{ matrix.python }}/${{ matrix.extra }}
name: ${{ matrix.base }}/${{ matrix.os }}/${{ matrix.profile }}/${{ matrix.python }}/${{ matrix.extra }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
# Set environment variables from matrix parameters
env:
CMP: ${{ matrix.cmp }}
Expand All @@ -31,24 +32,51 @@ jobs:
cmp: gcc
configuration: default
base: "7.0"
python: "2.7"
profile: deb8
python: "3.7"
profile: deb10
container: "python:3.7"
test: yes

- os: ubuntu-latest
cmp: gcc
configuration: default
base: "7.0"
python: "3.9"
profile: deb11
test: yes

- os: ubuntu-latest
cmp: gcc
configuration: default
base: "7.0"
python: "3.11"
profile: deb12
test: yes

- os: ubuntu-latest
cmp: gcc
configuration: default
base: "7.0"
python: "3.13"
profile: deb13
test: yes

- os: ubuntu-latest
cmp: gcc
configuration: default
base: "7.0"
python: "2.7"
profile: deb8
python: "3.6"
container: "python:3.6"
profile: latest
test: yes

- os: ubuntu-latest
cmp: gcc
configuration: default
base: "7.0"
python: "3.7"
profile: deb10
container: "python:3.7"
profile: latest
test: yes

- os: ubuntu-latest
Expand All @@ -75,17 +103,33 @@ jobs:
profile: latest
test: yes

- os: macos-latest
- os: ubuntu-latest
cmp: gcc
configuration: default
base: "7.0"
python: "3.10"
python: "3.11"
profile: latest
test: yes

- os: windows-latest
cmp: vs2019
configuration: debug
- os: ubuntu-latest
cmp: gcc
configuration: default
base: "7.0"
python: "3.12"
profile: latest
test: yes

- os: ubuntu-latest
cmp: gcc
configuration: default
base: "7.0"
python: "3.13"
profile: latest
test: yes

- os: macos-latest
cmp: gcc
configuration: default
base: "7.0"
python: "3.10"
profile: latest
Expand All @@ -95,22 +139,66 @@ jobs:
cmp: gcc
configuration: default
base: "3.15"
python: "2.7"
profile: deb8
python: "3.7"
container: "python:3.7"
profile: deb10
test: yes

- os: ubuntu-latest
cmp: gcc
configuration: default
base: "3.14"
python: "2.7"
profile: deb8
base: "3.15"
python: "3.13"
profile: deb13
test: yes

#- os: ubuntu-latest
# cmp: gcc
# configuration: default
# base: "3.14" # RuntimeError: Requires Base >=3.15 ??
# python: "3.7"
# container: "python:3.7"
# profile: deb10
# test: yes

- os: windows-latest
cmp: vs2022
configuration: default
base: "3.15"
python: "3.11"
profile: latest
test: yes

- os: windows-latest
cmp: vs2022
configuration: default
base: "7.0"
python: "3.11"
profile: latest
test: yes

- os: windows-latest
cmp: vs2022
configuration: default
base: "7.0"
python: "3.12"
profile: latest
test: yes

- os: windows-latest
cmp: vs2022
configuration: default
base: "7.0"
python: "3.13"
profile: latest
test: yes

steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python ${{ matrix.python }}
if: ${{ !matrix.container }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
Expand All @@ -125,13 +213,8 @@ jobs:
EOF
echo === configure/CONFIG_SITE.local ===
cat configure/CONFIG_SITE.local
- name: makehelper.py
run: python makehelper.py
- name: DSOs
shell: bash
run: find ${Python_ROOT_DIR} -name '*.dll' -o -name '*.so' -o -name '*.dylib'
- name: get_config_vars
run: python -c 'from sysconfig import get_config_vars; from pprint import pprint; pprint(get_config_vars())'
- name: Python sysconfig
run: python -m sysconfig
- name: Prepare and compile dependencies
run: python .ci/cue.py prepare
- name: Build main module
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ pyDevSup

EPICS Device support in Python.

See [documentation](http://mdavidsaver.github.io/pyDevSup)
See [documentation](http://epics-modules.github.io/pyDevSup)

For file [releases](https://github.com/mdavidsaver/pyDevSup/releases)
For file [releases](https://github.com/epics-modules/pyDevSup/releases)
4 changes: 4 additions & 0 deletions configure/CONFIG_PY
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ LOADABLE_SHRLIB_LDFLAGS = -bundle -flat_namespace -undefined dynamic_lookup
LOADABLE_SHRLIB_SUFFIX = .so
endif

ifeq ($(OS_CLASS),WIN32)
SHRLIB_SUFFIX_BASE = .pyd
endif

endif

endif
8 changes: 4 additions & 4 deletions configure/RULES_PY
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
ifneq ($(T_A),)

ifndef PY_VER
$(error Must include CONFIG_PY)
endif

include $(CONFIG)/CONFIG_BASE

PY_FILES += $(PY:%=$(PY_INSTALL_DIR)/%)

$(PY_FILES) : $(PY_INSTALL_DIR)/%: ../%
@[ -d $(dir $@) ] || install -d $(dir $@)
@echo "Install PY $@"
install -m 644 $< $@
$(ECHO) "Install PY $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)

build: $(PY_FILES)

Expand Down
9 changes: 8 additions & 1 deletion devsupApp/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ _dbapi_SRCS += utest.c
_dbapi_SRCS += pyDevSupCommon_registerRecordDeviceDriver.cpp

_dbapi_LIBS += $(EPICS_BASE_IOC_LIBS)
_dbapi_SYS_LIBS_WIN32 += python$(PY_LD_VER)
_dbapi_LDFLAGS_WIN32 += $(PY_LDLIBS)
_dbapi_SYS_LIBS_WIN32 += ws2_32 Advapi32 Dbghelp

PY += devsup/__init__.py
PY += devsup/_dbapi.dbd
PY += devsup/_int64.dbd
PY += devsup/_lsilso.dbd
PY += devsup/db.py
PY += devsup/dset.py
PY += devsup/hooks.py
Expand Down Expand Up @@ -63,7 +66,11 @@ pyconfig:

ifneq (,$(T_A))
nose:
ifeq ($(OS),Windows_NT)
pushd "$(abspath $(TOP))/python$(PY_LD_VER)/$(EPICS_HOST_ARCH)" && $(PYTHON) -m nose2 -v devsup $(NOSEFLAGS) && popd
else
PYTHONPATH="${PYTHONPATH}:$(abspath $(TOP))/python$(PY_LD_VER)/$(EPICS_HOST_ARCH)" $(PYTHON) -m nose2 -v devsup $(NOSEFLAGS)
endif

# bounce back down to the sphinx generated Makefile
# aren't Makefiles fun...
Expand Down
34 changes: 22 additions & 12 deletions devsupApp/src/dbfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ static const int dbf2np_map[DBF_MENU+1] = {
NPY_INT16, // DBF_MENU
};
static PyArray_Descr* dbf2np[DBF_MENU+1];
#if NPY_ABI_VERSION < 0x02000000
#define PyDataType_ELSIZE(descr) ((descr)->elsize)
#define PyDataType_SET_ELSIZE(descr, size) (descr)->elsize = size
#endif
#endif

typedef struct {
Expand Down Expand Up @@ -98,7 +102,7 @@ static PyObject* build_array(PyObject* obj, void *data, unsigned short ftype, un

desc = dbf2np[ftype];
if(ftype==DBF_STRING) {
desc->elsize = MAX_STRING_SIZE;
PyDataType_SET_ELSIZE(desc, MAX_STRING_SIZE);
}

Py_XINCREF(desc);
Expand All @@ -114,23 +118,26 @@ static int assign_array(DBADDR *paddr, PyObject *arr)
#ifdef HAVE_NUMPY
void *rawfield = paddr->pfield;
rset *prset;
PyObject *aval;
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(arr)!=2 || PyArray_DIM(arr,0)>maxlen || PyArray_DIM(arr,1)!=MAX_STRING_SIZE))
(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(arr)!=1 || PyArray_DIM(arr,0)>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;
}

insize = PyArray_DIM(arr, 0);
insize = PyArray_DIM(array, 0);

if(paddr->special==SPC_DBADDR &&
(prset=dbGetRset(paddr)) &&
Expand All @@ -152,7 +159,7 @@ static int assign_array(DBADDR *paddr, PyObject *arr)
}

Py_XINCREF(desc);
if(!(aval = PyArray_FromAny(arr, desc, 1, 2, NPY_CARRAY, 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(aval)) {
Expand Down Expand Up @@ -207,7 +214,7 @@ static PyObject* pyField_getval(pyField *self)

if(self->addr.no_elements>1) {
return build_array((PyObject*)self, rawfield, self->addr.field_type,
noe, NPY_CARRAY_RO);
noe, NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED);
}
}

Expand Down Expand Up @@ -296,8 +303,8 @@ static PyObject* pyField_putval(pyField *self, PyObject* args)
OP(LONG, epicsInt32, PyInt_AsLong);
OP(ULONG, epicsUInt32, PyInt_AsLong);
#ifdef HAVE_INT64
OP(INT64, epicsInt32, PyLong_AsLongLong);
OP(UINT64, epicsUInt32, PyLong_AsLongLong);
OP(INT64, epicsInt64, PyLong_AsLongLong);
OP(UINT64, epicsUInt64, PyLong_AsLongLong);
#endif
OP(FLOAT, epicsFloat32,PyFloat_AsDouble);
OP(DOUBLE,epicsFloat64,PyFloat_AsDouble);
Expand All @@ -314,11 +321,14 @@ static PyObject* pyField_putval(pyField *self, PyObject* args)
fld = PyString_AsString(val);
#endif
if(fld) {
strncpy(dest, fld, MAX_STRING_SIZE);
dest[MAX_STRING_SIZE-1]='\0';
strncpy(dest, fld, self->addr.field_size);
dest[self->addr.field_size-1]='\0';
} else {
dest[0] = '\0';
}
if ((self->addr.special == SPC_MOD) || (self->addr.special == SPC_NOMOD))
if (prset = dbGetRset(&self->addr))
prset->special(&self->addr, 1);
#if PY_MAJOR_VERSION >= 3
Py_DECREF(data);
#endif
Expand Down Expand Up @@ -362,7 +372,7 @@ static PyObject *pyField_getarray(pyField *self)
} else
data = self->addr.pfield;

return build_array((PyObject*)self, data, self->addr.field_type, self->addr.no_elements, NPY_CARRAY);
return build_array((PyObject*)self, data, self->addr.field_type, self->addr.no_elements, NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED | NPY_ARRAY_WRITEABLE);
}

static PyObject *pyField_getlen(pyField *self)
Expand Down
Loading