All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
project_manifest Namespace Reference

Functions

def indent
 
def CMakeParseArguments
 

Variables

tuple parser = OptionParser(usage='%prog [options] <cmake_lists> <lcg_version> <platform>')
 
string help = 'output filename'
 
list project_args = []
 
tuple m = re.search(r'gaudi_project\s*\(([^)]*)\)
 

Function Documentation

def project_manifest.CMakeParseArguments (   args,
  options = None,
  single_value = None,
  multi_value = None 
)
Parse a list or strings using the logic of the CMake function
CMAKE_PARSE_ARGUMENTS.

>>> res = CMakeParseArguments(['USE', 'Gaudi', 'v25r0', 'DATA', 'Det/SQLDDDB'],
... multi_value=['USE', 'DATA'])
>>> res['USE']
['Gaudi', 'v25r0']
>>> res['DATA']
['Det/SQLDDDB']
>>> res['UNPARSED']
[]
>>> res = CMakeParseArguments('a b OPTION1 c FLAG1 d OPTION2 e f'.split(),
... options=['FLAG1', 'FLAG2'],
... single_value=['OPTION1', 'OPTION2'])
>>> res['FLAG1']
True
>>> res['FLAG2']
False
>>> res['OPTION1']
'c'
>>> res['OPTION2']
'e'
>>> res['UNPARSED']
['a', 'b', 'd', 'f']

Definition at line 31 of file project_manifest.py.

31 
32 def CMakeParseArguments(args, options=None, single_value=None, multi_value=None):
33  '''
34  Parse a list or strings using the logic of the CMake function
35  CMAKE_PARSE_ARGUMENTS.
36 
37  >>> res = CMakeParseArguments(['USE', 'Gaudi', 'v25r0', 'DATA', 'Det/SQLDDDB'],
38  ... multi_value=['USE', 'DATA'])
39  >>> res['USE']
40  ['Gaudi', 'v25r0']
41  >>> res['DATA']
42  ['Det/SQLDDDB']
43  >>> res['UNPARSED']
44  []
45  >>> res = CMakeParseArguments('a b OPTION1 c FLAG1 d OPTION2 e f'.split(),
46  ... options=['FLAG1', 'FLAG2'],
47  ... single_value=['OPTION1', 'OPTION2'])
48  >>> res['FLAG1']
49  True
50  >>> res['FLAG2']
51  False
52  >>> res['OPTION1']
53  'c'
54  >>> res['OPTION2']
55  'e'
56  >>> res['UNPARSED']
57  ['a', 'b', 'd', 'f']
58  '''
59  args = list(args)
60  options = set(options or [])
61  single_value = set(single_value or [])
62  multi_value = set(multi_value or [])
63  all_keywords = options.union(single_value).union(multi_value)
64  result = {'UNPARSED': []}
65  result.update((k, False) for k in options)
66  result.update((k, None) for k in single_value)
67  result.update((k, []) for k in multi_value)
68 
69  while args:
70  arg = args.pop(0)
71  if arg in options:
72  result[arg] = True
73  elif arg in single_value:
74  result[arg] = args.pop(0)
75  elif arg in multi_value:
76  while args and args[0] not in all_keywords:
77  result[arg].append(args.pop(0))
78  else:
79  result['UNPARSED'].append(arg)
80  return result
def project_manifest.indent (   elem,
  level = 0 
)
Add spaces and newlines to elements to allow pretty-printing of XML.

http://effbot.org/zone/element-lib.htm#prettyprint

Definition at line 11 of file project_manifest.py.

11 
12 def indent(elem, level=0):
13  '''
14  Add spaces and newlines to elements to allow pretty-printing of XML.
15 
16  http://effbot.org/zone/element-lib.htm#prettyprint
17  '''
18  i = "\n" + level*" "
19  if len(elem):
20  if not elem.text or not elem.text.strip():
21  elem.text = i + " "
22  if not elem.tail or not elem.tail.strip():
23  elem.tail = i
24  for elem in elem:
25  indent(elem, level+1)
26  if not elem.tail or not elem.tail.strip():
27  elem.tail = i
28  else:
29  if level and (not elem.tail or not elem.tail.strip()):
30  elem.tail = i

Variable Documentation

string project_manifest.help = 'output filename'

Definition at line 85 of file project_manifest.py.

tuple project_manifest.m = re.search(r'gaudi_project\s*\(([^)]*)\)

Definition at line 102 of file project_manifest.py.

tuple project_manifest.parser = OptionParser(usage='%prog [options] <cmake_lists> <lcg_version> <platform>')

Definition at line 83 of file project_manifest.py.

list project_manifest.project_args = []

Definition at line 101 of file project_manifest.py.