Remove support for EOL Python versions 3.6 and 3.7

This commit is contained in:
rdb
2023-08-04 14:20:59 +02:00
parent a68ecb9765
commit f80cd08993
11 changed files with 11 additions and 114 deletions

View File

@@ -180,38 +180,6 @@ jobs:
run: cmake --build . --config ${{ matrix.config }} --parallel 4
# END A
- name: Setup Python (Python 3.7)
if: contains(matrix.python, 'YES')
uses: actions/setup-python@v4
with:
python-version: '3.7'
- name: Configure (Python 3.7)
if: contains(matrix.python, 'YES')
working-directory: build
shell: bash
run: >
cmake -DWANT_PYTHON_VERSION=3.7 -DHAVE_PYTHON=YES
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT="$pythonLocation" .
- name: Build (Python 3.7)
if: contains(matrix.python, 'YES')
# BEGIN A
working-directory: build
run: cmake --build . --config ${{ matrix.config }} --parallel 4
# END A
- name: Test (Python 3.7)
# BEGIN B
if: contains(matrix.python, 'YES')
working-directory: build
shell: bash
env:
PYTHONPATH: ${{ matrix.config }}
run: |
PYTHON_EXECUTABLE=$(grep 'Python_EXECUTABLE:' CMakeCache.txt | sed 's/.*=//')
$PYTHON_EXECUTABLE -m pip install -r ../requirements-test.txt
export COVERAGE_FILE=.coverage.$RANDOM LLVM_PROFILE_FILE=$PWD/pid-%p.profraw
$PYTHON_EXECUTABLE -m pytest ../tests --cov=.
# END B
- name: Setup Python (Python 3.8)
if: contains(matrix.python, 'YES')
uses: actions/setup-python@v4
@@ -443,20 +411,6 @@ jobs:
python -m pip install -r requirements-test.txt
PYTHONPATH=built LD_LIBRARY_PATH=built/lib DYLD_LIBRARY_PATH=built/lib python -m pytest
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: '3.7'
- name: Build Python 3.7
shell: bash
run: |
python makepanda/makepanda.py --git-commit=${{github.sha}} --outputdir=built --everything --no-eigen --python-incdir="$pythonLocation/include" --python-libdir="$pythonLocation/lib" --verbose --threads=4 --windows-sdk=10
- name: Test Python 3.7
shell: bash
run: |
python -m pip install -r requirements-test.txt
PYTHONPATH=built LD_LIBRARY_PATH=built/lib DYLD_LIBRARY_PATH=built/lib python -m pytest
- name: Make installer
run: |
python makepanda/makepackage.py --verbose --lzma

View File

@@ -11,7 +11,6 @@ import types
import weakref
import random
import builtins
import sys
deadEndTypes = frozenset((
@@ -566,7 +565,7 @@ class FindContainers(Job):
curObjRef = None
# types.CellType was added in Python 3.8
if sys.version_info >= (3, 8) and type(curObj) is types.CellType:
if type(curObj) is types.CellType:
child = curObj.cell_contents
hasLength = self._hasLength(child)
notDeadEnd = not self._isDeadEnd(child)

View File

@@ -5,7 +5,6 @@ from direct.showbase.Job import Job
from direct.showbase.JobManagerGlobal import jobMgr
from direct.showbase.ContainerLeakDetector import deadEndTypes
import types
import sys
import io
@@ -122,7 +121,7 @@ class ContainerReport(Job):
continue
# types.CellType was added in Python 3.8
if sys.version_info >= (3, 8) and type(parentObj) is types.CellType:
if type(parentObj) is types.CellType:
child = parentObj.cell_contents
if self._examine(child):
assert (self._queue.back() is child)

View File

@@ -9,8 +9,8 @@
########################################################################
import sys
if sys.version_info < (3, 6):
print("This version of Python is not supported, use version 3.6 or higher.")
if sys.version_info < (3, 8):
print("This version of Python is not supported, use version 3.8 or higher.")
exit(1)
try:

View File

@@ -3390,20 +3390,7 @@ def GetPythonABI():
if soabi:
return soabi
soabi = 'cpython-%d%d' % (sys.version_info[:2])
if sys.version_info >= (3, 8):
return soabi
debug_flag = sysconfig.get_config_var('Py_DEBUG')
if (debug_flag is None and hasattr(sys, 'gettotalrefcount')) or debug_flag:
soabi += 'd'
malloc_flag = sysconfig.get_config_var('WITH_PYMALLOC')
if malloc_flag is None or malloc_flag:
soabi += 'm'
return soabi
return 'cpython-%d%d' % (sys.version_info[:2])
def CalcLocation(fn, ipath):
if fn.startswith("panda3d/") and fn.endswith(".py"):
@@ -3545,7 +3532,7 @@ def UpdatePythonVersionInfoFile(new_info):
version_info["soabi"] == new_info["soabi"] or \
not os.path.isfile(core_pyd) or \
version_info["version"].split(".", 1)[0] == "2" or \
version_info["version"] in ("3.0", "3.1", "3.2", "3.3", "3.4", "3.5"):
version_info["version"] in ("3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7"):
json_data.remove(version_info)
if not PkgSkip("PYTHON"):
@@ -3570,7 +3557,7 @@ def ReadPythonVersionInfoFile():
# Don't include unsupported versions of Python.
for version_info in json_data[:]:
if version_info["version"] in ("2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4"):
if version_info["version"] in ("2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7"):
json_data.remove(version_info)
return json_data

View File

@@ -24,20 +24,7 @@ def get_abi_tag():
elif soabi:
return soabi.replace('.', '_').replace('-', '_')
soabi = 'cp%d%d' % (sys.version_info[:2])
if sys.version_info >= (3, 8):
return soabi
debug_flag = get_config_var('Py_DEBUG')
if (debug_flag is None and hasattr(sys, 'gettotalrefcount')) or debug_flag:
soabi += 'd'
malloc_flag = get_config_var('WITH_PYMALLOC')
if malloc_flag is None or malloc_flag:
soabi += 'm'
return soabi
return 'cp%d%d' % (sys.version_info[:2])
def is_exe_file(path):
@@ -635,8 +622,8 @@ def makewheel(version, output_dir, platform=None):
if not LocateBinary("patchelf"):
raise Exception("patchelf is required when building a Linux wheel.")
if sys.version_info < (3, 6):
raise Exception("Python 3.6 or higher is required to produce a wheel.")
if sys.version_info < (3, 8):
raise Exception("Python 3.8 or higher is required to produce a wheel.")
if platform is None:
# Determine the platform from the build.

View File

@@ -275,11 +275,7 @@ result(PyObject *self, PyObject *timeout) const {
static PyObject *exc_type = nullptr;
if (exc_type == nullptr) {
// Get the TimeoutError that asyncio uses, too.
#if PY_VERSION_HEX >= 0x03080000
PyObject *module = PyImport_ImportModule("asyncio.exceptions");
#else
PyObject *module = PyImport_ImportModule("concurrent.futures._base");
#endif
if (module != nullptr) {
exc_type = PyObject_GetAttrString(module, "TimeoutError");
Py_DECREF(module);
@@ -289,15 +285,9 @@ result(PyObject *self, PyObject *timeout) const {
}
// If we can't get that, we should pretend and make our own.
if (exc_type == nullptr) {
#if PY_VERSION_HEX >= 0x03080000
exc_type = PyErr_NewExceptionWithDoc((char*)"asyncio.exceptions.TimeoutError",
(char*)"The operation exceeded the given deadline.",
nullptr, nullptr);
#else
exc_type = PyErr_NewExceptionWithDoc((char*)"concurrent.futures._base.TimeoutError",
(char*)"The operation exceeded the given deadline.",
nullptr, nullptr);
#endif
}
}
PyErr_SetNone(exc_type);
@@ -403,11 +393,7 @@ get_cancelled_error_type() {
PyErr_Fetch(&curexc_type, &curexc_value, &curexc_traceback);
// Get the CancelledError that asyncio uses, too.
#if PY_VERSION_HEX >= 0x03080000
PyObject *module = PyImport_ImportModule("asyncio.exceptions");
#else
PyObject *module = PyImport_ImportModule("concurrent.futures._base");
#endif
if (module != nullptr) {
exc_type = PyObject_GetAttrString(module, "CancelledError");
Py_DECREF(module);
@@ -415,15 +401,9 @@ get_cancelled_error_type() {
// If we can't get that, we should pretend and make our own.
if (exc_type == nullptr) {
#if PY_VERSION_HEX >= 0x03080000
exc_type = PyErr_NewExceptionWithDoc((char *)"asyncio.exceptions.CancelledError",
(char *)"The Future or Task was cancelled.",
PyExc_BaseException, nullptr);
#else
exc_type = PyErr_NewExceptionWithDoc((char *)"concurrent.futures._base.CancelledError",
(char *)"The Future was cancelled.",
nullptr, nullptr);
#endif
}
PyErr_Restore(curexc_type, curexc_value, curexc_traceback);

View File

@@ -14,8 +14,6 @@ classifiers =
Programming Language :: C++
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10

View File

@@ -3,13 +3,11 @@ import sys, os
import pytest
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Requires Python 3.6")
def test_filename_fspath():
fn = Filename.from_os_specific(__file__)
assert os.fspath(fn) == fn.to_os_specific_w()
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Requires Python 3.6")
def test_filename_open():
fn = Filename.from_os_specific(__file__)
open(fn, 'rb')

View File

@@ -2,11 +2,7 @@ from panda3d import core
import pytest
import time
import sys
if sys.version_info >= (3, 8):
from asyncio.exceptions import TimeoutError, CancelledError
else:
from concurrent.futures._base import TimeoutError, CancelledError
from asyncio.exceptions import TimeoutError, CancelledError
class MockFuture:

View File

@@ -221,7 +221,6 @@ def test_loader_ram_cache(test_filename):
ModelPool.release_model(model2)
@pytest.mark.skipif(sys.version_info < (3, 4), reason="Requires Python 3.4")
def test_loader_file_type_registry_pickle():
from direct.stdpy.pickle import dumps, loads