Skip to content

Commit 666f119

Browse files
committed
Restore usage of "from SCons.Variables import *`
This (unadvertised) import turns out to have real-world usage, and there's no real reason to prohibit it, although we do suggest using `from SCons.Script import *` as a more complete version. SCons 4.8.0 introduced an `__all__` in the variables module; add the five variables types to this so the listed import will work as expected. Signed-off-by: Mats Wichmann <mats@linux.com>
1 parent 9736620 commit 666f119

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
2929
- Add a timeout to test/ninja/default_targets.py - it's gotten stuck on
3030
the GitHub Windows action and taken the run to the full six hour timeout.
3131
Usually runs in a few second, so set the timeout to 3min (120).
32+
- SCons 4.8.0 added an `__all__` specifier at the top of the Variables
33+
module (`Variables/__init__.py`) to control what is made available in
34+
a star import. However, there was existing usage of doing
35+
`from SCons.Variables import *` which expected the variable *types*
36+
to be avaiable. While we never advertised this usage, there's no
37+
real reason it shouldn't keep working - add to `__all__`.
3238

3339

3440
RELEASE 4.8.0 - Sun, 07 Jul 2024 17:22:20 -0700

RELEASE.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ CHANGED/ENHANCED EXISTING FUNCTIONALITY
3939
FIXES
4040
-----
4141

42-
- List fixes of outright bugs
42+
- SCons 4.8.0 added an `__all__` specifier at the top of the Variables
43+
module (`Variables/__init__.py`) to control what is made available in
44+
a star import. However, there was existing usage of doing
45+
`from SCons.Variables import *` which expected the variable *types*
46+
to be avaiable. `BoolVariable`, `EnumVariable`, `ListVariable`,
47+
`PackageVariable` and `PathVariable` are added to `__all__`,
48+
so this form of import should now work again.
4349

4450
IMPROVEMENTS
4551
------------

SCons/Variables/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
__all__ = [
4444
"Variable",
4545
"Variables",
46+
"BoolVariable",
47+
"EnumVariable",
48+
"ListVariable",
49+
"PackageVariable",
50+
"PathVariable",
4651
]
4752

4853
class Variable:

0 commit comments

Comments
 (0)