godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

SCons v.4.8.0 - 'BoolVariable' is not defined

Open gomes042 opened this issue 1 year ago • 3 comments

Godot version

4.2.2.stable

godot-cpp version

4.2.2.stable

System information

Windows 11, Windows 10, macOS

Issue description

$ scons --version

SCons by Steven Knight et al.:
        SCons: v4.8.0.7c688f694c644b61342670ce92977bf4a396c0d4, Sun, 07 Jul 2024 16:52:07 -0700, by bdbaddog on M1Dog2021

$ scons

scons: Reading SConscript files ...
NameError: name 'BoolVariable' is not defined:
  File "C:\Documents\project\Project\SConstruct", line 52:
    env = SConscript("include/godot-cpp/SConstruct", {"env": env, "customs": customs})
  File "C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages\SCons\Script\SConscript.py", line 684:
    return method(*args, **kw)
  File "C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages\SCons\Script\SConscript.py", line 620:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages\SCons\Script\SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Documents\project\Project\include\godot-cpp\SConstruct", line 36:
    cpp_tool.options(opts, env)
  File "C:\Documents\project\Project\include\godot-cpp\tools\godotcpp.py", line 325:
    tool.options(opts)
  File "C:\Documents\project\Project\include\godot-cpp\tools\ios.py", line 24:
    opts.Add(BoolVariable("ios_simulator", "Target iOS Simulator", False))

Working with SCons v4.7.0 ✅️

pip uninstall scons && pip install scons==4.7.0

gomes042 avatar Jul 12 '24 19:07 gomes042

This is fixed by #1504 which (among many other things), did this change:

diff --git a/tools/ios.py b/tools/ios.py
index 75718684..d5767093 100644
--- a/tools/ios.py
+++ b/tools/ios.py
@@ -2,7 +2,7 @@ import os
 import sys
 import subprocess
 import common_compiler_flags
-from SCons.Variables import *
+from SCons.Variables import BoolVariable
 
 if sys.version_info < (3,):
 
diff --git a/tools/linux.py b/tools/linux.py
index 1783e060..95a5b92c 100644
--- a/tools/linux.py
+++ b/tools/linux.py
@@ -1,5 +1,5 @@
 import common_compiler_flags
-from SCons.Variables import *
+from SCons.Variables import BoolVariable
 from SCons.Tool import clang, clangxx
 
 
diff --git a/tools/windows.py b/tools/windows.py
index a263241a..d072b221 100644
--- a/tools/windows.py
+++ b/tools/windows.py
@@ -2,7 +2,7 @@ import sys
 import my_spawn
 import common_compiler_flags
 from SCons.Tool import msvc, mingw
-from SCons.Variables import *
+from SCons.Variables import BoolVariable
 
 
 def options(opts):

We might want to backport at least this change to 4.2 / 4.1 (CC @dsnopek )

Note: It's really weird that scons 4.8 broke all from SCons.Variables import * :/

Faless avatar Jul 16 '24 07:07 Faless

We might want to backport at least this change to 4.2 / 4.1

It's tagged for cherry-picking! It'll get pulled in when I do the next round

dsnopek avatar Jul 16 '24 16:07 dsnopek

It appears like SCons/scons@9b4f2eb added a __all__ list to the SCons.Variables __init__ file which is causing the issue.

From what I am gathering from the commit message this might be an intentional change.

Priton-CE avatar Jul 16 '24 21:07 Priton-CE

This should be fixed now (by PR https://github.com/godotengine/godot-cpp/pull/1504)

dsnopek avatar Jan 21 '25 17:01 dsnopek