Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/scons.git#180e27377e5586f4d3e89a27fcf4830a4785e84b
This commit is contained in:
DistroBaker 2021-01-13 11:47:31 +00:00
parent ba8ae54eb9
commit b3914319f9
2 changed files with 144 additions and 1 deletions

134
scons-4.0.1-bug3860.patch Normal file
View File

@ -0,0 +1,134 @@
From d3c6a4a199beff6e4d28725da9c0b0a052349359 Mon Sep 17 00:00:00 2001
From: Mats Wichmann <mats@linux.com>
Date: Tue, 12 Jan 2021 07:48:33 -0700
Subject: [PATCH] Work around Py3.10 optimizing out a builder test
BuilderBase class traps __bool__ call and raises InternalError.
On Py 3.10a the unit test for this got optimized out, avoid this.
While we're at it, eliminate remaining references to __nonzero__,
which was a Py2-ism, replaced by __bool__.
Closes #3860
Signed-off-by: Mats Wichmann <mats@linux.com>
---
SCons/Builder.py | 5 +----
SCons/BuilderTests.py | 17 ++++++++++++-----
SCons/Environment.py | 2 +-
SCons/Node/__init__.py | 2 +-
SCons/Util.py | 7 +------
6 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/SCons/Builder.py b/SCons/Builder.py
index a0df27203..4c2ad7fad 100644
--- a/SCons/Builder.py
+++ b/SCons/Builder.py
@@ -430,11 +430,8 @@ def __init__(self, action = None,
src_builder = [ src_builder ]
self.src_builder = src_builder
- def __nonzero__(self):
- raise InternalError("Do not test for the Node.builder attribute directly; use Node.has_builder() instead")
-
def __bool__(self):
- return self.__nonzero__()
+ raise InternalError("Do not test for the Node.builder attribute directly; use Node.has_builder() instead")
def get_name(self, env):
"""Attempts to get the name of the Builder.
diff --git a/SCons/BuilderTests.py b/SCons/BuilderTests.py
index 0e46194f2..8d616f131 100644
--- a/SCons/BuilderTests.py
+++ b/SCons/BuilderTests.py
@@ -207,13 +207,14 @@ def test__init__(self):
x = builder.overrides['OVERRIDE']
assert x == 'x', x
- def test__nonzero__(self):
- """Test a builder raising an exception when __nonzero__ is called
- """
+ def test__bool__(self):
+ """Test a builder raising an exception when __bool__ is called. """
+
+ # basic test: explicitly call it
builder = SCons.Builder.Builder(action="foo")
exc_caught = None
try:
- builder.__nonzero__()
+ builder.__bool__()
except SCons.Errors.InternalError:
exc_caught = 1
assert exc_caught, "did not catch expected InternalError exception"
@@ -221,12 +222,18 @@ def test__nonzero__(self):
class Node:
pass
+ # the interesting test: checking the attribute this way
+ # should call back to Builder.__bool__ - so we can tell
+ # people not to check that way (for performance).
+ # TODO: workaround #3860: with just a "pass" in the check body,
+ # py3.10a optimizes out the whole thing, so add a "real" stmt
n = Node()
n.builder = builder
exc_caught = None
try:
if n.builder:
- pass
+ #pass
+ _ = True
except SCons.Errors.InternalError:
exc_caught = 1
assert exc_caught, "did not catch expected InternalError exception"
diff --git a/SCons/Environment.py b/SCons/Environment.py
index 0b8a20adc..61128af36 100644
--- a/SCons/Environment.py
+++ b/SCons/Environment.py
@@ -1538,7 +1538,7 @@ def Detect(self, progs):
def Dictionary(self, *args):
- """Return construction variables from an environment.
+ r"""Return construction variables from an environment.
Args:
\*args (optional): variable names to look up
diff --git a/SCons/Node/__init__.py b/SCons/Node/__init__.py
index 3685af300..491c6b8c5 100644
--- a/SCons/Node/__init__.py
+++ b/SCons/Node/__init__.py
@@ -886,7 +886,7 @@ def has_builder(self):
than simply examining the builder attribute directly ("if
node.builder: ..."). When the builder attribute is examined
directly, it ends up calling __getattr__ for both the __len__
- and __nonzero__ attributes on instances of our Builder Proxy
+ and __bool__ attributes on instances of our Builder Proxy
class(es), generating a bazillion extra calls and slowing
things down immensely.
"""
diff --git a/SCons/Util.py b/SCons/Util.py
index fae2d64fe..0f26fb134 100644
--- a/SCons/Util.py
+++ b/SCons/Util.py
@@ -125,11 +125,8 @@ class NodeList(UserList):
# self.data = [ initlist,]
- def __nonzero__(self):
- return len(self.data) != 0
-
def __bool__(self):
- return self.__nonzero__()
+ return len(self.data) != 0
def __str__(self):
return ' '.join(map(str, self.data))
@@ -1563,8 +1560,6 @@ def __call__(self, *args, **kwargs):
return self
def __repr__(self):
return "Null(0x%08X)" % id(self)
- def __nonzero__(self):
- return False
def __bool__(self):
return False
def __getattr__(self, name):

View File

@ -14,7 +14,7 @@
Name: scons
Version: 4.0.1
Release: 3%{?dist}
Release: 4%{?dist}
Summary: An Open Source software construction tool
License: MIT
URL: http://www.scons.org
@ -22,6 +22,8 @@ Source0: https://github.com/SCons/scons/archive/%{version}/scons-%{version}.ta
Source1: https://scons.org/doc/production/scons-doc-%{version}.tar.gz
BuildArch: noarch
Patch0: %{name}-%{version}-bug3860.patch
%description
SCons is an Open Source software construction tool--that is, a build
tool; an improved substitute for the classic Make utility; a better way
@ -119,6 +121,10 @@ cd ..
cd ..
%endif
pushd %{name}-%{version}
%autopatch -p1
popd
# Convert to UTF-8
for file in %{name}-%{version}/src/*.txt; do
iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \
@ -241,6 +247,9 @@ popd
%license LICENSE*
%changelog
* Wed Jan 13 2021 Antonio Trande <sagitter@fedoraproject.org> - 4.0.1-4
- Patched for Python-310 (rhbz#1914318)
* Mon Oct 05 2020 Antonio Trande <sagitter@fedoraproject.org> - 4.0.1-3
- BuildRequires python3-setuptools explicitly