[Scons-users] Importing Module That is a Build Product

Keith F Prussing kprussing74 at gmail.com
Fri Sep 16 09:33:48 EDT 2016


On 2016-09-15, Bill Deegan wrote:
>Can you explain what this module's function is?
>Any reason you must generate file and then run it?

In my case, the module simply defines constants.  The only reason I'm 
trying to generate the file of constants is because I need to use the 
same constants in a collection of MATLAB scripts that are also part of 
the build.  I want to use the same values in both the MATLAB generated 
figures as well as some documentation and resource file generation, and 
I find it "easier" to generate the Python syntax from the MATLAB than 
going the other way.  Honestly, I just arbitrarily chose that direction 
because Python doesn't care about the semicolon, but MATLAB gets noisy 
if I need some of the constants in an interactive session.  An 
alternative in my case would be to generate the MATLAB syntax from the 
Python.  That may actually be the safer route in the long run.  I was 
mainly surprised when SCons didn't find the generated module in the 
current directory when that is what I expected.

>Could you eval the logic (I know it's not recommended, but it's effectively
>what's being done here anyway)

I could but I have a strong aversion to eval except in tightly 
controlled conditions. ;-) I'd prefer to be explicit about where my 
constants are.

Keith

-- 
Keith F Prussing


More information about the Scons-users mailing list