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 29 of file project_manifest.py.

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

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

Variable Documentation

string project_manifest.help = 'output filename'

Definition at line 83 of file project_manifest.py.

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

Definition at line 98 of file project_manifest.py.

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

Definition at line 81 of file project_manifest.py.

list project_manifest.project_args = []

Definition at line 97 of file project_manifest.py.