Skip to content

Commit

Permalink
Fix python 3.7 compatibility (#850)
Browse files Browse the repository at this point in the history
The typing package from python 3.7 stdlib does not provide Literal
type, so external typing-extensions package must be used instead.
  • Loading branch information
rokm committed Feb 23, 2023
1 parent 87ff77c commit 4b699ef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Core dependencies
Essential:

* python3 >= 3.6
* python3-typing-extensions (python3 <= 3.7 only)
* python3-bsddb3
* gtk+ >= 3.22
* gstreamer (>= 1.14)
Expand Down
11 changes: 10 additions & 1 deletion xlgui/widgets/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@
# do so. If you do not wish to do so, delete this exception statement
# from your version.

from typing import Literal
try:
from typing import Literal # python >= 3.8
except ImportError:
# python <= 3.7 requires typing_extensions package
try:
from typing_extensions import Literal
except ModuleNotFoundError as e:
raise RuntimeError(
"Please install typing-extensions package to run exaile under python <= 3.7."
) from e

from gi.repository import GLib
from gi.repository import Gtk
Expand Down

0 comments on commit 4b699ef

Please sign in to comment.