diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-12-03 07:45:44 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-12-03 21:10:00 +0100 |
| commit | a37a3703422cc79e8b9aaa80a653719aa8c1913c (patch) | |
| tree | 8478c30e0349c00e1aa3e8212641d680deec6efd | |
| parent | 5d7daaafbb8943447be2e1abffca28f96ccc3895 (diff) | |
Raise Python version to 3.8
Fix some oversights of previous changes:
- Bump limited API
- Fix CMake files
- Remove outdated version checks from Python code
- Adapt some documentation
Pick-to: 6.8
Task-number: PYSIDE-2943
Change-Id: Id8d9c4c6bb0629948de28beb3c4274991f84ff08
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| -rw-r--r-- | build_scripts/main.py | 7 | ||||
| -rw-r--r-- | sources/pyside6/PySide6/__init__.py.in | 2 | ||||
| -rw-r--r-- | sources/pyside6/doc/building_from_source/linux.rst | 2 | ||||
| -rw-r--r-- | sources/pyside6/doc/deployment/deployment-cxfreeze.rst | 6 | ||||
| -rw-r--r-- | sources/pyside6/doc/developer/signature_doc.rst | 2 | ||||
| -rw-r--r-- | sources/pyside6/plugins/designer/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | sources/pyside6/qtexampleicons/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | sources/pyside6/tests/pysidetest/enum_test.py | 9 | ||||
| -rw-r--r-- | sources/pyside6/tests/registry/scrape_testresults.py | 5 | ||||
| -rw-r--r-- | sources/shiboken6/cmake/ShibokenHelpers.cmake | 4 | ||||
| -rw-r--r-- | sources/shiboken6/libshiboken/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | sources/shiboken6/libshiboken/embed/embedding_generator.py | 3 | ||||
| -rw-r--r-- | sources/shiboken6/tests/shiboken_paths.py | 7 | ||||
| -rw-r--r-- | testing/wheel_tester.py | 39 |
14 files changed, 33 insertions, 59 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py index 0ea03bb9a..7e06c3ddc 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -883,13 +883,6 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): if run_process(cmd_make) != 0: raise SetupError(f"Error compiling {extension}") - if sys.version_info == (3, 6) and sys.platform == "darwin": - # Python 3.6 has a Sphinx problem because of docutils 0.17 . - # Instead of pinning v0.16, setting the default encoding fixes that. - # Since other platforms are not affected, we restrict this to macOS. - if "UTF-8" not in os.environ.get("LC_ALL", ""): - os.environ["LC_ALL"] = "en_US.UTF-8" - if OPTION["BUILD_DOCS"]: if extension.lower() == SHIBOKEN: found = importlib.util.find_spec("sphinx") diff --git a/sources/pyside6/PySide6/__init__.py.in b/sources/pyside6/PySide6/__init__.py.in index ca3b7fc6a..45c19f2e9 100644 --- a/sources/pyside6/PySide6/__init__.py.in +++ b/sources/pyside6/PySide6/__init__.py.in @@ -55,7 +55,7 @@ def _setupQtDirectories(): pyside_package_dir = Path(__file__).parent.resolve() - if sys.platform == 'win32' and sys.version_info[0] == 3 and sys.version_info[1] >= 8: + if sys.platform == 'win32': for dir in _additional_dll_directories(pyside_package_dir): os.add_dll_directory(os.fspath(dir)) diff --git a/sources/pyside6/doc/building_from_source/linux.rst b/sources/pyside6/doc/building_from_source/linux.rst index 9f8e1af53..183b80c9f 100644 --- a/sources/pyside6/doc/building_from_source/linux.rst +++ b/sources/pyside6/doc/building_from_source/linux.rst @@ -93,7 +93,7 @@ Assumming that Qt is in PATH, for example, the configure step can be done with:: -DPython_EXECUTABLE=/path/to/interpreter .. note:: You can add `-DFORCE_LIMITED_API=yes` in case you want to have a - build which will be compatible with Python 3.7+. + build which will be compatible with Python 3.8+. and then for building:: diff --git a/sources/pyside6/doc/deployment/deployment-cxfreeze.rst b/sources/pyside6/doc/deployment/deployment-cxfreeze.rst index 46cbb142e..c02f129e4 100644 --- a/sources/pyside6/doc/deployment/deployment-cxfreeze.rst +++ b/sources/pyside6/doc/deployment/deployment-cxfreeze.rst @@ -118,14 +118,14 @@ Now, build the project using it:: This step creates a ``build/`` directory with the following structure:: build - └── exe.linux-x86_64-3.7 + └── exe.linux-x86_64-3.12 └── lib └── main The first directory inside ``build/`` depends on the platform -you are using, in this case a ``x86_64`` Linux using Python 3.7. +you are using, in this case a ``x86_64`` Linux using Python 3.12. The structure is the same as previously described, and you can simply enter the directory and execute the file:: - cd build/exe.linux-x86_64-3.7 + cd build/exe.linux-x86_64-3.12 ./main diff --git a/sources/pyside6/doc/developer/signature_doc.rst b/sources/pyside6/doc/developer/signature_doc.rst index fa1127240..dceff15fc 100644 --- a/sources/pyside6/doc/developer/signature_doc.rst +++ b/sources/pyside6/doc/developer/signature_doc.rst @@ -3,7 +3,7 @@ The signature C extension ========================= -This module is a C extension for CPython 3.5 and up, and CPython 2.7. +This module is a C extension for CPython 3.X. Its purpose is to provide support for the ``__signature__`` attribute of builtin PyCFunction objects. diff --git a/sources/pyside6/plugins/designer/CMakeLists.txt b/sources/pyside6/plugins/designer/CMakeLists.txt index 717652314..4e2e4ad04 100644 --- a/sources/pyside6/plugins/designer/CMakeLists.txt +++ b/sources/pyside6/plugins/designer/CMakeLists.txt @@ -23,7 +23,7 @@ target_sources(PySidePlugin PRIVATE target_compile_definitions(PySidePlugin PRIVATE -DQT_NO_KEYWORDS=1) if(PYTHON_LIMITED_API) - target_compile_definitions(PySidePlugin PRIVATE "-DPy_LIMITED_API=0x03050000") + target_compile_definitions(PySidePlugin PRIVATE "-DPy_LIMITED_API=0x03080000") endif() if(CMAKE_BUILD_TYPE STREQUAL "Debug") diff --git a/sources/pyside6/qtexampleicons/CMakeLists.txt b/sources/pyside6/qtexampleicons/CMakeLists.txt index 1562f7b27..250b2c292 100644 --- a/sources/pyside6/qtexampleicons/CMakeLists.txt +++ b/sources/pyside6/qtexampleicons/CMakeLists.txt @@ -18,7 +18,7 @@ add_library(QtExampleIcons MODULE module.c) # See libshiboken/CMakeLists.txt if(PYTHON_LIMITED_API) - target_compile_definitions(QtExampleIcons PRIVATE "-DPy_LIMITED_API=0x03050000") + target_compile_definitions(QtExampleIcons PRIVATE "-DPy_LIMITED_API=0x03080000") endif() if(CMAKE_BUILD_TYPE STREQUAL "Debug") diff --git a/sources/pyside6/tests/pysidetest/enum_test.py b/sources/pyside6/tests/pysidetest/enum_test.py index 9816db224..b36e77152 100644 --- a/sources/pyside6/tests/pysidetest/enum_test.py +++ b/sources/pyside6/tests/pysidetest/enum_test.py @@ -92,15 +92,6 @@ class InvestigateOpcodesTest(unittest.TestCase): ('LOAD_CONST', 100, 0), ('RETURN_VALUE', 83, None)] - if sys.version_info[:2] <= (3, 6): - - result_2 = [('LOAD_GLOBAL', 116, 0), - ('LOAD_ATTR', 106, 1), - ('CALL_FUNCTION', 131, 0), - ('STORE_FAST', 125, 1), - ('LOAD_CONST', 100, 0), - ('RETURN_VALUE', 83, None)] - if sys.version_info[:2] == (3, 11): # Note: Python 3.11 is a bit more complex because it can optimize itself. # Opcodes are a bit different, and a hidden second code object is used. diff --git a/sources/pyside6/tests/registry/scrape_testresults.py b/sources/pyside6/tests/registry/scrape_testresults.py index 44677444b..055df973f 100644 --- a/sources/pyside6/tests/registry/scrape_testresults.py +++ b/sources/pyside6/tests/registry/scrape_testresults.py @@ -28,11 +28,6 @@ After the cache has been created, the runtime is substantially smaller. """ -import sys -if sys.version_info[:2] < (3, 6): - print("This program is written for Python 3.6 or higher.") - sys.exit(1) - DEMO_URL = ("https://testresults.qt.io/coin/api/results/pyside/pyside-setup/" # The above URL part is fixed. "30c1193ec56a86b8d0920c325185b9870f96941e/" diff --git a/sources/shiboken6/cmake/ShibokenHelpers.cmake b/sources/shiboken6/cmake/ShibokenHelpers.cmake index 27ee33305..1666548ee 100644 --- a/sources/shiboken6/cmake/ShibokenHelpers.cmake +++ b/sources/shiboken6/cmake/ShibokenHelpers.cmake @@ -341,9 +341,9 @@ macro(shiboken_find_required_python) endmacro() macro(shiboken_validate_python_version) - if(Python_VERSION_MAJOR EQUAL "3" AND Python_VERSION_MINOR LESS "7") + if(Python_VERSION_MAJOR EQUAL "3" AND Python_VERSION_MINOR LESS "8") message(FATAL_ERROR - "Shiboken requires Python 3.7+.") + "Shiboken requires Python 3.8+.") endif() endmacro() diff --git a/sources/shiboken6/libshiboken/CMakeLists.txt b/sources/shiboken6/libshiboken/CMakeLists.txt index b5bbb498a..14e389428 100644 --- a/sources/shiboken6/libshiboken/CMakeLists.txt +++ b/sources/shiboken6/libshiboken/CMakeLists.txt @@ -131,7 +131,7 @@ shiboken_compute_python_includes() shiboken_compute_python_libraries() if(PYTHON_LIMITED_API) - target_compile_definitions(libshiboken PUBLIC "-DPy_LIMITED_API=0x03060000") + target_compile_definitions(libshiboken PUBLIC "-DPy_LIMITED_API=0x03080000") endif() if(CMAKE_BUILD_TYPE STREQUAL "Debug") diff --git a/sources/shiboken6/libshiboken/embed/embedding_generator.py b/sources/shiboken6/libshiboken/embed/embedding_generator.py index 3f790105c..eb643efce 100644 --- a/sources/shiboken6/libshiboken/embed/embedding_generator.py +++ b/sources/shiboken6/libshiboken/embed/embedding_generator.py @@ -157,8 +157,7 @@ def _embed_bytefile(fin, fout, is_text): * {remark}. */ """), file=fout) - headsize = (0 if is_text else - 16 if sys.version_info >= (3, 7) else 12 if sys.version_info >= (3, 3) else 8) + headsize = 0 if is_text else 16 binstr = fin.read()[headsize:] if is_text: try: diff --git a/sources/shiboken6/tests/shiboken_paths.py b/sources/shiboken6/tests/shiboken_paths.py index 614be8736..46c98dadf 100644 --- a/sources/shiboken6/tests/shiboken_paths.py +++ b/sources/shiboken6/tests/shiboken_paths.py @@ -68,11 +68,8 @@ def add_python_dirs(python_dirs): def add_lib_dirs(lib_dirs): """Add directories to the platform's library path.""" if sys.platform == 'win32': - if sys.version_info >= (3, 8, 0): - for lib_dir in lib_dirs: - os.add_dll_directory(lib_dir) - else: - _prepend_path_var('PATH', lib_dirs) + for lib_dir in lib_dirs: + os.add_dll_directory(lib_dir) else: _prepend_path_var('LD_LIBRARY_PATH', lib_dirs) diff --git a/testing/wheel_tester.py b/testing/wheel_tester.py index ab2f14913..0f6fb04ff 100644 --- a/testing/wheel_tester.py +++ b/testing/wheel_tester.py @@ -350,26 +350,25 @@ def try_build_examples(): generate_build_cmake() run_ninja() - if sys.version_info[:2] >= (3, 7): - log.info("Checking Python Interface Files in Python 3 with all features selected") - with tempfile.TemporaryDirectory() as tmpdirname: - src_path = Path(tmpdirname) / "pyi_test" - pyi_script_dir = Path(setup_script_dir) / "sources" / "pyside6" / "PySide6" / "support" - execute_script( - pyi_script_dir / "generate_pyi.py", - "all", - "--outpath", - src_path, - "--feature", - "snake_case", - "true_property", - ) - from PySide6 import __all__ as modules - - for modname in modules: - # PYSIDE-1735: pyi files are no longer compatible with Python. - # XXX Maybe add a test with Mypy here? - pass # execute_script(src_path / f"{modname}.pyi") + log.info("Checking Python Interface Files in Python 3 with all features selected") + with tempfile.TemporaryDirectory() as tmpdirname: + src_path = Path(tmpdirname) / "pyi_test" + pyi_script_dir = Path(setup_script_dir) / "sources" / "pyside6" / "PySide6" / "support" + execute_script( + pyi_script_dir / "generate_pyi.py", + "all", + "--outpath", + src_path, + "--feature", + "snake_case", + "true_property", + ) + from PySide6 import __all__ as modules + + for modname in modules: + # PYSIDE-1735: pyi files are no longer compatible with Python. + # XXX Maybe add a test with Mypy here? + pass # execute_script(src_path / f"{modname}.pyi") def run_wheel_tests(install_wheels, wheels_dir_name): |
