Re: ANN: 0.2.4 pre-release

Francesco Montorsi <[email protected]> Mon, 22 Sep 2008 16:58:18 +0200
Newsgroups gmane.comp.sysutils.bakefile.devel
Message-ID <[email protected]>
Hi,
Vaclav Slavik ha scritto:
> Do you have some local changes by a chance?
> If not, is anything
> suspicious in the output with -V flag (e.g. picking files from installed
> bakefile version instead of the SVN tree)?
I've found the root of the problem; msvs2008prj.bkl was not being installed in 
/usr/local/share/bakefile/rules because I forgot to rerun "./configure"; the 
result was that msvs2008prj.bkl was not loaded and bakefile wasn't aware of 
<lib> targets.

I think the fact no warnings/errors about the missing .bkl were shown means that 
a safer loadModule() is required ;)

Attached is a raw first-version of such safer loadModule(); it may require 
various fixes as I'm not sure about the

     # include module-specific makefiles:
     global availableFiles
     for f in availableFiles:
         if m in f.modules:
             f.modules.remove(m)
             if len(f.modules) == 0:
                 processFile(f.file)
                 imported = True
     availableFiles = [f for f in availableFiles if len(f.modules)>0]

part.

Francesco

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
Bakefile-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bakefile-devel
safer_loadmodule.patch (text/x-diff, 1.7 KB)
Index: src/reader.py
===================================================================
--- src/reader.py	(revisione 1257)
+++ src/reader.py	(copia locale)
@@ -910,7 +910,7 @@
     mk.setVar('USING_%s' % m.upper(), '1')

     # import module's py utilities:
-    mk.importPyModule(m)
+    imported = mk.importPyModule(m)

     # include module-specific makefiles:
     global availableFiles
@@ -919,8 +919,11 @@
             f.modules.remove(m)
             if len(f.modules) == 0:
                 processFile(f.file)
+                imported = True
     availableFiles = [f for f in availableFiles if len(f.modules)>0]

+    if not imported:
+        raise RuntimeError("can't find module '%s'" % m)

 def handleUsing(e):
     modules = e.props['module'].split(',')
Index: src/mk.py
===================================================================
--- src/mk.py	(revisione 1257)
+++ src/mk.py	(copia locale)
@@ -563,12 +563,16 @@
             return

 def importPyModule(modname):
+
+    imported = False
+
     try:
         exec('import utils.%s' % modname, globals())
         if config.verbose:
             print 'imported python module utils.%s' % modname
         if config.track_deps:
             __recordDeps('utils/%s' % modname)
+        imported = True
     except ImportError: pass

     try:
@@ -577,6 +581,7 @@
             print 'imported python module %s' % modname
         if config.track_deps:
             __recordDeps(modname)
+        imported = True
     except ImportError: pass
     if config.debug:
         print '[dbg] --- after importing module %s --' % modname
@@ -585,3 +590,5 @@
             print '[dbg] sys.modules[%s]=%s' % (modname,sys.modules[modname])
         else:
             print '[dbg] module not loaded!'
+
+    return imported