Skip to content

Commit 7f0e0c9

Browse files
authored
Merge pull request pypa/distutils#279 from abravalheri/warnings-exist
Remove outdated `ImportError` check for `warnings`
2 parents dcb0a64 + 8c6015c commit 7f0e0c9

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

distutils/dist.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@
1010
import pathlib
1111
import re
1212
import sys
13+
import warnings
1314
from collections.abc import Iterable
1415
from email import message_from_file
1516

16-
from ._vendor.packaging.utils import canonicalize_name, canonicalize_version
17-
18-
try:
19-
import warnings
20-
except ImportError:
21-
warnings = None
22-
2317
from ._log import log
18+
from ._vendor.packaging.utils import canonicalize_name, canonicalize_version
2419
from .debug import DEBUG
2520
from .errors import (
2621
DistutilsArgError,
@@ -249,10 +244,7 @@ def __init__(self, attrs=None): # noqa: C901
249244
attrs['license'] = attrs['licence']
250245
del attrs['licence']
251246
msg = "'licence' distribution option is deprecated; use 'license'"
252-
if warnings is not None:
253-
warnings.warn(msg)
254-
else:
255-
sys.stderr.write(msg + "\n")
247+
warnings.warn(msg)
256248

257249
# Now work on the rest of the attributes. Any attribute that's
258250
# not already defined is invalid!

0 commit comments

Comments
 (0)