Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Python 3.6 support #4642

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

From Alex James:
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)
Repiteo marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -891,15 +891,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 @@ -1541,8 +1541,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 @@ -1723,8 +1721,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 @@ -1736,8 +1732,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 @@ -1978,8 +1972,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 @@ -2042,8 +2034,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 @@ -2246,8 +2236,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 @@ -2275,12 +2263,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 @@ -2314,12 +2296,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 @@ -2387,17 +2363,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 @@ -66,7 +66,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 @@ -1356,12 +1356,6 @@ def order(dependencies):
# various print_* settings, tree_printer list, etc.
BuildTask.options = options

is_pypy = platform.python_implementation() == 'PyPy'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you removing is_pypy ?

Copy link
Contributor Author

@Repiteo Repiteo Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It and is_37_or_later were only used in the commented-out python_has_threads variable. I could just leave it be, but I was already removing the redundant is_37_or_later which would otherwise just be an unreferenced variable always returning True, so removing that whole vestigial block felt more appropriate

# 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 @@ -784,7 +784,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 @@ -59,7 +59,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
Loading