RHEL9 compliant

This commit is contained in:
Jan Chrin
2026-09-15 09:04:43 +02:00
parent 7f84e06fc2
commit 01f60b2f7f
29 changed files with 721214 additions and 530 deletions
+1 -1
View File
@@ -1 +1 @@
PyCafe_sls_py38.cpp
PyCafe_sls_py312.cpp_RHEL9
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+1
View File
@@ -5476,6 +5476,7 @@ void CAFE::loadSFGroups(std::string suff)
if (! Py_IsInitialized () )
{
std::cout << "INITIALIZING PY IN CAFE" << std::endl;
Py_Initialize();
}
+1 -1
View File
@@ -202,7 +202,7 @@ Conduit::Conduit(const char * _pv, ca_client_context *_ccc,
#if HAVE_PYCAFE_EXT
//Do nothing as PyCafe_ext is compiled
//Py_Initialize();
//dlopen("libpython2.6.so", RTLD_GLOBAL|RTLD_LAZY);
//dlopen("/opt/gfa/python-3.5/latest/lib/libpython3.5m.so", RTLD_GLOBAL|RTLD_LAZY);
+89 -23
View File
@@ -93,26 +93,30 @@ int Connect::createChannel(unsigned int handle, const char * pv, chid &pCh)
// Check pyCallbackFlag in ChannelOpenFolicy and set pyCallbackFlag in conduit object accordingly
//
Moved to create Handle
*/
*/
_status = ca_create_channel(pv, channelCreatePolicy.getHandler(), (void *) (unsigned long) handle,
channelCreatePolicy.getPriority(), &pCh);
if (pCh!=NULL)
{
if(MUTEX)
{
cafeMutex.lock(); //lock
}
handle_index.modify(it_handle, change_channelID (pCh));
if(MUTEX)
{
cafeMutex.unlock(); //unlock
}
channelRegalia = (*it_handle).getChannelRegalia();
//std::cout << " OLD VALUE " << channelRegalia.cafeConnectionState << " " << (*it_handle).pv << std::endl;
//std::cout << " OLD VALUE " << channelRegalia.cafeConnectionState << " " << (*it_handle).pv << std::flush << std::endl;
if ( channelRegalia.cafeConnectionState == ICAFE_CS_CLOSED) {
//This is to overwrite the last values arising from a user supplied closechannelkeephandle method
@@ -130,7 +134,7 @@ int Connect::createChannel(unsigned int handle, const char * pv, chid &pCh)
}
}
channelRegalia = (*it_handle).getChannelRegalia();
//std::cout << " NEW VALUE " << channelRegalia.cafeConnectionState << " " << (*it_handle).pv << std::endl;
//std::cout << " NEW VALUE " << channelRegalia.cafeConnectionState << " " << (*it_handle).pv << std::flush << std::endl;
//Install the access rights state change callback handler
if (ADD_EXCEPTION_EVENT==true)
@@ -139,7 +143,8 @@ int Connect::createChannel(unsigned int handle, const char * pv, chid &pCh)
}
ca_replace_access_rights_event(pCh, callbackHandlerAccessRights);
}
if (_status != ECA_NORMAL)
{
cout << __FILE__ << ":" << __LINE__ << endl;
@@ -161,24 +166,35 @@ int Connect::createChannel(unsigned int handle, const char * pv, chid &pCh)
return (int) _status;
}
//To Flush Send Buffer or not? Examine channelOpenPolicy.
if (channelOpenPolicy.getWhenToFlushSendBuffer()==FLUSH_AFTER_EACH_CHANNEL_CREATION)
{
using namespace boost::posix_time;
ptime timeStart(microsec_clock::local_time());
double timeElapsed=0;
unsigned int nPoll=0;
channelOpenPolicy.flushSendBufferNow();
ptime timeEnd(microsec_clock::local_time());
time_duration duration(timeEnd-timeStart);
timeElapsed= (double) duration.total_microseconds()/1000000.0;
// std::cout << __METHOD__ << channelOpenPolicy.getTimeout() << std::flush << std::endl;
// std::cout << __METHOD__ << (*it_handle).isConnected() << std::flush << std::endl;
while ( !(*it_handle).isConnected() && timeElapsed <= channelOpenPolicy.getTimeout())
{
#if HAVE_BOOST_THREAD
boost::this_thread::sleep_for(boost::chrono::microseconds(1000));
#else
#if HAVE_LINUX
@@ -223,7 +239,7 @@ int Connect::createChannel(unsigned int handle, const char * pv, chid &pCh)
handleHelper.getChannelRequestStatusGet (handle, cre);
}
//std::cout << __FILE__ << ":" << __LINE__ << " nPoll=" << nPoll << std::endl;
//std::cout << __FILE__ << ":" << __LINE__ << " nPoll=" << nPoll << std::flush<< std::endl;
if ((*it_handle).isConnected() && cre.getCallbackProgressKind()==(CAFENUM::CallbackProgressKind) CAFENUM::PENDING)
{
std::cout << "==================================" << std::endl;
@@ -244,13 +260,13 @@ int Connect::createChannel(unsigned int handle, const char * pv, chid &pCh)
}
}//if (channelOpenPolicy.getWhenToFlushSendBuffer()==FLUSH_AFTER_EACH_CHANNEL_CREATION)
}
else
{
return ECAFE_INVALID_HANDLE;
}
return (int) _status;
#undef __METHOD__
@@ -279,10 +295,13 @@ int Connect::createHandle(const char * pv, ca_client_context * ccc, unsigned in
{
cafeMutex.lock(); //lock
}
p = cs.insert(Conduit(pv, ccc,
channelRequestPolicyMasterPut, channelRequestPolicyMasterGet,
channelGetActionWhenMonitorPolicyMaster, pyCafeFlag));
if(MUTEX)
{
@@ -328,7 +347,8 @@ int Connect::createHandle(const char * pv, ca_client_context * ccc, unsigned in
}
handle=(*(p.first)).getHandle();
cafeConduit_set_by_handle & handle_index= cs.get<by_handle>();
//cafeConduit_set_by_handle::iterator it_handle;
@@ -341,9 +361,9 @@ int Connect::createHandle(const char * pv, ca_client_context * ccc, unsigned in
#if HAVE_PYTHON_H
bool _pyCallbackFlag=channelCreatePolicy.getPyCallbackFlag();
void * _pyConnectCallbackFn=channelCreatePolicy.getPyConnectHandler();
//cout << "========================================================== " << endl;
//cout << "pycafeflag " << pyCafeFlag << " handle = " << handle << " " << (*(p.first)).pv << endl;
//cout << " _pyCallbackFlag " << _pyCallbackFlag << " " << _pyConnectCallbackFn << endl;
//cout << "========================================================== " << flush << endl;
//cout << "pycafeflag " << pyCafeFlag << " handle = " << handle << " " << (*(p.first)).pv << flush << endl;
//cout << " _pyCallbackFlag " << _pyCallbackFlag << " " << _pyConnectCallbackFn << flush << endl;
//cout << "========================================================== " << endl;
if(MUTEX)
@@ -378,10 +398,11 @@ int Connect::createHandle(const char * pv, ca_client_context * ccc, unsigned in
}
#endif
// Normal return is ECA_TIMEOUT if pend_io/pend_event is instigated!!
_status=createChannel(handle, pv, pCh);
// Channel Access will spit out an Invalid String Error if pv not a string!
// Possible Errors from ca_create_channel: ECA_NORMAL, ECA_BADTYPE, ECA_STRTOBIG, ECA_ALLOCMEM
@@ -469,6 +490,33 @@ int Connect::init() //throw (CAFEException_init)
#undef __METHOD__
};
/**
AI generated - check Python version
*/
bool isVersionLessThan3_12(const std::string& versionStr) {
int major = 0;
int minor = 0;
// Clean up the string in case it contains "Python 3.10.2" instead of just "3.10.2"
size_t spacePos = versionStr.find_last_of(' ');
std::string cleanStr = (spacePos == std::string::npos) ? versionStr : versionStr.substr(spacePos + 1);
// Extract the major and minor integers (e.g., from "3.11.2", major=3, minor=11)
if (std::sscanf(cleanStr.c_str(), "%d.%d", &major, &minor) < 2) {
std::cerr << "Error: Could not parse version string format." << std::endl;
return false;
}
// Compare numerically
if (major < 3) return true;
if (major == 3 && minor < 12) return true;
return false;
}
/**
* \brief Called once prior to making any channel access calls \n
* \param select input: enum ca_preemptive_callback_select \n
@@ -480,21 +528,33 @@ int Connect::init(ca_preemptive_callback_select select) //throw (CAFEException_
{
#define __METHOD__ "Connect::init(ca_preemptive_callback_select)"
int status=ICAFE_NORMAL;
#if HAVE_PYTHON_H
#if HAVE_PYCAFE_EXT
std::string pyversion = PY_VERSION;
if (isVersionLessThan3_12(pyversion) == true) {
int pyStatus = PyImport_AppendInittab("PyCafe", PyInit_PyCafe); //Python 3
//std::cout << "PyImport_AppendInittab(PyCafe, PyInit_PyCafe); " << pyStatus << std::flush << std::endl;
if (pyStatus == -1) {
std::cout << "PyCafe Init failed!!" << std::endl;
exit(1);
}
Py_Initialize();
std::cout << "Py Initialized - " << pyversion << std::endl;
}
PyObject *module = PyImport_ImportModule("PyCafe");
if(module==NULL){
std::cout << "PyCafe import failed!!" << std::endl;
exit(1);
}
PyInit_PyCafe;
//PyInit_PyCafe;
//PyInit_PyCafe_sf();
//Py_Finalize();
//Python 2
@@ -898,6 +958,8 @@ int Connect::open(const char * _pv, unsigned int &handle)
// Determine ca-client context
ca_client_context * ccc = ca_current_context();
if (ccc == NULL)
{
try
@@ -923,9 +985,12 @@ int Connect::open(const char * _pv, unsigned int &handle)
// Check if handle already exists for this pv
// Handles for pvs that are members of a group are treated separately!
//std::cout << __METHOD__ << "pvv " << pv << std::flush << std::endl;
handle = handleHelper.getHandleFromPV(pv,ccc);
//std::cout << __METHOD__ << " handle " << handle << std::flush << std::endl;
if (handle != 0)
{
return ICAFE_NORMAL;
@@ -934,12 +999,12 @@ int Connect::open(const char * _pv, unsigned int &handle)
try
{
status = createHandle(pv, ccc, handle);
status = createHandle(pv, ccc, handle);
}
catch (CAFEException_pv & e)
{
std::cout << __METHOD__ << " EXCEPTION " << std::endl;
std::cout << __METHOD__ << " EXCEPTION " << std::flush << std::endl;
if (e.statusCode != ECA_BADSTR)
{
@@ -965,6 +1030,7 @@ int Connect::open(const char * _pv, unsigned int &handle)
return status;
}
return ICAFE_NORMAL;
#undef __METHOD__
+13 -13
View File
@@ -88,7 +88,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-pc-linux-gnu
host_triplet = x86_64-pc-linux-gnu
#am__append_1 = PyCafe.cpp
am__append_1 = PyCafe.cpp
#am__append_2 = zbsCafeService.cpp zbsDataHolders.cpp \
# bitshuffle/bitshuffle_core.c bitshuffle/bitshuffle.c bitshuffle/iochain.c
@@ -146,7 +146,7 @@ am__libcafe_la_SOURCES_DIST = cafe.cpp cafeCache.cpp cafeGroup.cpp \
zbsCafeService.cpp zbsDataHolders.cpp \
bitshuffle/bitshuffle_core.c bitshuffle/bitshuffle.c \
bitshuffle/iochain.c
#am__objects_1 = PyCafe.lo
am__objects_1 = PyCafe.lo
am__dirstamp = $(am__leading_dot)dirstamp
#am__objects_2 = zbsCafeService.lo zbsDataHolders.lo \
# bitshuffle/bitshuffle_core.lo \
@@ -276,9 +276,9 @@ AMTAR = $${TAR-tar}
#if HAVE_PYTHON_
#libcafe_la_SOURCES += pycafe/PyCafe.cpp
#endif
AM_CPPFLAGS = -fexceptions -fPIC -std=c++1z -z nodefs -I/usr/local/epics/base-7.0.10/include/ -I/usr/local/epics/base-7.0.10/include/os/Linux -I/usr/local/epics/base-7.0.10/include/compiler/gcc -I/psi.ch/project/cafe/bin/boost/boost_1_91_0/boost -I/psi.ch/project/cafe/bin/boost/boost_1_91_0 -I$(top_srcdir)/include
AM_CPPFLAGS = -fexceptions -fPIC -std=c++1z -z nodefs -I/usr/local/epics/base-7.0.10/include/ -I/usr/local/epics/base-7.0.10/include/os/Linux -I/usr/local/epics/base-7.0.10/include/compiler/gcc -I/psi.ch/project/cafe/bin/boost/boost_1_91_0/boost -I/psi.ch/project/cafe/bin/boost/boost_1_91_0 -I/psi.ch/group/8121/jan/pixi/pycafe-py312/.pixi/envs/work/include/python3.12 -I/psi.ch/group/8121/jan/pixi/pycafe-py312/.pixi/envs/work/lib/python3.12/site-packages/numpy/_core/include -I/psi.ch/group/8121/jan/pixi/pycafe-py312/.pixi/envs/work/lib/python3.12/site-packages/numpy -I$(top_srcdir)/include
AM_DEFAULT_VERBOSITY = 1
AM_LDFLAGS = -L/usr/local/epics/base-7.0.10/lib/RHEL9-x86_64 -Wl,-rpath,/usr/local/epics/base-7.0.10/lib/RHEL9-x86_64
AM_LDFLAGS = -L/usr/local/epics/base-7.0.10/lib/RHEL9-x86_64 -Wl,-rpath,/usr/local/epics/base-7.0.10/lib/RHEL9-x86_64 -L/psi.ch/group/8121/jan/pixi/pycafe-py312/.pixi/envs/work/lib -Wl,-rpath,/psi.ch/group/8121/jan/pixi/pycafe-py312/.pixi/envs/work/lib
AR = ar
AUTOCONF = ${SHELL} /psi.ch/group/8121/jan/gitea/CAFE/cpp/missing autoconf
AUTOHEADER = ${SHELL} /psi.ch/group/8121/jan/gitea/CAFE/cpp/missing autoheader
@@ -289,7 +289,7 @@ CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = gcc -E
CPPFLAGS = -fexceptions -fPIC -std=c++1z -z nodefs -I/usr/local/epics/base-7.0.10/include/ -I/usr/local/epics/base-7.0.10/include/os/Linux -I/usr/local/epics/base-7.0.10/include/compiler/gcc -I/psi.ch/project/cafe/bin/boost/boost_1_91_0/boost -I/psi.ch/project/cafe/bin/boost/boost_1_91_0
CPPFLAGS = -fexceptions -fPIC -std=c++1z -z nodefs -I/usr/local/epics/base-7.0.10/include/ -I/usr/local/epics/base-7.0.10/include/os/Linux -I/usr/local/epics/base-7.0.10/include/compiler/gcc -I/psi.ch/project/cafe/bin/boost/boost_1_91_0/boost -I/psi.ch/project/cafe/bin/boost/boost_1_91_0 -I/psi.ch/group/8121/jan/pixi/pycafe-py312/.pixi/envs/work/include/python3.12 -I/psi.ch/group/8121/jan/pixi/pycafe-py312/.pixi/envs/work/lib/python3.12/site-packages/numpy/_core/include -I/psi.ch/group/8121/jan/pixi/pycafe-py312/.pixi/envs/work/lib/python3.12/site-packages/numpy
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
@@ -313,9 +313,9 @@ INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS = -L/usr/local/epics/base-7.0.10/lib/RHEL9-x86_64 -Wl,-rpath,/usr/local/epics/base-7.0.10/lib/RHEL9-x86_64
LDFLAGS = -L/usr/local/epics/base-7.0.10/lib/RHEL9-x86_64 -Wl,-rpath,/usr/local/epics/base-7.0.10/lib/RHEL9-x86_64 -L/psi.ch/group/8121/jan/pixi/pycafe-py312/.pixi/envs/work/lib -Wl,-rpath,/psi.ch/group/8121/jan/pixi/pycafe-py312/.pixi/envs/work/lib
LIBOBJS =
LIBS =
LIBS = -lpython3.12
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
@@ -333,17 +333,17 @@ OTOOL64 =
PACKAGE = cafe
PACKAGE_BUGREPORT = Bug reports to: jan.chrin@psi.ch
PACKAGE_NAME = CAFE
PACKAGE_STRING = CAFE 1.22.0
PACKAGE_STRING = CAFE 1.22.1
PACKAGE_TARNAME = cafe
PACKAGE_URL =
PACKAGE_VERSION = 1.22.0
PACKAGE_VERSION = 1.22.1
PATH_SEPARATOR = :
RANLIB = ranlib
SED = /usr/bin/sed
SET_MAKE =
SHELL = /bin/sh
STRIP = strip
VERSION = 1.22.0
VERSION = 1.22.1
abs_builddir = /psi.ch/group/8121/jan/gitea/CAFE/cpp/src
abs_srcdir = /psi.ch/group/8121/jan/gitea/CAFE/cpp/src
abs_top_builddir = /psi.ch/group/8121/jan/gitea/CAFE/cpp
@@ -378,7 +378,7 @@ htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /psi.ch/group/8121/jan/gitea/CAFE/cpp/install-sh
libdir = /psi.ch/project/cafe/bin/cpp/cafe-1.22.0-hipa-gcc-11.5.0/lib/RHEL9-x86_64
libdir = /psi.ch/project/cafe/bin/cpp/cafe-1.22.1-py312-gcc-11.5.0/lib/RHEL9-x86_64
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
@@ -386,7 +386,7 @@ mandir = ${datarootdir}/man
mkdir_p = $(MKDIR_P)
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /psi.ch/project/cafe/bin/cpp/cafe-1.22.0-hipa-gcc-11.5.0
prefix = /psi.ch/project/cafe/bin/cpp/cafe-1.22.1-py312-gcc-11.5.0
program_transform_name = s,x,x,
psdir = ${docdir}
runstatedir = ${localstatedir}/run
@@ -407,7 +407,7 @@ lib_LTLIBRARIES = libcafe.la
#2nd: age
#3rd: revision
#1.9.2 1.10.2 1.11.0 1.11.1 1.12.0 1.12.1 1.12.2 1.12.4
libcafe_la_LDFLAGS = -version-info 23:0:22
libcafe_la_LDFLAGS = -version-info 23:1:22
libcafe_la_SOURCES = cafe.cpp cafeCache.cpp cafeGroup.cpp \
cafeVectors.cpp cafeXML.cpp callbackHandlerCreate.cpp \
callbackHandlerMonitor.cpp conduit.cpp connect.cpp \
+1 -1
View File
@@ -12,7 +12,7 @@ lib_LTLIBRARIES = libcafe.la
#2nd: age
#3rd: revision
#1.9.2 1.10.2 1.11.0 1.11.1 1.12.0 1.12.1 1.12.2 1.12.4
libcafe_la_LDFLAGS = -version-info 23:0:22
libcafe_la_LDFLAGS = -version-info 23:1:22
libcafe_la_SOURCES = cafe.cpp cafeCache.cpp cafeGroup.cpp cafeVectors.cpp cafeXML.cpp \
callbackHandlerCreate.cpp callbackHandlerMonitor.cpp conduit.cpp connect.cpp connectCallbacks.cpp \