The Gaudi Framework  v29r0 (ff2e7097)
__init__.py
Go to the documentation of this file.
1 import os
2 
3 
4 def ROOT6WorkAroundEnabled(id=None):
5  '''
6  Helper function to easily exclude ROOT6 work-arounds for testing.
7 
8  >>> os.environ['ROOT6_WORK_AROUND'] = 'all'
9  >>> ROOT6WorkAroundEnabled()
10  True
11  >>> os.environ['ROOT6_WORK_AROUND'] = 'none'
12  >>> ROOT6WorkAroundEnabled('JIRA-XYZ')
13  False
14  >>> os.environ['ROOT6_WORK_AROUND'] = 'JIRA-X'
15  >>> ROOT6WorkAroundEnabled('JIRA-X')
16  True
17  >>> ROOT6WorkAroundEnabled('JIRA-Y')
18  True
19  >>> os.environ['ROOT6_WORK_AROUND'] = 'JIRA-X,-JIRA-Y'
20  >>> ROOT6WorkAroundEnabled('JIRA-X')
21  True
22  >>> ROOT6WorkAroundEnabled('JIRA-Y')
23  False
24  >>> os.environ['ROOT6_WORK_AROUND'] = '-JIRA-Y'
25  >>> ROOT6WorkAroundEnabled('JIRA-X')
26  True
27  >>> ROOT6WorkAroundEnabled('JIRA-Y')
28  False
29  '''
30  enabled = os.environ.get('ROOT6_WORK_AROUND', 'all').lower()
31  if enabled == 'all':
32  return True
33  if enabled in ('none', 'no', 'off', 'false', '0'):
34  return False
35  if id is None: # unnamed work-arounds can only be disabled globally
36  return True
37  enabled = set(map(str.strip, enabled.split(',')))
38  disabled = set([e[1:] for e in enabled if e.startswith('-')])
39  id = id.lower()
40  # the w-a is enabled if in the enabled list or not explicitly disabled
41  return id in enabled or id not in disabled
def ROOT6WorkAroundEnabled(id=None)
Definition: __init__.py:4
struct GAUDI_API map
Parametrisation class for map-like implementation.