vyom vyom - 1 month ago 4x
Bash Question

Reading environment/shell variables

I see that

has reads some shell variables and saves it, in its environment
(https://code.google.com/p/waf/wiki/EnvironmentVariables). But from the Waf Book,
I am unable to find, as to how I can add some other variable, of my interest
to be read at
time. Do I have to just use Python's
library and read
or does
have any other mechanisms to do so ?



Yes that is the advantage of waf it is in Python so you can get the data from anywhere so you can read using Python libraries.

However waf has done the work for you form the ApiDocs there is the add_os_flags on a Configure object which reads an OS environment variables into the env dictionary in a Configure object


def configure(conf):

I would note that it might be better to have the data in the build and not in external variables and use command line options to the process. The reason for this is to allow the project to be easily moved to another environment and it will work without having to set extra things that might be forgotten. IN other words keep the configuration together in one place and not spread over several places.