diff -r 7685cec9fd3c -r f2ddfa555b0f doc/api/python/bsf-pysrc.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/api/python/bsf-pysrc.html Fri Sep 11 11:54:49 2009 +0100
@@ -0,0 +1,273 @@
+
+
+
+
+ bsf
+
+
+
+
+
+
+
+
+
+
+
+ Module bsf
+
+
+
+
+
+
+
+
+
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20 """ Helper module to read bsf files.
+ 21 """
+ 22 import dircache
+ 23 import os . path
+ 24 import re
+ 25
+
27 """ Class that parse and abstract a bsf file.
+
28 """
+
29 - def __init__ ( self , filename , bsflist ) :
+
30 self . _filename = filename
+
31 self . _is_variant = False
+
32 self . _is_virtual_variant = False
+
33 self . _customize = None
+
34 self . _compile_with_parent = False
+
35 self . _list = bsflist
+
36 self . parse ( )
+
37
+
39 """ Parse the bsf file
+
40 """
+
41 bsffile = open ( self . _filename )
+
42 for line in bsffile . readlines ( ) :
+
43
+
44 if re . match ( r"^(\s*|\s*#.*)$" , line ) != None :
+
45 continue
+
46
+
47 res = re . search ( r"^^\s*(?P<key>\w+)\s+(?P<value>\w+)\s*$" , line )
+
48 if res != None :
+
49 if res . groupdict ( ) [ 'key' ] . lower ( ) == "customizes" :
+
50 self . _customize = res . groupdict ( ) [ 'value' ]
+
51
+
52 if re . match ( r"^^\s*VARIANT\s*$" , line ) != None :
+
53 self . _is_variant = True
+
54 if re . match ( r"^^\s*VIRTUALVARIANT\s*$" , line ) != None :
+
55 self . _is_virtual_variant = True
+
56 if re . match ( r"^^\s*COMPILEWITHPARENT\s*$" , line ) != None :
+
57 self . _compile_with_parent = True
+
58
+
59
+
60 bsffile . close ( )
+
61
+
63 """ I am a variant
+
64 """
+
65 return self . _is_variant
+
66
+
68 """ I am a virtual variant
+
69 """
+
70 return self . _is_virtual_variant
+
71
+
73 """ who am I customizing?
+
74 """
+
75 return self . _customize . lower ( )
+
76
+
78 """ who am I customizing?
+
79 """
+
80 return self . _compile_with_parent
+
81
+
83 """ get my name...
+
84 """
+
85 return os . path . splitext ( ( os . path . basename ( self . _filename ) ) ) [ 0 ] . lower ( )
+
86
+
88 """ return myself plus my parents
+
89 """
+
90 result = [ self . get_name ( ) ]
+
91 parent = self . _list [ self . customize ( ) ]
+
92 while not parent . is_virtual_variant ( ) :
+
93 result . append ( parent . get_name ( ) )
+
94 parent = self . _list [ parent . customize ( ) ]
+
95 result . reverse ( )
+
96 return result
+
97
+ 99 """ return the path section
+100 """
+101 path = self . get_name ( )
+102 parent = self . _list [ self . customize ( ) ]
+103 while not parent . is_virtual_variant ( ) :
+104 path = parent . get_name ( ) + '/' + path
+105 parent = self . _list [ parent . customize ( ) ]
+106 return path
+107
+108
+110 """ Read all bsfs from a directory
+111 """
+112 result = { }
+113 for bsf in dircache . listdir ( path ) :
+114 if os . path . splitext ( bsf ) [ 1 ] == ".bsf" :
+115 bsf = BSF ( path + "/" + bsf , result )
+116 result [ bsf . get_name ( ) ] = bsf
+117 return result
+118
+
120 """ Return an array representing all include path from specific path (product) to generic (platform)
+
121 """
+
122 result = [ ]
+
123 configs = bsfs [ product ] . get_path_as_array ( )
+
124 configs . reverse ( )
+
125 for customisation in configs :
+
126 result . append ( bsfs [ customisation ] . get_path ( ) )
+
127 return result
+
128
+
+
+
+
+
+
+
+
+
+