0

I'm using SCons to build Godot with my custom module. It works, but I wanted to add some functionality there and have 'debug.py' and 'release.py' to be used as profile argument, not a single 'config.py', and I've set some variables there:

platform = "x11"
tools = "yes"
target = "debug"
bits = 64
custom_modules = "../godot_modules"
use_lto = "yes"
mylib_shared = "yes"
udev = "no"
mylib_target = "debug"

I have no problem with most, these used by the SCons itself (like platform, or tools) work as expected, but in my SCsub I'm trying to use some of them:

Import('env')

print("mylib_target = ", ARGUMENTS.get('mylib_target', 'NULL'))

It prints "mylib_target = NULL" and ARGUMENTS['mylib_target'] gives me KeyError. I've also tried env['ENV']['mylib_target'], same effect. How do I get to those?

smsware
  • 429
  • 1
  • 13
  • 41
  • 1
    Look at this answer https://stackoverflow.com/questions/40216311/reading-in-environment-variables-from-an-environment-file. Also env variables should be in SCREAMING_SNAKE_CASE – WombatPM Oct 21 '22 at 16:43
  • @WombatPM there is no answer there, it's not about taking scons line arguments provided by config.py, it's about alternatives that doesn't suit me because to know which file to open, I would need to know what file to open... – smsware Oct 23 '22 at 16:17
  • either you are setting the environmental variables from the command line (or reading/setting them in via docker) or you are reading them from a file. Would you care to provide more details of what you configuration is or provide a minimal sample the reproduces the problem? – WombatPM Oct 23 '22 at 18:29
  • @WombatPM well, I just wanted to have a debug.py and release.py (actually one extra is needed too) files with different configuration, so the SCsub file needed to know that too (because it needs to set all the linking accordingly), but I've used python-dotenv to just read the filename and set the correct .env file, then I just pull from there. :D – smsware Oct 25 '22 at 13:38

0 Answers0