Skip to content

Instantly share code, notes, and snippets.

@bdbaddog
Created February 23, 2018 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdbaddog/1ddedecdfd13f6193c173e511e895b1f to your computer and use it in GitHub Desktop.
Save bdbaddog/1ddedecdfd13f6193c173e511e895b1f to your computer and use it in GitHub Desktop.
How to add to SConscript namespace
env=Environment()
SConscript('src/SConscript',exports='env')
import SCons.Script
def my_stuff():
print("BLAH")
SCons.Script.my_stuff = my_stuff
Import('env')
my_stuff()
@bdbaddog
Copy link
Author

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.

@dragon512
Copy link

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