Skip to content

Commit 026ed69

Browse files
Do code review and CI fixes
We don't need the newest version of epicscorelibs. Fix attempting to use cothread on Windows. Import registerAllRecordDeviceDrivers ourselves so we can do error checking the same way as other functions, without relying on epicscorelibs or needing additional error handling
1 parent 9eb29d0 commit 026ed69

File tree

6 files changed

+15
-17
lines changed

6 files changed

+15
-17
lines changed

Pipfile.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[build-system]
2-
requires = ["setuptools", "wheel", "setuptools_dso>=2.1", "epicscorelibs>=7.0.7.99.1.2a1"]
2+
requires = ["setuptools", "wheel", "setuptools_dso>=2.1", "epicscorelibs>=7.0.7.99.1.1a3"]
33
build-backend = "setuptools.build_meta:__legacy__"

softioc/__init__.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
'''Python soft IOC module.'''
22
import os
3-
import ctypes
43

5-
from setuptools_dso.runtime import find_dso
64
import epicscorelibs.path
7-
import pvxslibs.path
8-
from epicscorelibs.ioc import \
9-
iocshRegisterCommon, registerRecordDeviceDriver, pdbbase
5+
from epicscorelibs.ioc import iocshRegisterCommon, pdbbase
106

117
# Do this as early as possible, in case we happen to use cothread
128
# This will set the CATOOLS_LIBCA_PATH environment variable in case we use
@@ -15,7 +11,7 @@
1511

1612
# This import will also pull in the extension, which is needed
1713
# before we call iocshRegisterCommon
18-
from .imports import dbLoadDatabase
14+
from .imports import dbLoadDatabase, registerRecordDeviceDriver
1915
from ._version_git import __version__
2016

2117
# Need to do this before calling anything in device.py
@@ -25,7 +21,6 @@
2521
iocStats = os.path.join(os.path.dirname(__file__), "iocStats", "devIocStats")
2622
dbLoadDatabase('devIocStats.dbd', iocStats, None)
2723

28-
if registerRecordDeviceDriver(pdbbase):
29-
raise RuntimeError('Error registering')
24+
registerRecordDeviceDriver(pdbbase)
3025

3126
__all__ = ['__version__']

softioc/imports.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ def from_param(cls, value):
105105
epicsExitCallAtExits.argtypes = ()
106106
epicsExitCallAtExits.restype = None
107107

108+
registerRecordDeviceDriver = dbCore.registerAllRecordDeviceDrivers
109+
registerRecordDeviceDriver.argtypes = (c_void_p,)
110+
registerRecordDeviceDriver.errcheck = expect_success
108111

109112
__all__ = [
110113
'get_field_offsets',

softioc/softioc.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from tempfile import NamedTemporaryFile
77

88
import pvxslibs.path
9-
from epicscorelibs.ioc import registerRecordDeviceDriver, pdbbase
9+
from epicscorelibs.ioc import pdbbase
1010
from setuptools_dso.runtime import find_dso
1111

1212
from . import autosave, imports, device
@@ -44,8 +44,7 @@ def iocInit(dispatcher=None, enable_pva=True):
4444
dbLoadDatabase('pvxsIoc.dbd', pvxslibs.path.dbd_path, None)
4545
ctypes.CDLL(find_dso('pvxslibs.lib.pvxsIoc'), ctypes.RTLD_GLOBAL)
4646

47-
if registerRecordDeviceDriver(pdbbase):
48-
raise RuntimeError('Error registering')
47+
imports.registerRecordDeviceDriver(pdbbase)
4948

5049
imports.iocInit()
5150
autosave.start_autosave_thread()

tests/test_pvaccess.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
get_multiprocessing_context,
1313
)
1414

15-
from softioc import builder, softioc
15+
from softioc import asyncio_dispatcher, builder, softioc
1616

1717

1818
class TestPVAccess:
@@ -26,8 +26,9 @@ def pva_test_func(self, device_name, conn, use_pva):
2626

2727
builder.aOut(self.record_name, initial_value=self.record_value)
2828

29+
dispatcher = asyncio_dispatcher.AsyncioDispatcher()
2930
builder.LoadDatabase()
30-
softioc.iocInit(enable_pva=use_pva)
31+
softioc.iocInit(dispatcher=dispatcher, enable_pva=use_pva)
3132

3233
conn.send("R") # "Ready"
3334
log("CHILD: Sent R over Connection to Parent")

0 commit comments

Comments
 (0)