Skip to content

Commit 8568d1f

Browse files
authored
Replace packaging version tools with AwesomeVersion (#464)
1 parent f36d870 commit 8568d1f

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

poetry.lock

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ python = "^3.8"
3030
aiohttp = ">=3.0.0"
3131
yarl = ">=1.6.0"
3232
backoff = ">=1.9.0"
33+
awesomeversion = ">=21.10.1"
3334

3435
[tool.poetry.dev-dependencies]
3536
aresponses = "^2.1.4"

src/wled/wled.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import aiohttp
1212
import async_timeout
1313
import backoff # type: ignore
14-
from packaging import version
14+
from awesomeversion import AwesomeVersion, AwesomeVersionException
1515
from yarl import URL
1616

1717
from .exceptions import (
@@ -245,11 +245,10 @@ async def update(self, full_update: bool = False) -> Device:
245245
# Try to figure out if this version supports
246246
# a single info and state call
247247
try:
248-
version.Version(self._device.info.version)
249-
self._supports_si_request = version.parse(
250-
self._device.info.version
251-
) >= version.parse("0.10.0")
252-
except version.InvalidVersion:
248+
current = AwesomeVersion(self._device.info.version)
249+
supported = AwesomeVersion("0.10.0")
250+
self._supports_si_request = current >= supported
251+
except AwesomeVersionException:
253252
# Could be a manual build one? Lets poll for it
254253
try:
255254
await self.request("/json/si")

0 commit comments

Comments
 (0)