diff --git a/CondCore/CondDB/test/BuildFile.xml b/CondCore/CondDB/test/BuildFile.xml index a1ceb75cfe9e2..2a55823be39b3 100644 --- a/CondCore/CondDB/test/BuildFile.xml +++ b/CondCore/CondDB/test/BuildFile.xml @@ -5,20 +5,25 @@ - - - - + + + + + + + + + diff --git a/CondCore/EcalPlugins/plugins/BuildFile.xml b/CondCore/EcalPlugins/plugins/BuildFile.xml index 4e132892efb9a..17cbd4c7a5676 100644 --- a/CondCore/EcalPlugins/plugins/BuildFile.xml +++ b/CondCore/EcalPlugins/plugins/BuildFile.xml @@ -229,3 +229,11 @@ + + + + + + + + diff --git a/CondCore/EcalPlugins/plugins/EcalCondObjectContainer_EcalTPGCrystalStatusCode_toXML.cc b/CondCore/EcalPlugins/plugins/EcalCondObjectContainer_EcalTPGCrystalStatusCode_toXML.cc new file mode 100644 index 0000000000000..6c7d00090fd81 --- /dev/null +++ b/CondCore/EcalPlugins/plugins/EcalCondObjectContainer_EcalTPGCrystalStatusCode_toXML.cc @@ -0,0 +1,20 @@ + +#include "CondCore/Utilities/interface/PayloadToXML.h" +#include "CondCore/Utilities/src/CondFormats.h" + +namespace { // Avoid cluttering the global namespace. + + // converter methods + std::string EcalCondObjectContainer_EcalTPGCrystalStatusCode2xml( std::string const &payloadData, std::string const &payloadType ) { + return cond::convertToXML > (payloadData, payloadType); + } + +} // end namespace + + +BOOST_PYTHON_MODULE( pluginEcalCondObjectContainer_EcalTPGCrystalStatusCode_toXML ) +{ + using namespace boost::python; + def ("EcalCondObjectContainer_EcalTPGCrystalStatusCode2xml" , &EcalCondObjectContainer_EcalTPGCrystalStatusCode2xml); + +} diff --git a/CondCore/Utilities/python/cond2xml.py b/CondCore/Utilities/python/cond2xml.py index 34e22f23a9a94..bdc39aa0108a9 100644 --- a/CondCore/Utilities/python/cond2xml.py +++ b/CondCore/Utilities/python/cond2xml.py @@ -34,7 +34,7 @@ namespace { // Avoid cluttering the global namespace. - std::string %(plType)s2xml( const std::string &payloadData, const std::string &payloadType ) { + std::string %(plTypeSan)s2xml( const std::string &payloadData, const std::string &payloadType ) { // now to convert std::unique_ptr< %(plType)s > payload; @@ -62,7 +62,7 @@ BOOST_PYTHON_MODULE(%(mdName)s) { using namespace boost::python; - def ("%(plType)s2xml", %(plType)s2xml); + def ("%(plTypeSan)s2xml", %(plTypeSan)s2xml); } """ @@ -108,6 +108,10 @@ def ("%(plType)s2xml", %(plType)s2xml); """ +# helper function +def sanitize(typeName): + return typeName.replace(' ','').replace('<','_').replace('>','') + class CondXmlProcessor(object): def __init__(self, condDBIn): @@ -131,16 +135,21 @@ def __del__(self): def discover(self, payloadType): + # print "discover> checking for plugin of type %s" % payloadType + # first search in developer area: libDir = os.path.join( os.environ["CMSSW_BASE"], 'lib', os.environ["SCRAM_ARCH"] ) - pluginList = glob.glob( libDir + '/plugin%s_toXML.so' % payloadType ) + pluginList = glob.glob( libDir + '/plugin%s_toXML.so' % sanitize(payloadType) ) # if nothing found there, check release: if not pluginList: libDir = os.path.join( os.environ["CMSSW_RELEASE_BASE"], 'lib', os.environ["SCRAM_ARCH"] ) - pluginList = glob.glob( libDir + '/plugin%s_toXML.so' % payloadType ) + pluginList = glob.glob( libDir + '/plugin%s_toXML.so' % sanitize(payloadType) ) - # print "found plugin for %s (in %s) : %s " % (payloadType, libDir, pluginList) + # if pluginList: + # print "found plugin for %s (in %s) : %s " % (payloadType, libDir, pluginList) + # else: + # print "no plugin found for type %s" % payloadType xmlConverter = None if len(pluginList) > 0: @@ -148,7 +157,7 @@ def discover(self, payloadType): sys.path.append(dirPath) # print "going to import %s from %s" % (libName, dirPath) xmlConverter = importlib.import_module( libName.replace('.so', '') ) - # print "found : ", dir(xmlConverter) + # print "found methods: ", dir(xmlConverter) self.doCleanup = False return xmlConverter @@ -162,7 +171,8 @@ def prepPayload2xml(self, session, payload): data, plType = result info = { "mdName" : "pl2xmlComp", - 'plType' : plType, + 'plType' : plType, + 'plTypeSan' : sanitize(plType), } converter = self.discover(plType) @@ -217,7 +227,7 @@ def payload2xml(self, session, payload): result = session.query(self.conddb.Payload.data, self.conddb.Payload.object_type).filter(self.conddb.Payload.hash == payload).one() data, plType = result - convFuncName = plType+'2xml' + convFuncName = sanitize(plType)+'2xml' sys.path.append('.') func = getattr(xmlConverter, convFuncName) resultXML = func( str(data), str(plType) )