From 6f0511fb9cbffe655102c356cb381a470ee95b53 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 12 Aug 2024 11:47:36 +0100 Subject: [PATCH 1/2] Remove outdated import error check for warnings --- distutils/dist.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/distutils/dist.py b/distutils/dist.py index 115302b3..eacb8148 100644 --- a/distutils/dist.py +++ b/distutils/dist.py @@ -10,16 +10,12 @@ import pathlib import re import sys +import warnings from collections.abc import Iterable from email import message_from_file from ._vendor.packaging.utils import canonicalize_name, canonicalize_version -try: - import warnings -except ImportError: - warnings = None - from ._log import log from .debug import DEBUG from .errors import ( @@ -249,10 +245,7 @@ def __init__(self, attrs=None): # noqa: C901 attrs['license'] = attrs['licence'] del attrs['licence'] msg = "'licence' distribution option is deprecated; use 'license'" - if warnings is not None: - warnings.warn(msg) - else: - sys.stderr.write(msg + "\n") + warnings.warn(msg) # Now work on the rest of the attributes. Any attribute that's # not already defined is invalid! From 8c6015c5d75641ca42d06db5021763c4f12c1d32 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 12 Aug 2024 12:01:07 +0100 Subject: [PATCH 2/2] Satisfy ruff import format --- distutils/dist.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/distutils/dist.py b/distutils/dist.py index eacb8148..ea19add2 100644 --- a/distutils/dist.py +++ b/distutils/dist.py @@ -14,9 +14,8 @@ from collections.abc import Iterable from email import message_from_file -from ._vendor.packaging.utils import canonicalize_name, canonicalize_version - from ._log import log +from ._vendor.packaging.utils import canonicalize_name, canonicalize_version from .debug import DEBUG from .errors import ( DistutilsArgError,