Skip to content

Commit

Permalink
Using importlib
Browse files Browse the repository at this point in the history
  • Loading branch information
rfst committed Mar 7, 2024
1 parent a2c1ed6 commit 9ac6baf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "mob-tool"
version = "1.0.34"
version = "1.0.35"
authors = [
{ name = "rfst" },
]
Expand Down
9 changes: 7 additions & 2 deletions src/mobt/Cache/FileSystemCache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from pathlib import Path
from typing import Optional

import pkg_resources
import platformdirs
from importlib.metadata import version, PackageNotFoundError
from dataclasses_json import config, dataclass_json
from injector import inject
from marshmallow import fields
Expand Down Expand Up @@ -33,9 +33,14 @@ def is_expired(self) -> bool:
return datetime.now() > self.expires_at


try:
_cache_dir_version = version('mob-tool')
except PackageNotFoundError:
_cache_dir_version = 'unknown'

_cache_dir = platformdirs.user_cache_dir(
appname='mob-tool',
version=pkg_resources.get_distribution('mob-tool').version,
version=_cache_dir_version,
)


Expand Down

0 comments on commit 9ac6baf

Please sign in to comment.