mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-05 20:51:15 -07:00
Bump platformdirs from 4.2.2 to 4.3.6 (#2403)
* Bump platformdirs from 4.2.2 to 4.3.6 Bumps [platformdirs](https://github.com/tox-dev/platformdirs) from 4.2.2 to 4.3.6. - [Release notes](https://github.com/tox-dev/platformdirs/releases) - [Changelog](https://github.com/tox-dev/platformdirs/blob/main/CHANGES.rst) - [Commits](https://github.com/tox-dev/platformdirs/compare/4.2.2...4.3.6) --- updated-dependencies: - dependency-name: platformdirs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update platformdirs==4.3.6 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
bf07912711
commit
025e8bcf58
7 changed files with 38 additions and 20 deletions
|
@ -19,18 +19,18 @@ if TYPE_CHECKING:
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
|
if sys.platform == "win32":
|
||||||
|
from platformdirs.windows import Windows as _Result
|
||||||
|
elif sys.platform == "darwin":
|
||||||
|
from platformdirs.macos import MacOS as _Result
|
||||||
|
else:
|
||||||
|
from platformdirs.unix import Unix as _Result
|
||||||
|
|
||||||
|
|
||||||
def _set_platform_dir_class() -> type[PlatformDirsABC]:
|
def _set_platform_dir_class() -> type[PlatformDirsABC]:
|
||||||
if sys.platform == "win32":
|
|
||||||
from platformdirs.windows import Windows as Result # noqa: PLC0415
|
|
||||||
elif sys.platform == "darwin":
|
|
||||||
from platformdirs.macos import MacOS as Result # noqa: PLC0415
|
|
||||||
else:
|
|
||||||
from platformdirs.unix import Unix as Result # noqa: PLC0415
|
|
||||||
|
|
||||||
if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
|
if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
|
||||||
if os.getenv("SHELL") or os.getenv("PREFIX"):
|
if os.getenv("SHELL") or os.getenv("PREFIX"):
|
||||||
return Result
|
return _Result
|
||||||
|
|
||||||
from platformdirs.android import _android_folder # noqa: PLC0415
|
from platformdirs.android import _android_folder # noqa: PLC0415
|
||||||
|
|
||||||
|
@ -39,10 +39,14 @@ def _set_platform_dir_class() -> type[PlatformDirsABC]:
|
||||||
|
|
||||||
return Android # return to avoid redefinition of a result
|
return Android # return to avoid redefinition of a result
|
||||||
|
|
||||||
return Result
|
return _Result
|
||||||
|
|
||||||
|
|
||||||
PlatformDirs = _set_platform_dir_class() #: Currently active platform
|
if TYPE_CHECKING:
|
||||||
|
# Work around mypy issue: https://github.com/python/mypy/issues/10962
|
||||||
|
PlatformDirs = _Result
|
||||||
|
else:
|
||||||
|
PlatformDirs = _set_platform_dir_class() #: Currently active platform
|
||||||
AppDirs = PlatformDirs #: Backwards compatibility with appdirs
|
AppDirs = PlatformDirs #: Backwards compatibility with appdirs
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ class Android(PlatformDirsABC):
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=1)
|
@lru_cache(maxsize=1)
|
||||||
def _android_folder() -> str | None: # noqa: C901, PLR0912
|
def _android_folder() -> str | None: # noqa: C901
|
||||||
""":return: base folder for the Android OS or None if it cannot be found"""
|
""":return: base folder for the Android OS or None if it cannot be found"""
|
||||||
result: str | None = None
|
result: str | None = None
|
||||||
# type checker isn't happy with our "import android", just don't do this when type checking see
|
# type checker isn't happy with our "import android", just don't do this when type checking see
|
||||||
|
|
|
@ -91,6 +91,12 @@ class PlatformDirsABC(ABC): # noqa: PLR0904
|
||||||
if self.ensure_exists:
|
if self.ensure_exists:
|
||||||
Path(path).mkdir(parents=True, exist_ok=True)
|
Path(path).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
def _first_item_as_path_if_multipath(self, directory: str) -> Path:
|
||||||
|
if self.multipath:
|
||||||
|
# If multipath is True, the first path is returned.
|
||||||
|
directory = directory.split(os.pathsep)[0]
|
||||||
|
return Path(directory)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def user_data_dir(self) -> str:
|
def user_data_dir(self) -> str:
|
||||||
|
|
|
@ -4,9 +4,13 @@ from __future__ import annotations
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from .api import PlatformDirsABC
|
from .api import PlatformDirsABC
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
class MacOS(PlatformDirsABC):
|
class MacOS(PlatformDirsABC):
|
||||||
"""
|
"""
|
||||||
|
@ -42,6 +46,11 @@ class MacOS(PlatformDirsABC):
|
||||||
return os.pathsep.join(path_list)
|
return os.pathsep.join(path_list)
|
||||||
return path_list[0]
|
return path_list[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def site_data_path(self) -> Path:
|
||||||
|
""":return: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
|
||||||
|
return self._first_item_as_path_if_multipath(self.site_data_dir)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def user_config_dir(self) -> str:
|
def user_config_dir(self) -> str:
|
||||||
""":return: config directory tied to the user, same as `user_data_dir`"""
|
""":return: config directory tied to the user, same as `user_data_dir`"""
|
||||||
|
@ -74,6 +83,11 @@ class MacOS(PlatformDirsABC):
|
||||||
return os.pathsep.join(path_list)
|
return os.pathsep.join(path_list)
|
||||||
return path_list[0]
|
return path_list[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def site_cache_path(self) -> Path:
|
||||||
|
""":return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
|
||||||
|
return self._first_item_as_path_if_multipath(self.site_cache_dir)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def user_state_dir(self) -> str:
|
def user_state_dir(self) -> str:
|
||||||
""":return: state directory tied to the user, same as `user_data_dir`"""
|
""":return: state directory tied to the user, same as `user_data_dir`"""
|
||||||
|
|
|
@ -218,12 +218,6 @@ class Unix(PlatformDirsABC): # noqa: PLR0904
|
||||||
""":return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
|
""":return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
|
||||||
return self._first_item_as_path_if_multipath(self.site_cache_dir)
|
return self._first_item_as_path_if_multipath(self.site_cache_dir)
|
||||||
|
|
||||||
def _first_item_as_path_if_multipath(self, directory: str) -> Path:
|
|
||||||
if self.multipath:
|
|
||||||
# If multipath is True, the first path is returned.
|
|
||||||
directory = directory.split(os.pathsep)[0]
|
|
||||||
return Path(directory)
|
|
||||||
|
|
||||||
def iter_config_dirs(self) -> Iterator[str]:
|
def iter_config_dirs(self) -> Iterator[str]:
|
||||||
""":yield: all user and site configuration directories."""
|
""":yield: all user and site configuration directories."""
|
||||||
yield self.user_config_dir
|
yield self.user_config_dir
|
||||||
|
|
|
@ -12,5 +12,5 @@ __version__: str
|
||||||
__version_tuple__: VERSION_TUPLE
|
__version_tuple__: VERSION_TUPLE
|
||||||
version_tuple: VERSION_TUPLE
|
version_tuple: VERSION_TUPLE
|
||||||
|
|
||||||
__version__ = version = '4.2.2'
|
__version__ = version = '4.3.6'
|
||||||
__version_tuple__ = version_tuple = (4, 2, 2)
|
__version_tuple__ = version_tuple = (4, 3, 6)
|
||||||
|
|
|
@ -25,7 +25,7 @@ MarkupSafe==2.1.5
|
||||||
musicbrainzngs==0.7.1
|
musicbrainzngs==0.7.1
|
||||||
packaging==24.1
|
packaging==24.1
|
||||||
paho-mqtt==2.1.0
|
paho-mqtt==2.1.0
|
||||||
platformdirs==4.2.2
|
platformdirs==4.3.6
|
||||||
plexapi==4.15.16
|
plexapi==4.15.16
|
||||||
portend==3.2.0
|
portend==3.2.0
|
||||||
profilehooks==1.12.0
|
profilehooks==1.12.0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue