From d742c1d81d3ed04928698a64bb3f9e71577389ee Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Thu, 24 Oct 2024 13:01:24 +0100 Subject: [PATCH 1/3] Improve compatibility with setuptools --- src/wheel/bdist_wheel.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/wheel/bdist_wheel.py b/src/wheel/bdist_wheel.py index 05d93eee..dd7b8629 100644 --- a/src/wheel/bdist_wheel.py +++ b/src/wheel/bdist_wheel.py @@ -1,7 +1,6 @@ +from typing import TYPE_CHECKING from warnings import warn -from ._bdist_wheel import bdist_wheel as bdist_wheel - warn( "The 'wheel' package is no longer the canonical location of the 'bdist_wheel' " "command, and will be removed in a future release. Please update to setuptools " @@ -9,3 +8,19 @@ DeprecationWarning, stacklevel=1, ) + +if TYPE_CHECKING: + from ._bdist_wheel import bdist_wheel as bdist_wheel +else: + try: + # Better integration/compatibility with setuptools: + # in the case new fixes or PEPs are implemented in setuptools + # there is no need to backport them to the deprecated code base. + # This is useful in the case of old packages in the ecosystem + # that are still used but have low maintenance. + from setuptools.command.bdist_wheel import bdist_wheel + except ImportError: + # Only used in the case of old setuptools versions. + # If the user wants to get the latest fixes/PEPs, + # they are encouraged to address the deprecation warning. + from ._bdist_wheel import bdist_wheel as bdist_wheel From 6f0f437171e226bcd72b484c90fb0010ab89626c Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Fri, 25 Oct 2024 10:57:57 +0100 Subject: [PATCH 2/3] Add news fragment --- docs/news.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/news.rst b/docs/news.rst index eda608a2..a83f7cd0 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,6 +1,14 @@ Release Notes ============= +**UNRELEASED** + +- Added a redirection from ``wheel.bdist_wheel.bdist_wheel`` to + ``setuptools.command.bdist_wheel.bdist_wheel`` to improve + compatibility with ``setuptools``' latest fixes (#638). + Projects are still advised to migrate away from the deprecated + module and import the ``setuptools``' implementation explicitly. + **0.44.0 (2024-08-04)** - Canonicalized requirements in METADATA file (PR by Wim Jeantine-Glenn) From e2ca58b6aab85661583ec83b32398e9a652848c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Fri, 25 Oct 2024 13:09:28 +0300 Subject: [PATCH 3/3] Update news.rst --- docs/news.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/news.rst b/docs/news.rst index a83f7cd0..bfd2921b 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -4,10 +4,11 @@ Release Notes **UNRELEASED** - Added a redirection from ``wheel.bdist_wheel.bdist_wheel`` to - ``setuptools.command.bdist_wheel.bdist_wheel`` to improve - compatibility with ``setuptools``' latest fixes (#638). - Projects are still advised to migrate away from the deprecated - module and import the ``setuptools``' implementation explicitly. + ``setuptools.command.bdist_wheel.bdist_wheel`` to improve compatibility with + ``setuptools``' latest fixes. + + Projects are still advised to migrate away from the deprecated module and import + the ``setuptools``' implementation explicitly. (PR by @abravalheri) **0.44.0 (2024-08-04)**