From fc07cf56fe95017ffe82ce793c21a182de63e53c Mon Sep 17 00:00:00 2001 From: Marco Clemencic <marco.clemencic@cern.ch> Date: Wed, 13 May 2020 22:57:03 +0200 Subject: [PATCH] Workaround for ROOT-10769 --- GaudiExamples/options/CustomAppFromOptions.py | 6 +++++- GaudiExamples/scripts/ArrayProperties.py | 6 +++++- GaudiExamples/scripts/ExtendedProperties2.py | 6 +++++- GaudiPython/python/GaudiPython/Bindings.py | 9 ++++----- GaudiPython/tests/scripts/test_helpers_import.py | 6 +++++- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/GaudiExamples/options/CustomAppFromOptions.py b/GaudiExamples/options/CustomAppFromOptions.py index 056534404..a52a50b63 100644 --- a/GaudiExamples/options/CustomAppFromOptions.py +++ b/GaudiExamples/options/CustomAppFromOptions.py @@ -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") diff --git a/GaudiExamples/scripts/ArrayProperties.py b/GaudiExamples/scripts/ArrayProperties.py index 26f3c9439..27fabf451 100755 --- a/GaudiExamples/scripts/ArrayProperties.py +++ b/GaudiExamples/scripts/ArrayProperties.py @@ -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"') diff --git a/GaudiExamples/scripts/ExtendedProperties2.py b/GaudiExamples/scripts/ExtendedProperties2.py index 17a8468cd..ec595fa4f 100755 --- a/GaudiExamples/scripts/ExtendedProperties2.py +++ b/GaudiExamples/scripts/ExtendedProperties2.py @@ -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) diff --git a/GaudiPython/python/GaudiPython/Bindings.py b/GaudiPython/python/GaudiPython/Bindings.py index cd0034133..c48f14511 100644 --- a/GaudiPython/python/GaudiPython/Bindings.py +++ b/GaudiPython/python/GaudiPython/Bindings.py @@ -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 diff --git a/GaudiPython/tests/scripts/test_helpers_import.py b/GaudiPython/tests/scripts/test_helpers_import.py index 9d68007d3..afb33f8ff 100644 --- a/GaudiPython/tests/scripts/test_helpers_import.py +++ b/GaudiPython/tests/scripts/test_helpers_import.py @@ -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 -- GitLab