1
0
Эх сурвалжийг харах

building.py: add RegisterPreBuildingAction

One could register a callable object(normally a function) via RegisterPreBuildingAction in SConscript. It will be called when PreBuilding get invoked. PreBuilding should be called before the building procedure. It is currently used by RTGUI to generate the minimal perfect hash code when all the source files are scanned(i.e. just before building).

Maybe we should invoke PreBuilding in DoBuilding.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2353 bbd45198-f89e-11dd-88c7-29a3b14d5316
chaos.proton@gmail.com 12 жил өмнө
parent
commit
66c5a05e62
1 өөрчлөгдсөн 11 нэмэгдсэн , 0 устгасан
  1. 11 0
      tools/building.py

+ 11 - 0
tools/building.py

@@ -247,6 +247,17 @@ def GetCurrentDir():
     path = os.path.dirname(fn.abspath)
     path = os.path.dirname(fn.abspath)
     return path
     return path
 
 
+PREBUILDING = []
+def RegisterPreBuildingAction(act):
+    global PREBUILDING
+    assert callable(act), 'Could only register callable objects. %s received' % repr(act)
+    PREBUILDING.append(act)
+
+def PreBuilding():
+    global PREBUILDING
+    for a in PREBUILDING:
+        a()
+
 def DoBuilding(target, objects):
 def DoBuilding(target, objects):
     program = None
     program = None
     # check whether special buildlib option
     # check whether special buildlib option