Skip to content

Commit 2445c23

Browse files
committed
Suppress pkg_resources deprecation warnings
At some point in the future, when python 3.8 is the minimum requirement, this will be migrated to use `importlib.metadata` and `packaging.version`
1 parent 462a2e0 commit 2445c23

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

emailproxy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
no_gui_parser.add_argument('--external-auth', action='store_true')
6868
no_gui_args = no_gui_parser.parse_known_args()[0]
6969
if not no_gui_args.no_gui:
70-
import pkg_resources # from setuptools - used to check package versions and choose compatible methods
70+
# noinspection PyDeprecation
71+
import pkg_resources # from setuptools - to be changed to importlib.metadata and packaging.version once 3.8 is min.
7172
import pystray # the menu bar/taskbar GUI
7273
import timeago # the last authenticated activity hint
7374
from PIL import Image, ImageDraw, ImageFont # draw the menu bar icon from the TTF font stored in APP_ICON
@@ -2295,6 +2296,7 @@ def get_icon_size(text, font_size):
22952296
font = ImageFont.truetype(io.BytesIO(zlib.decompress(base64.b64decode(APP_ICON))), size=font_size)
22962297

22972298
# pillow's getsize method was deprecated in 9.2.0 (see docs for PIL.ImageFont.ImageFont.getsize)
2299+
# noinspection PyDeprecation
22982300
if pkg_resources.parse_version(
22992301
pkg_resources.get_distribution('pillow').version) < pkg_resources.parse_version('9.2.0'):
23002302
font_width, font_height = font.getsize(text)
@@ -2439,6 +2441,7 @@ def create_authorisation_window(self, request):
24392441
setattr(authorisation_window, 'get_title', lambda window: window.title) # add missing get_title method
24402442

24412443
# pywebview 3.6+ moved window events to a separate namespace in a non-backwards-compatible way
2444+
# noinspection PyDeprecation
24422445
if pkg_resources.parse_version(
24432446
pkg_resources.get_distribution('pywebview').version) < pkg_resources.parse_version('3.6'):
24442447
authorisation_window.loaded += self.authorisation_window_loaded

0 commit comments

Comments
 (0)