diff --git a/distutils/dist.py b/distutils/dist.py index 6cc7cd0c..23571b0c 100644 --- a/distutils/dist.py +++ b/distutils/dist.py @@ -10,17 +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 ._vendor.packaging.utils import canonicalize_name, canonicalize_version from .debug import DEBUG from .errors import ( DistutilsArgError, @@ -249,10 +244,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!