Skip to content

Commit

Permalink
Correct importlib_metadata python_version bounds (rytilahti#828)
Browse files Browse the repository at this point in the history
* Correct importlib_metadata python_version bounds

importlib_metadata is a backport of the python 3.8 stdlib library

https://importlib-metadata.readthedocs.io/en/latest/

* Fix importlib_metadata import statement

Co-authored by: @georgewhewell
  • Loading branch information
jonringer authored and swim2sun committed Oct 13, 2020
1 parent c7c5a31 commit e31f7c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion miio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# flake8: noqa
from importlib_metadata import version # type: ignore
try:
# python 3.7 and earlier
from importlib_metadata import version # type: ignore
except ImportError:
# python 3.8 and later
from importlib.metadata import version # type: ignore

from miio.airconditioningcompanion import (
AirConditioningCompanion,
AirConditioningCompanionV3,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ appdirs = "^1"
tqdm = "^4"
netifaces = "^0"
android_backup = { version = "^0", optional = true }
importlib_metadata = "^1"
importlib_metadata = { version = "^1", markers = "python_version <= '3.7'" }
croniter = "^0"

sphinx = { version = "^3", optional = true }
Expand Down

0 comments on commit e31f7c2

Please sign in to comment.