Skip to content

Commit 0d4249a

Browse files
committed
Remove Python 3.8 and 3.9 (#1039)
1 parent 7eb7ac2 commit 0d4249a

File tree

21 files changed

+58
-110
lines changed

21 files changed

+58
-110
lines changed

.github/actions/setup-python/action.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Setup Python
22
description:
33

4+
# The available Python versions on each runner are listed at
5+
# https://github.com/actions/python-versions/blob/main/versions-manifest.json.
46
runs:
57
using: composite
68
steps:
@@ -26,13 +28,9 @@ runs:
2628
- uses: actions/[email protected]
2729
with:
2830
# This should include all major.minor versions supported by the runtime, plus
29-
# OLD_PYTHON_VERSION from test_gradle_plugin. The available versions on each
30-
# runner are listed at
31-
# https://github.com/actions/python-versions/blob/main/versions-manifest.json.
31+
# OLD_PYTHON_VERSION from test_gradle_plugin.
3232
python-version: |
3333
3.7
34-
3.8
35-
3.9
3634
${{ steps.python-default.outputs.full-version }}
3735
3.11
3836
3.12

product/buildSrc/src/main/java/com/chaquo/python/internal/Common.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public class Common {
1818
public static final Map<String, String> PYTHON_VERSIONS = new LinkedHashMap<>();
1919
static {
2020
// Version, build number
21-
PYTHON_VERSIONS.put("3.8.20", "1");
22-
PYTHON_VERSIONS.put("3.9.20", "1");
2321
PYTHON_VERSIONS.put("3.10.15", "1");
2422
PYTHON_VERSIONS.put("3.11.10", "1");
2523
PYTHON_VERSIONS.put("3.12.7", "1");

product/gradle-plugin/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ Tests (this list is referenced from target/README.md):
113113
* Increment Chaquopy major version if not already done.
114114
* Update any references in the integration tests, including the names of the pythonX.Y
115115
scripts in data/BuildPython.
116-
* Search source code for `(python( version)?|version_info) *[<>=]* *[0-9]` to see if any
117-
workarounds can now be removed.
116+
* Search repository to see if any code can now be simplified. Useful regex:
117+
* `(python( version)?|version_info) *[<>=]* *\(?\d[,.] *\d`
118118
* Check if any modules can be removed from `BOOTSTRAP_NATIVE_STDLIB` in PythonTasks.kt.
119119
* Update and test all the things listed in the "Adding a Python version" section.
120120

product/gradle-plugin/src/main/kotlin/PythonTasks.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ internal class TaskBuilder(
397397
"_ctypes.*", // java.primitive and importer
398398
"_datetime.*", // calendar < importer (see test_datetime)
399399
"_lzma.*", // zipfile < importer
400-
"_random.*", // random < tempfile < zipimport
401-
"_sha512.*", // random < tempfile < zipimport
400+
"_random.*", // random < tempfile < importer
401+
"_sha512.*", // random < tempfile < importer
402402
"_struct.*", // zipfile < importer
403403
"binascii.*", // zipfile < importer
404404
"math.*", // datetime < calendar < importer

product/gradle-plugin/src/main/python/chaquopy/pyc.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the CPython source code in Include/internal/pycore_magic_number.h or
1414
# Lib/importlib/_bootstrap_external.py.
1515
MAGIC = {
16-
"3.8": 3413,
17-
"3.9": 3425,
1816
"3.10": 3439,
1917
"3.11": 3495,
2018
"3.12": 3531,

product/gradle-plugin/src/main/python/chaquopy/static_proxy.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ def process(self):
165165
# to its fully-qualified name if it's a usable import, or otherwise to the node which
166166
# bound it so we can give a useful error if the name is passed to one of our functions.
167167
for node in root.body:
168-
if isinstance(node, (ast.FunctionDef if sys.version_info < (3, 5)
169-
else (ast.FunctionDef, ast.AsyncFunctionDef))):
168+
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
170169
self.bindings[node.name] = node
171170
elif isinstance(node, ast.ClassDef):
172171
c = self.process_class(node)
@@ -179,8 +178,7 @@ def process(self):
179178
elif isinstance(node, ast.Assign):
180179
for t in node.targets:
181180
self.process_assign(t)
182-
elif isinstance(node, (ast.AugAssign if sys.version_info < (3, 6)
183-
else (ast.AugAssign, ast.AnnAssign))):
181+
elif isinstance(node, (ast.AugAssign, ast.AnnAssign)):
184182
self.process_assign(node.target)
185183
elif isinstance(node, ast.Import):
186184
self.process_import(node.names, lambda name: name)
@@ -274,16 +272,10 @@ def call(self, function, call, **kwargs):
274272
return result
275273

276274
def has_starargs(self, call):
277-
if sys.version_info < (3, 5):
278-
return bool(call.starargs)
279-
else:
280-
return any(isinstance(a, ast.Starred) for a in call.args)
275+
return any(isinstance(a, ast.Starred) for a in call.args)
281276

282277
def has_kwargs(self, call):
283-
if sys.version_info < (3, 5):
284-
return bool(call.kwargs)
285-
else:
286-
return any(kw.arg is None for kw in call.keywords)
278+
return any(kw.arg is None for kw in call.keywords)
287279

288280
def evaluate(self, expr):
289281
if isinstance(expr, ast.Constant):

product/gradle-plugin/src/test/integration/data/PythonReqs/sdist_native_cc/app/sdist_native/setup.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
import os
88
import subprocess
99
compiler = os.environ.get("CC", "gcc")
10-
try:
11-
subprocess.check_call([compiler])
12-
except OSError:
13-
# Exception string doesn't contain the filename on Python 2.7.
14-
print("Failed to run " + compiler)
15-
raise
10+
subprocess.check_call([compiler])
1611

1712
setup(
1813
name="sdist_native_cc",

product/gradle-plugin/src/test/integration/packages/src/native/build.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
# This file requires Python 3.6 or later.
32

43
import argparse
54
import os

0 commit comments

Comments
 (0)