To build pythonSoftIoc follow these steps:
Edit the following files:
configure/RELEASESet
EPICS_BASEto point to your local installation of EPICS.configure/CONFIG_SITESet
PYTHONto the executable name of your Python interpreter.
Build
pythonIocwithout documentation by running:make BUILD_DOCS=
At this point you should be able to run
./pythonIocwhich will give you an interative Python interpreter.Now ensure that you have numpy, cothread, and epicsdbbuilder installed. These can be installed unversioned, or versioned (in which case
pkg_resources.requirewill need to be used), or just localling built and added to yourPYTHONPATH.Now check that
pythonIocworks by runningexample/runtest. You may need to editexample/version.pyif you're using a versioned install ofcothreadandepicsdbbuilder.Finally build the documentation by running:
make docs
Again, if your installation of components is versioned you may need to edit
docs/conf.pyas appropriate.
Probably the best way to use pythonSoftIoc is to start by copying fragments
of a simple example such as CS-DI-IOC-02. This consists of the following
elements:
A startup shell script
start-iocwhich launches the soft IOC using a production build ofpythonSoftIoc. This script typically looks like this:#!/bin/sh PYIOC=/path/to/pythonSoftIoc/pythonIoc cd "$(dirname "$0")" exec $PYIOC start_ioc.py "$@"
The startup Python script. This establishes the essential component versions (apart from the
pythonSoftIocversion), performs the appropriate initialisation and starts the IOC running. The following template is a useful starting point:from pkg_resources import require require('cothread==2.12') require('epicsdbbuilder==1.0') # Import the basic framework components. from softioc import softioc, builder import cothread # Import any modules required to run the IOC import ... # Boilerplate get the IOC started builder.LoadDatabase() softioc.iocInit() # Start processes required to be run after iocInit ... # Finally leave the IOC running with an interactive shell. softioc.interactive_ioc(globals())Note that the use of
requireis specific to DLS, and you may have a different way of managing your installations.