forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix to CondXmlProcessor.discover for read-only patch-release areas
- Loading branch information
Showing
1 changed file
with
27 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,41 +76,45 @@ def __del__(self): | |
return | ||
|
||
def discover(self, payloadType): | ||
|
||
libName = 'pluginUtilities_payload2xml.so' | ||
# first search: developer area or main release | ||
libDir = os.path.join( os.environ["CMSSW_BASE"], 'lib', os.environ["SCRAM_ARCH"] ) | ||
devLibDir = libDir | ||
libPath = os.path.join( devLibDir, libName ) | ||
releaseBase = os.environ["CMSSW_RELEASE_BASE"] | ||
devCheckout = (releaseBase != '') | ||
if not devCheckout: | ||
|
||
isReadOnlyRel = (os.environ['CMSSW_RELEASE_BASE'] != '') | ||
if not isReadOnlyRel: | ||
logging.debug('Looks like the current working environment is a read-only release') | ||
if not os.path.exists( libPath ) and devCheckout: | ||
# main release ( for dev checkouts ) | ||
libDir = os.path.join( releaseBase, 'lib', os.environ["SCRAM_ARCH"] ) | ||
|
||
# first search CMSSW_BASE (developer area), then CMSSW_RELEASE_BASE (release base), | ||
# and finally CMSSW_FULL_RELEASE_BASE (full release base, defined only for patch releases) | ||
foundLib = False | ||
for cmsswBase in ['CMSSW_BASE', 'CMSSW_RELEASE_BASE', 'CMSSW_FULL_RELEASE_BASE']: | ||
if not (cmsswBase in os.environ and os.environ[cmsswBase] != ''): | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
missirol
Author
Owner
|
||
continue | ||
libDir = os.path.join( os.environ[cmsswBase], 'lib', os.environ['SCRAM_ARCH'] ) | ||
libPath = os.path.join( libDir, libName ) | ||
if not os.path.exists( libPath ): | ||
if "CMSSW_FULL_RELEASE_BASE" in os.environ: | ||
libDir = os.path.join( os.environ["CMSSW_FULL_RELEASE_BASE"], 'lib', os.environ["SCRAM_ARCH"] ) | ||
libPath = os.path.join( libDir, libName ) | ||
if not os.path.exists( libPath ): | ||
# it should never happen! | ||
raise Exception('No built-in library %s found with XML converters.' %libPath) | ||
logging.debug("Importing built-in library %s" %libPath) | ||
if cmsswBase == 'CMSSW_BASE': | ||
devLibDir = libDir | ||
foundLib = os.path.isfile( libPath ) | ||
if foundLib: | ||
logging.debug('Found built-in library with XML converters: %s' %libPath) | ||
break | ||
|
||
if not foundLib: | ||
# this should never happen !! | ||
raise Exception('No built-in library found with XML converters (library name: %s).' %libName) | ||
|
||
logging.debug('Importing built-in library %s' %libPath) | ||
module = importlib.import_module( libName.replace('.so', '') ) | ||
functors = dir(module) | ||
funcName = payloadType+'2xml' | ||
if funcName in functors: | ||
logging.info('XML converter for payload class %s found in the built-in library.' %payloadType) | ||
return getattr( module, funcName) | ||
if not devCheckout: | ||
# give-up if it is a read-only release... | ||
raise Exception('No XML converter suitable for payload class %s has been found in the built-in library.') | ||
if not isReadOnlyRel: | ||
# give up if it is a read-only release... | ||
raise Exception('No XML converter suitable for payload class %s has been found in the built-in library.' %payloadType) | ||
libName = 'plugin%s.so' %localLibName( payloadType ) | ||
libPath = os.path.join( devLibDir, libName ) | ||
if os.path.exists( libPath ): | ||
logging.info('Found local library with XML converter for class %s' %payloadType ) | ||
logging.info('Found local library with XML converter for class %s' %payloadType) | ||
module = importlib.import_module( libName.replace('.so', '') ) | ||
return getattr( module, funcName) | ||
logging.warning('No XML converter for payload class %s found in the built-in library.' %payloadType) | ||
|
is this check really needed?
In the cases I tested (sourcing from patch/full release, both from cvmfs and using local
cmsrel
),'CMSSW_BASE'
is always defined....maybe I'm missing some cases?