Skip to content

Commit

Permalink
Merge pull request #4642 from Repiteo/remove-python-3.6
Browse files Browse the repository at this point in the history
Remove Python 3.6 support
  • Loading branch information
bdbaddog authored Nov 16, 2024
2 parents 7617dcc + 37530ad commit 9f387ef
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 56 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
a constant expression evaluation.

From Thaddeus Crews:
- Removed Python 3.6 support.
- Ruff/Mypy: Excluded items now synced.
- Ruff: Linter includes new rules - `FA`, `UP006`, `UP007`, and `UP037` - to
detect and upgrade legacy type-hint syntax.
Expand Down
2 changes: 2 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ CHANGED/ENHANCED EXISTING FUNCTIONALITY
- List modifications to existing features, where the previous behavior
wouldn't actually be considered a bug

- Removed Python 3.6 support.

- Override environments, created when giving construction environment
keyword arguments to Builder calls (or manually, through the
undocumented Override method), were modified not to "leak" on item deletion.
Expand Down
2 changes: 1 addition & 1 deletion ReleaseConfig
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ version_tuple = (4, 8, 2, 'a', 0)
# when that version is used. Python versions prior to deprecate_python_version
# cause a warning to be issued (assuming it's not disabled). These values are
# mandatory and must be present in the configuration file.
unsupported_python_version = (3, 6, 0)
unsupported_python_version = (3, 7, 0)
deprecated_python_version = (3, 7, 0)

# If release_date is (yyyy, mm, dd, hh, mm, ss), that is used as the release
Expand Down
9 changes: 0 additions & 9 deletions SCons/Action.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,15 +893,6 @@ def scons_subproc_run(scons_env, *args, **kwargs) -> subprocess.CompletedProcess
del kwargs['error']
kwargs['check'] = check

# TODO: Python version-compat stuff: remap/remove too-new args if needed
if 'text' in kwargs and sys.version_info < (3, 7):
kwargs['universal_newlines'] = kwargs.pop('text')

if 'capture_output' in kwargs and sys.version_info < (3, 7):
capture_output = kwargs.pop('capture_output')
if capture_output:
kwargs['stdout'] = kwargs['stderr'] = PIPE

# Most SCons tools/tests expect not to fail on things like missing files.
# check=True (or error="raise") means we're okay to take an exception;
# else we catch the likely exception and construct a dummy
Expand Down
32 changes: 4 additions & 28 deletions SCons/ActionTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1545,8 +1545,6 @@ def LocalFunc() -> None:

# Since the python bytecode has per version differences, we need different expected results per version
func_matches = {
(3, 5): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 6): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
Expand Down Expand Up @@ -1727,8 +1725,6 @@ def LocalFunc() -> None:
pass

func_matches = {
(3, 5): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 6): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
Expand All @@ -1740,8 +1736,6 @@ def LocalFunc() -> None:
}

meth_matches = {
(3, 5): bytearray(b'1, 1, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 6): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 7): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 8): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 9): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'),
Expand Down Expand Up @@ -1982,8 +1976,6 @@ def LocalFunc() -> None:
pass

func_matches = {
(3, 5): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),
(3, 6): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
(3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),
Expand Down Expand Up @@ -2046,8 +2038,6 @@ def LocalFunc() -> None:
pass

matches = {
(3, 5): b'd\x00\x00S',
(3, 6): b'd\x00S\x00',
(3, 7): b'd\x00S\x00',
(3, 8): b'd\x00S\x00',
(3, 9): b'd\x00S\x00',
Expand Down Expand Up @@ -2250,8 +2240,6 @@ def func1(a, b, c):
# we need different expected results per version
# Note unlike the others, this result is a tuple, use assertIn
expected = {
(3, 5): (bytearray(b'3, 3, 0, 0,(),(),(|\x00\x00S),(),()'),),
(3, 6): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),),
(3, 7): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),),
(3, 8): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),),
(3, 9): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),),
Expand Down Expand Up @@ -2279,12 +2267,6 @@ def test_object_contents(self) -> None:
# Since the python bytecode has per version differences,
# we need different expected results per version
expected = {
(3, 5): bytearray(
b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01\x00|\x00\x00_\x00\x00d\x02\x00|\x00\x00_\x01\x00d\x00\x00S),(),(),2, 2, 0, 0,(),(),(d\x00\x00S),(),()}}{{{a=a,b=b}}}"
),
(3, 6): bytearray(
b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01|\x00_\x00d\x02|\x00_\x01d\x00S\x00),(),(),2, 2, 0, 0,(),(),(d\x00S\x00),(),()}}{{{a=a,b=b}}}"
),
(3, 7): bytearray(
b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01|\x00_\x00d\x02|\x00_\x01d\x00S\x00),(),(),2, 2, 0, 0,(),(),(d\x00S\x00),(),()}}{{{a=a,b=b}}}"
),
Expand Down Expand Up @@ -2318,12 +2300,6 @@ def test_code_contents(self) -> None:

# Since the python bytecode has per version differences, we need different expected results per version
expected = {
(3, 5): bytearray(
b'0, 0, 0, 0,(Hello, World!),(print),(e\x00\x00d\x00\x00\x83\x01\x00\x01d\x01\x00S)'
),
(3, 6): bytearray(
b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'
),
(3, 7): bytearray(
b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'
),
Expand Down Expand Up @@ -2391,17 +2367,17 @@ def test_scons_subproc_run(self):
{"text": True, "check": False},
)

# 3.6:
sys.version_info = (3, 6, 2)
# 3.7:
sys.version_info = (3, 7, 2)
with self.subTest():
self.assertEqual(
scons_subproc_run(env, capture_output=True),
{"check": False, "stdout": PIPE, "stderr": PIPE},
{"capture_output": True, "check": False},
)
with self.subTest():
self.assertEqual(
scons_subproc_run(env, text=True),
{"check": False, "universal_newlines": True},
{"check": False, "text": True},
)
with self.subTest():
self.assertEqual(
Expand Down
8 changes: 1 addition & 7 deletions SCons/Script/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
from SCons import __version__ as SConsVersion

# these define the range of versions SCons supports
minimum_python_version = (3, 6, 0)
minimum_python_version = (3, 7, 0)
deprecated_python_version = (3, 7, 0)

# ordered list of SConstruct names to look for if there is no -f flag
Expand Down Expand Up @@ -1357,12 +1357,6 @@ def order(dependencies):
# various print_* settings, tree_printer list, etc.
BuildTask.options = options

is_pypy = platform.python_implementation() == 'PyPy'
# As of 3.7, python removed support for threadless platforms.
# See https://www.python.org/dev/peps/pep-0011/
is_37_or_later = sys.version_info >= (3, 7)
# python_has_threads = sysconfig.get_config_var('WITH_THREAD') or is_pypy or is_37_or_later

# As of python 3.4 threading has a dummy_threading module for use when there is no threading
# it's get_ident() will allways return -1, while real threading modules get_ident() will
# always return a positive integer
Expand Down
6 changes: 5 additions & 1 deletion doc/man/scons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ and a database of information about previous builds so
details do not have to be recalculated each run.
</para>

<para>&scons; requires &Python; 3.6 or later to run;
<para>&scons; requires &Python; 3.7 or later to run;
there should be no other dependencies or requirements,
unless the experimental Ninja tool is used (requires the ninja package).
</para>
Expand All @@ -104,6 +104,10 @@ in a future &SCons; release.
The CPython project retired 3.6 in Sept 2021:
<ulink url="https://peps.python.org/pep-0494"/>.
</para>
<para>
<emphasis>Changed in version NEXT_RELEASE:</emphasis>
support for &Python; 3.6 is removed.
</para>

<para>
You set up an &SCons; build by writing a script
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = ["setuptools"]
[project]
name = "SCons"
description = "Open Source next-generation build tool."
requires-python = ">=3.6"
requires-python = ">=3.7"
license = { text = "MIT" }
readme = { file = "README-package.rst", content-type = "text/x-rst" }
authors = [{ name = "William Deegan", email = "[email protected]" }]
Expand All @@ -16,7 +16,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand Down
2 changes: 1 addition & 1 deletion runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ def run_test(t, io_lock=None, run_async=True):
command_args = []
if debug:
command_args.extend(['-m', debug])
if args.devmode and sys.version_info >= (3, 7, 0):
if args.devmode:
command_args.append('-X dev')
command_args.append(t.path)
if args.runner and t.path in unittests:
Expand Down
4 changes: 2 additions & 2 deletions scripts/scons-configure-cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
import sys

# python compatibility check
if sys.version_info < (3, 6, 0):
if sys.version_info < (3, 7, 0):
msg = "scons: *** SCons version %s does not run under Python version %s.\n\
Python >= 3.6.0 is required.\n"
Python >= 3.7.0 is required.\n"
sys.stderr.write(msg % (__version__, sys.version.split()[0]))
sys.exit(1)

Expand Down
4 changes: 2 additions & 2 deletions scripts/scons.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
import sys

# Python compatibility check
if sys.version_info < (3, 6, 0):
if sys.version_info < (3, 7, 0):
msg = "scons: *** SCons version %s does not run under Python version %s.\n\
Python >= 3.6.0 is required.\n"
Python >= 3.7.0 is required.\n"
sys.stderr.write(msg % (__version__, sys.version.split()[0]))
sys.exit(1)

Expand Down
4 changes: 2 additions & 2 deletions scripts/sconsign.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
import sys

# python compatibility check
if sys.version_info < (3, 6, 0):
if sys.version_info < (3, 7, 0):
msg = "scons: *** SCons version %s does not run under Python version %s.\n\
Python >= 3.6.0 is required.\n"
Python >= 3.7.0 is required.\n"
sys.stderr.write(msg % (__version__, sys.version.split()[0]))
sys.exit(1)

Expand Down
2 changes: 1 addition & 1 deletion testing/framework/TestSCons.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
default_version = '4.8.2ayyyymmdd'

# TODO: these need to be hand-edited when there are changes
python_version_unsupported = (3, 6, 0)
python_version_unsupported = (3, 7, 0)
python_version_deprecated = (3, 7, 0)
python_version_supported_str = "3.7.0" # str of lowest non-deprecated Python

Expand Down

0 comments on commit 9f387ef

Please sign in to comment.