Created
February 23, 2018 20:01
-
-
Save bdbaddog/1ddedecdfd13f6193c173e511e895b1f to your computer and use it in GitHub Desktop.
How to add to SConscript namespace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env=Environment() | |
SConscript('src/SConscript',exports='env') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SCons.Script | |
def my_stuff(): | |
print("BLAH") | |
SCons.Script.my_stuff = my_stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import('env') | |
my_stuff() | |
I wonder if:
import SCons.Script
import parts
parts.setup_stuff(SCons.Script)
Would do what you want.. Then you'd add all the symbols you want available as attributes to the passed object.
Yes that would work, but the user will have little control in being able to selection parts being added or not add to there build when using SCons. The suggestion I made means the user can add it or remove it at the point the Sconstruct is read in.
Ideally having a SCons extension API to allow control over what extensions get loaded or not would probably be better
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
right...
I was thinking that I would have a functions like:
site_scons site_init.py ( in a system directory)
The only problem with this is that the logic in SCons, if I read it correctly, will load the first site_init.py. So the code would break if the user added there own site_init.py in the directory with the Sconstruct.