From aa14161e9a1d8ceca57e649dd4dafc73dbff362d Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Fri, 23 Aug 2024 15:51:34 +0100 Subject: [PATCH] Run tests on Python 3.12 (#477) * Run tests on Python 3.12 * Update setup.cfg * Update code to work with Python 3.12 * Try to fix the pep425_impl code * Update windows default_abi behaviour to match linux and macos * Fix package version module * This is still a dev version --- .github/workflows/test.yml | 2 +- VERSION | 2 +- okonomiyaki/__init__.py | 10 ++-------- okonomiyaki/platforms/_pep425_impl.py | 22 ++++++++++++++-------- okonomiyaki/platforms/abi.py | 2 +- okonomiyaki/platforms/tests/test_abi.py | 1 - setup.cfg | 1 + setup.py | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fa1236cd..12d527ce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: tests: strategy: matrix: - python-version: [3.6, 3.8, 3.11] + python-version: [3.6, 3.8, 3.11, 3.12] os: [ubuntu-20.04, macos-12, macos-latest, windows-2019] exclude: - os: macos-latest diff --git a/VERSION b/VERSION index 359a5b95..c4292de0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.0 \ No newline at end of file +2.0.0.dev \ No newline at end of file diff --git a/okonomiyaki/__init__.py b/okonomiyaki/__init__.py index 23e2acb9..98cbc053 100644 --- a/okonomiyaki/__init__.py +++ b/okonomiyaki/__init__.py @@ -1,9 +1,3 @@ -# Copyright (c) 2013 by Enthought, Inc. +# Copyright (c) 2013-2024 by Enthought, Inc. # All rights reserved. -try: - from ._version import ( - version as __version__, version_info as __version_info__ - ) -except ImportError: - __version__ = "unknown" - __version_info__ = (0, 0, 0, "unknown", 0) +from ._version import __version__ # noqa diff --git a/okonomiyaki/platforms/_pep425_impl.py b/okonomiyaki/platforms/_pep425_impl.py index 65d5a332..0694427a 100644 --- a/okonomiyaki/platforms/_pep425_impl.py +++ b/okonomiyaki/platforms/_pep425_impl.py @@ -101,15 +101,21 @@ def _is_running_32bit(): def get_platform(): - import distutils.util - import platform """Return our platform name 'win32', 'linux_x86_64'""" - - result = distutils.util.get_platform().replace('.', '_').replace('-', '_') - if result == "linux_x86_64" and _is_running_32bit(): - # 32 bit Python program (running on a 64 bit Linux): pip should only - # install and run 32 bit compiled extensions in that case. - result = "linux_i686" + try: + import distutils.util + except ImportError: + import sysconfig + result = sysconfig.get_platform().replace(".", "_").replace("-", "_") + else: + result = distutils.util.get_platform().replace('.', '_').replace('-', '_') + if _is_running_32bit(): + # 32 bit Python program (running on a 64 bit Linux): pip should only + # install and run 32 bit compiled extensions in that case. + if result == "linux_x86_64": + result = "linux_i686" + elif result == "linux_aarch64": + result = "linux_armv71" return result diff --git a/okonomiyaki/platforms/abi.py b/okonomiyaki/platforms/abi.py index c20c46de..279059b9 100644 --- a/okonomiyaki/platforms/abi.py +++ b/okonomiyaki/platforms/abi.py @@ -45,7 +45,7 @@ def _default_cpython_abi(platform, implementation_version): abi = u"msvc2015" elif implementation_version.minor <= 8: abi = u"msvc2019" - elif implementation_version.minor <= 11: + else: abi = u"msvc2022" if abi is None: diff --git a/okonomiyaki/platforms/tests/test_abi.py b/okonomiyaki/platforms/tests/test_abi.py index 0c8693d9..1f835397 100644 --- a/okonomiyaki/platforms/tests/test_abi.py +++ b/okonomiyaki/platforms/tests/test_abi.py @@ -32,7 +32,6 @@ def test_basics(self, platform, implementation, version, expected): self.assertEqual(abi, expected) @parameterized.expand([ - ("win_x86", "cpython", "3.12.0+1"), ("win_x86", "pypy", "4.1.0+1"), ("rh5_x86_64", "r", "3.0.0+1")]) def test_non_supported(self, *arguments): diff --git a/setup.cfg b/setup.cfg index c93470af..2558e894 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,7 @@ classifier = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 [bdist_wheel] universal = 1 diff --git a/setup.py b/setup.py index 4c60a98d..f532a08b 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,6 @@ HERE = Path(__file__).parent version = (HERE / 'VERSION').read_text().strip() -filename = (HERE / 'okonomiyaki' / 'version.py').write_text(f'__version__ = "{version}"\n') +filename = (HERE / 'okonomiyaki' / '_version.py').write_text(f'__version__ = "{version}"\n') setup()