SCons: How do I import a Python module into SConscript that was called with VariantDir?
My assembly is structured like this:
SConstruct
subdir/SConscript
subdir/module/__init__.py
SConstruct
calls subdir/SConscript
as a child:
# SConstruct
SConscript('subdir/SConscript')
subdir/SConscript
import module
:
# subdir/SConscript
from module import foo
do SConsy stuff with foo()...
This works great until I use it variant_dir
with subdir/SConscript
:
# SConstruct
SConscript('subdir/SConscript', variant_dir='subdir/build', duplicate=0)
The problem is what import
is failing because it is module
no longer in the path that was changed to variant_dir
.
Is there a standard way to solve this problem in SCons or Python? I am aware of a special directory site_scons
, but it seems that this directory must exist at the top level with the root SConstruct
and I would like to store the subdir
-special files in subdir
.
source to share