diff --git a/Control/AthenaCommon/python/AppMgr.py b/Control/AthenaCommon/python/AppMgr.py index 167b2cf4ffa05c828a35d77899844a533ec3cac7..420e9e9562e9e4e447bfac4df83910d522295433 100755 --- a/Control/AthenaCommon/python/AppMgr.py +++ b/Control/AthenaCommon/python/AppMgr.py @@ -38,11 +38,6 @@ def release_metadata(): """ import ConfigParser import os - release_data = None - for d in os.environ['LD_LIBRARY_PATH'].split(os.pathsep): - release_data = os.path.join(d, '..', 'ReleaseData') - if os.path.exists(release_data): - break d = { 'project name': '?', 'release': '?', @@ -52,14 +47,22 @@ def release_metadata(): 'date': '?', 'platform': os.getenv('CMTCONFIG', '?'), } - if release_data: - cfg = ConfigParser.SafeConfigParser() - try: - cfg.read( release_data ) - if cfg.has_section( 'release_metadata' ): - d.update( dict( cfg.items( 'release_metadata' ) ) ) - except Exception: - pass + + for ld_path in os.environ['LD_LIBRARY_PATH'].split(os.pathsep): + release_data = os.path.join(ld_path, '..', 'ReleaseData') + if os.path.exists(release_data): + d1=d + cfg = ConfigParser.SafeConfigParser() + try: + cfg.read( release_data ) + if cfg.has_section( 'release_metadata' ): + d1.update( dict( cfg.items( 'release_metadata' ) ) ) + release = d1['release'].split('.') + base_release = d1['base release'].split('.') + if len(release)>=3 or len(base_release)>=3: + return d1 + except Exception: + pass return d ### associator for public tools ---------------------------------------------- diff --git a/Control/AthenaCommon/python/ConfigurationShelve.py b/Control/AthenaCommon/python/ConfigurationShelve.py index 6637bf1845942698de045510105741b7bf035995..751819a4058bb8878036a79b5137d8e38174b998 100644 --- a/Control/AthenaCommon/python/ConfigurationShelve.py +++ b/Control/AthenaCommon/python/ConfigurationShelve.py @@ -308,7 +308,10 @@ def loadJobOptionsCatalogue( cfg_fname ): import GaudiPython.Bindings as gaudi for client in jocat: for n,v in jocat[ client ].iteritems(): - p = gaudi.StringProperty( n, v ) + # In Gaudi v28, the second argument of the ctor is passed by move, + # which pyroot doesn't handle correctly. Do this as a workaround. + p = gaudi.StringProperty( n, '' ) + p.fromString(v).ignore() if not josvc.addPropertyToCatalogue( client, p ).isSuccess(): raise RuntimeError( 'could not add property [%s.%s = %s]' % (client, n, v) ) @@ -317,7 +320,9 @@ def loadJobOptionsCatalogue( cfg_fname ): for client in jocfg: svc = PyAthena.py_svc( client, createIf = False, iface='IProperty' ) for n,v in jocfg[ client ].iteritems(): - p = gaudi.StringProperty( n, v ) + # See comment above. + p = gaudi.StringProperty( n, '' ) + p.fromString(v).ignore() svc.setProperty( p ) # pycomps hack-around diff --git a/Control/AthenaCommon/python/JobProperties.py b/Control/AthenaCommon/python/JobProperties.py index e82630d66f7f131f8b53a22ccbea29c82e114df4..ddda7f7aadb8151b0fbff566c40cfa436e95c97b 100755 --- a/Control/AthenaCommon/python/JobProperties.py +++ b/Control/AthenaCommon/python/JobProperties.py @@ -476,10 +476,16 @@ class JobPropertyContainer (object): elif(self.__dict__.__contains__(name)): pass else: - raise AttributeError( - "JobPropertyContainer:: %s does not have property %s" % - (self._context_name, name) - ) + errString="JobPropertyContainer:: %s does not have property %s" % (self._context_name, name) + try: + from difflib import get_close_matches + closestMatch=get_close_matches(name,self.__dict__.keys(),1) + if len(closestMatch)>0: + errString+=". Did you mean \'%s\'?" % closestMatch[0] + except: + pass #No execption from here + + raise AttributeError(errString) try: protected=hasattr(self.__dict__[name],'_context_name') except: @@ -490,12 +496,8 @@ class JobPropertyContainer (object): property_obj=self.__dict__.get(name) property_obj.StoredValue=n_value property_obj.statusOn=True - # NOT - #def __getattribute__(self,name): - # obj_JobProperty=object.__getattribute__(self,name) - # if isinstance(obj_JobProperty,JobProperty): - # return obj_JobProperty.__getattribute__('StoredValue') - # return obj_JobProperty + + def __str__(self): if self._context_name.count('.')==0: @@ -736,6 +738,20 @@ class JobPropertyContainer (object): else: raise ValueError('The received data is has not the expected' 'type/format') + + def __getattribute__(self,name): + try: + return object.__getattribute__(self, name) + except AttributeError: + + errString="JobPropertyContainer:: %s does not have property %s" % (object.__getattribute__(self,'_context_name'), name) + allattrs=object.__getattribute__(self,'__dict__').keys() + from difflib import get_close_matches + closestMatch=get_close_matches(name,allattrs,1) + if len(closestMatch)>0: + errString+=". Did you mean \'%s\'?" % closestMatch[0] + raise AttributeError(errString) + pass #=======================================================================