Skip to content

Commit 5c619d9

Browse files
committed
Merge remote-tracking branch 'github/master' into fix-waveform-set
2 parents f911e9c + ee1ba0c commit 5c619d9

File tree

9 files changed

+114
-67
lines changed

9 files changed

+114
-67
lines changed

.github/workflows/code.yml

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Install Python
1515
uses: actions/setup-python@v2
1616
with:
17-
python-version: '3.7'
17+
python-version: "3.7"
1818

1919
- name: Install Python Dependencies
2020
run: pip install flake8
@@ -33,37 +33,36 @@ jobs:
3333
python: [cp27, cp37, cp38, cp39]
3434

3535
exclude:
36-
- os: windows-latest
37-
# No cothread or asyncio so doesn't work
38-
python: cp27
36+
- os: windows-latest
37+
# No cothread or asyncio so doesn't work
38+
python: cp27
3939

4040
include:
41-
- os: ubuntu-latest
42-
# Put coverage in the output dir mounted in docker
43-
cov_file: /output/coverage.xml
44-
test_requires: cothread pytest-asyncio aioca
45-
# Build an sdist here so it has the right line endings
46-
sdist: true
47-
48-
- os: windows-latest
49-
cov_file: '{project}/dist/coverage.xml'
50-
# cothread doesn't work on windows
51-
test_requires: pytest-asyncio aioca
52-
53-
- os: macos-latest
54-
cov_file: '{project}/dist/coverage.xml'
55-
test_requires: cothread pytest-asyncio aioca
56-
57-
- os: ubuntu-latest
58-
python: cp27
59-
# asyncio doesn't work on Python2.7
60-
test_requires: cothread
61-
62-
- os: macos-latest
63-
python: cp27
64-
# asyncio doesn't work on Python2.7
65-
test_requires: cothread
66-
41+
- os: ubuntu-latest
42+
# Put coverage in the output dir mounted in docker
43+
cov_file: /output/coverage.xml
44+
test_requires: cothread pytest-asyncio aioca
45+
# Build an sdist here so it has the right line endings
46+
sdist: true
47+
48+
- os: windows-latest
49+
cov_file: "{project}/dist/coverage.xml"
50+
# cothread doesn't work on windows
51+
test_requires: pytest-asyncio aioca
52+
53+
- os: macos-latest
54+
cov_file: "{project}/dist/coverage.xml"
55+
test_requires: cothread pytest-asyncio aioca
56+
57+
- os: ubuntu-latest
58+
python: cp27
59+
# asyncio doesn't work on Python2.7
60+
test_requires: cothread
61+
62+
- os: macos-latest
63+
python: cp27
64+
# asyncio doesn't work on Python2.7
65+
test_requires: cothread
6766

6867
steps:
6968
- name: Checkout Source
@@ -74,10 +73,10 @@ jobs:
7473
- name: Install Python
7574
uses: actions/setup-python@v2
7675
with:
77-
python-version: '3.7'
76+
python-version: "3.7"
7877

7978
- name: Install Python Dependencies
80-
run: pip install build cibuildwheel
79+
run: pip install build cibuildwheel==1.* # The 2.* releases dropped Python2 support.
8180

8281
- name: Build Sdist
8382
if: matrix.sdist
@@ -91,8 +90,9 @@ jobs:
9190
CIBW_TEST_COMMAND: pytest --cov=softioc {project}/tests --cov-report xml:${{ matrix.cov_file }}
9291
# Disable auditwheel as it isn't compatible with setuptools_dso approach
9392
# https://github.com/mdavidsaver/setuptools_dso/issues/17
94-
CIBW_REPAIR_WHEEL_COMMAND: ''
93+
CIBW_REPAIR_WHEEL_COMMAND: ""
9594
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
95+
CIBW_ENVIRONMENT_LINUX: SETUPTOOLS_DSO_PLAT_NAME=manylinux1_x86_64
9696

9797
- name: Upload Wheel and Sdist
9898
uses: actions/upload-artifact@v2
@@ -125,4 +125,3 @@ jobs:
125125
TWINE_USERNAME: __token__
126126
TWINE_PASSWORD: ${{ secrets.pypi_token }}
127127
run: twine upload dist/*
128-

Pipfile.lock

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from softioc import builder, softioc
2+
from softioc.builder import records
3+
4+
builder.SetDeviceName("XX-XX-XX-01")
5+
6+
py_record = builder.aOut("VAL1", initial_value=5, on_update=print)
7+
soft_record = records.ao("VAL2", VAL=10)
8+
9+
calc = records.calc("CALC", CALC="A*B", INPA=builder.CP(py_record), B=1)
10+
11+
soft_record.OUT = builder.PP(calc.B)
12+
13+
builder.LoadDatabase()
14+
softioc.iocInit()
15+
16+
softioc.interactive_ioc(globals())

docs/how-to/use-soft-records.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Use soft records in an IOC
2+
==========================
3+
4+
It is possible to use records with soft device support mixed with pythonSoftIOC
5+
records (with Python device support). This allows use of ``calc``, ``fanout``
6+
and other EPICS database soft records.
7+
8+
.. literalinclude:: ../examples/example_records_calculate.py
9+
10+
The ``VAL1`` record is created in the usual pythonSoftIOC way, with Python
11+
device support. You can :meth:`~softioc.device.ProcessDeviceSupportOut.set` it,
12+
and `on_update` will be called when you ``caput`` it.
13+
14+
The ``VAL2`` record is created using the lower level
15+
:attr:`softioc.builder.records` object. You can `dbpf` it, and no Python will
16+
be called when you ``caput`` to it.
17+
18+
Note that the Device Name is shared between both kinds of records - both will
19+
have the same prefix.
20+
21+
We construct the ``calc`` record again using :attr:`softioc.builder.records`.
22+
This record will calculate ``A*B``:
23+
24+
- ``A`` is provided by the record pointed at by ``INPA``, which is
25+
``py_record``, and the `CP` link causes it to be monitored, processing
26+
``calc`` each time it updates.
27+
28+
- ``B`` is initially set to 1. When ``soft_record`` processes, it sends its
29+
value to ``calc.B``, and the `PP` link causes it to process.
30+
31+
.. note::
32+
33+
You could also use ``calc(SCAN="1 second", ...)`` instead of the `PP` and
34+
`CP` links, which would fetch the value periodically rather than just on
35+
change.
36+
37+
The output of this IOC can be examined by running this IOC in one terminal, and
38+
then modifying and running the example scripts found in `read-data-from-ioc`.
39+
Try setting the value of either ``VAL1`` or ``VAL2`` and observe the effect on
40+
the ``CALC`` output.

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Table Of Contents
6161
how-to/use-asyncio-in-an-ioc
6262
how-to/make-publishable-ioc
6363
how-to/read-data-from-ioc
64+
how-to/use-soft-records
6465

6566
.. toctree::
6667
:caption: Explanations

docs/reference/api.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -351,20 +351,12 @@ The following attributes allow more direct access to record creation.
351351

352352
.. attribute:: records
353353

354-
This is the ``iocbuilder`` records object, and is populated with
354+
This is the `epicsdbbuilder.records` object, and is populated with
355355
functions named after each available record type. Records created with
356356
these calls are created with soft device support and Python is not involved
357357
in their processing.
358358

359-
The following example shows a calc record being used to post-process a
360-
standard Python IOC record::
361-
362-
from softioc import builder
363-
builder.SetDeviceName('XX-XX-XX-01')
364-
rec = aIn('VALUE')
365-
calc = records.calc('CALC', CALC = 'A*B', A = rec, B = 42)
366-
rec.FLNK = PP(calc)
367-
359+
See `../how-to/use-soft-records` for a full example of its usage.
368360

369361
Finally, the following function is used to load record definitions before
370362
starting the IOC.

docs/tutorials/creating-an-ioc.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ internals of the IOC while it's running. The alternative is to call something
7171
like :func:`cothread.WaitForQuit` or some other `cothread` blocking
7272
action.
7373

74+
.. note::
75+
The following section should only be used for debugging purposes, and not
76+
for production testing, as the functions used do not necessarily reflect
77+
what a real user would see when querying an IOC over the network.
78+
See `../how-to/read-data-from-ioc` for proper network access examples.
79+
7480
In this interpreter there is immediate access to methods defined in the
7581
`softioc.softioc` module. For example the :func:`~softioc.softioc.dbgf` function
7682
can be run to observe the increasing value of ``AI``::
@@ -122,10 +128,11 @@ following types:
122128
``mbbo``, ``stringin``, ``stringout``, ``waveform``
123129

124130
Occasionally it may be desirable to create a soft record without ``Python``
125-
device support, particularly if any other record type is required. This can be done using the corresponding record creation
126-
functions provided as methods of :attr:`softioc.builder.records`. For example, if a ``calc``
127-
record is required then this can be created by calling
128-
``softioc.builder.records.calc``.
131+
device support, particularly if any other record type is required. This can be
132+
done using the corresponding record creation functions provided as methods of
133+
:attr:`softioc.builder.records`. For example, if a ``calc`` record is required
134+
then this can be created by calling ``softioc.builder.records.calc``. See an
135+
example in `../how-to/use-soft-records`.
129136

130137
For all records created by these methods both
131138
:meth:`~softioc.device.ProcessDeviceSupportIn.get` and

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", "epicscorelibs>=7.0.6.99.1.0a1"]
2+
requires = ["setuptools", "wheel", "setuptools_dso>=2.1", "epicscorelibs>=7.0.6.99.1.0a1"]
33
build-backend = "setuptools.build_meta:__legacy__"

setup.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import epicscorelibs.version
77
from setuptools_dso import Extension, setup
88
from epicscorelibs.config import get_config_var
9-
from wheel.bdist_wheel import bdist_wheel
109

1110
# Place the directory containing _version_git on the path
1211
for path, _, filenames in os.walk(os.path.dirname(os.path.abspath(__file__))):
@@ -100,18 +99,9 @@ def install_for_development(self):
10099
os.symlink(os.path.join(self.install_dir, "epicscorelibs"), link)
101100

102101

103-
class Wheel(bdist_wheel):
104-
def get_tag(self):
105-
impl, abi_tag, plat_name = bdist_wheel.get_tag(self)
106-
# We want to produce manylinux tagged builds, but can't use
107-
# auditwheel as it isn't compatible with setuptools_dso
108-
# override the tag here as cibuildwheel won't let us do this
109-
plat_name = os.environ.get("AUDITWHEEL_PLAT", plat_name)
110-
return (impl, abi_tag, plat_name)
111-
112102

113103
setup(
114-
cmdclass=dict(develop=Develop, bdist_wheel=Wheel, **get_cmdclass()),
104+
cmdclass=dict(develop=Develop, **get_cmdclass()),
115105
version=__version__,
116106
ext_modules = [ext],
117107
install_requires = [

0 commit comments

Comments
 (0)