Commit d8ce5d79 authored by Marco Clemencic's avatar Marco Clemencic

Merge branch 'fix-for-root-master' into 'master'

Fixes for ROOT master

See merge request !1071
parents 41fdc166 b88785ef
Pipeline #1730724 passed with stages
in 24 minutes and 47 seconds
......@@ -87,7 +87,7 @@ build:gcc9:opt:python3:
variables:
BINARY_TAG: x86_64-centos7-gcc9-opt
BUILDDIR: build-opt-python3
HEPTOOLS_VERSION: 96bpython3
HEPTOOLS_VERSION: 97python3
script:
- ci-utils/build
artifacts:
......
......@@ -14,7 +14,12 @@ gaudi_depends_on_subdirs(GaudiKernel GaudiUtils GaudiAlg RootCnv)
find_package(AIDA)
find_package(HepPDT)
find_package(ROOT COMPONENTS Tree RIO Hist Net REQUIRED)
find_package(ROOT COMPONENTS Core REQUIRED)
if(${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR} VERSION_LESS 6.20)
find_package(ROOT COMPONENTS Tree RIO Hist Net REQUIRED)
else()
find_package(ROOT COMPONENTS Tree RIO Hist Net ROOTHist REQUIRED)
endif()
find_package(Boost COMPONENTS python${boost_python_version} REQUIRED)
find_package(CLHEP)
find_package(PythonLibs REQUIRED)
......
......@@ -12,7 +12,11 @@
#
# The custom application class is implemented in C++ via ROOT interpreter
import cppyy
# Workaround for ROOT-10769
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import cppyy
# - we have to load GaudiKernel get the base class
cppyy.gbl.gSystem.Load("libGaudiKernel.so")
......
......@@ -47,7 +47,11 @@ if '__main__' == __name__:
print(__doc__, __author__)
# make sure cling can generate all required methods in Gaudi::Property
import cppyy
# Workaround for ROOT-10769
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import cppyy
cppyy.gbl.gInterpreter.Declare('#define NO_C_ARRAY_AS_PROPERTY_WARNING')
cppyy.gbl.gInterpreter.Declare('#include "GaudiKernel/CArrayAsProperty.h"')
......
......@@ -49,7 +49,11 @@ if '__main__' == __name__:
print(__doc__, __author__)
# make sure cling can generate all required methods in Gaudi::Property
import cppyy
# Workaround for ROOT-10769
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import cppyy
for h in ("GaudiKernel/SVectorAsProperty.h",
"GaudiKernel/VectorsAsProperty.h"):
cppyy.gbl.gInterpreter.Declare('#include "%s"' % h)
......
......@@ -32,12 +32,11 @@ import sys
import string
import warnings
import re
try:
# Workaround for ROOT-10769
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import cppyy
except ImportError:
# FIXME: backward compatibility
print("# WARNING: using PyCintex as cppyy implementation")
import PyCintex as cppyy
if sys.version_info >= (3, ):
# Python 2 compatibility
......@@ -70,7 +69,13 @@ GaudiHandleArrayProperty = gbl.GaudiHandleArrayProperty
DataObject = gbl.DataObject
SUCCESS = gbl.StatusCode(gbl.StatusCode.SUCCESS, True)
FAILURE = gbl.StatusCode(gbl.StatusCode.FAILURE, True)
nullptr = gbl.nullptr
# Workaround for ROOT-10770
if hasattr(cppyy, 'nullptr'):
nullptr = cppyy.nullptr
elif hasattr(gbl, 'nullptr'):
nullptr = gbl.nullptr
else:
nullptr = None
# Helper to create a StringProperty
cppyy.gbl.gInterpreter.Declare('''
namespace GaudiPython { namespace Helpers {
......@@ -82,7 +87,7 @@ namespace GaudiPython { namespace Helpers {
# toIntArray, toShortArray, etc.
for l in [l for l in dir(Helper) if re.match("^to.*Array$", l)]:
exec ("%s = Helper.%s" % (l, l))
exec("%s = Helper.%s" % (l, l))
__all__.append(l)
# FIXME: (MCl) Hack to handle ROOT 5.18 and ROOT >= 5.20
......@@ -98,9 +103,13 @@ else:
# ----Convenient accessors to PyROOT functionality ----------------------------
ROOT = cppyy.libPyROOT
makeNullPointer = cppyy.libPyROOT.MakeNullPointer
setOwnership = cppyy.libPyROOT.SetOwnership
# See https://sft.its.cern.ch/jira/browse/ROOT-10771
if hasattr(cppyy, 'libPyROOT'):
ROOT = cppyy.libPyROOT
else:
import ROOT
makeNullPointer = ROOT.MakeNullPointer
setOwnership = ROOT.SetOwnership
def deprecation(message):
......
......@@ -9,6 +9,10 @@
# or submit itself to any jurisdiction. #
#####################################################################################
"""Load the GaudiPython::Helper struct to check for Cling warnings."""
import cppyy
# Workaround for ROOT-10769
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import cppyy
cppyy.gbl.GaudiPython.Helper
......@@ -30,6 +30,7 @@
#include "TBranch.h"
#include "TDirectory.h"
#include "TMap.h"
#include "TObjString.h"
#include "TSystem.h"
using namespace std;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment