We use SCons and Git submodules to organize and build a software stack. We have several application developers who use our stack to build their applications on top of it. In order to minimize the friction from using our stack, what is the neatest way of using SCons to check if the submodules are initialized and up-to date and subsequently recursively update them?
The aim is to have the scons
command do all the work.
My current current approach is:
from subprocess import call
call(["git", "submodule", "update", "--init", "--recursive"])
The relevant parts that are required to perform a recursive update on all submodules. This is useful for simplifying the default use-case, clone the repository and run scons
from subprocess import call
AddOption(
'--git',
type = 'string',
nargs = 1,
action = 'store',
help = 'use --git=no-sub-update to disable the submodule update')
## Update the git submodules
---------------------------------------------------
if GetOption('git') != 'no-sub-update':
call(["git", "submodule", "update", "--init", "--recursive"])