Replies: 5 comments 2 replies
-
The external (calling) environment is in Python's repo = os.environ.get("GITLAB_DOCS_REPO")
if repo is None:
print("GITLAB_DOCS_REPO is empty!")
Exit(1) There's a bit more to it, potentially. When SCons executes a command, it uses a restricted environment which does not include environment variables from the calling environment (that's a very specific policy decision), so if these variables you are checking for are needed in that context, you need to set them there. That would usually look like (sorry, some sloppy editing, I've updated this) |
Beta Was this translation helpful? Give feedback.
-
There's an FAQ about shell environment variables propagation.. |
Beta Was this translation helpful? Give feedback.
-
There's an SCons-y way to check other aspects of the build host, which you can read about at https://scons.org/doc/4.7.0/HTML/scons-user.html#chap-sconf SCons doesn´t believe in controlling the build via environment variables, so has nothing special for them. There are three main ways to pass information ¨from outside¨: command-line arguments, command-line variables, and targets. Theirs some chatter about that topic at https://scons.org/doc/4.7.0/HTML/scons-user.html#chap-command-line. The variables ( There's more (but more terse) info in the manpage. You can set up a The scons model in general is that things that control the build are stored in "Construction Variables". Using Does that help? |
Beta Was this translation helpful? Give feedback.
-
Regardless of checking if the shell which invoked SCons has those environment variables set, you'll have to explicitly propagate them to the execution environment (see FAQ link above). You could use a configure context with a custom checker to check if they are defined and then propagate them to the execution environment. |
Beta Was this translation helpful? Give feedback.
-
There's a funky example of pulling in an env var and propagating it here: https://github.com/SCons/scons/blob/master/packaging/etc/reproducible_site_init.py not sure if that's best practice, necessarily, but someone contributed that for a specific purpose. |
Beta Was this translation helpful? Give feedback.
-
When porting shell scripts to SCons, what is the best strategy to replace this
validate.sh
script that checks for build configuration in environment variables?Beta Was this translation helpful? Give feedback.
All reactions