mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
build(deps): update platformdirs requirement from <4,>=3.1.1 to >=3.1.1,<5 (#10603)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
+13
@@ -21,6 +21,19 @@ def global_config_dir():
|
|||||||
|
|
||||||
|
|
||||||
def site_cache_dir():
|
def site_cache_dir():
|
||||||
|
from platformdirs import PlatformDirs
|
||||||
|
from platformdirs.unix import Unix
|
||||||
|
|
||||||
|
if issubclass(Unix, PlatformDirs):
|
||||||
|
# Return the cache directory shared by users, e.g. `/var/tmp/$appname`
|
||||||
|
# NOTE: platformdirs>=5 changed `site_cache_dir` to return /var/cache/$appname.
|
||||||
|
# as the following path is considered insecure.
|
||||||
|
# For details, see: https://github.com/tox-dev/platformdirs/pull/239
|
||||||
|
|
||||||
|
# FIXME: keeping the old behavior temporarily to avoid dependency conflict.
|
||||||
|
# In the future, consider migrating to a more secure directory.
|
||||||
|
return f"/var/tmp/{APPNAME}" # noqa: S108
|
||||||
|
|
||||||
return os.getenv(env.DVC_SITE_CACHE_DIR) or platformdirs.site_cache_dir(
|
return os.getenv(env.DVC_SITE_CACHE_DIR) or platformdirs.site_cache_dir(
|
||||||
APPNAME, APPAUTHOR, opinion=True
|
APPNAME, APPAUTHOR, opinion=True
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ dependencies = [
|
|||||||
"omegaconf",
|
"omegaconf",
|
||||||
"packaging>=19",
|
"packaging>=19",
|
||||||
"pathspec>=0.10.3",
|
"pathspec>=0.10.3",
|
||||||
"platformdirs<4,>=3.1.1",
|
"platformdirs<5,>=3.1.1",
|
||||||
"psutil>=5.8",
|
"psutil>=5.8",
|
||||||
"pydot>=1.2.4",
|
"pydot>=1.2.4",
|
||||||
"pygtrie>=2.3.2",
|
"pygtrie>=2.3.2",
|
||||||
|
|||||||
+10
-1
@@ -1,4 +1,8 @@
|
|||||||
from dvc.dirs import global_config_dir
|
import sys
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from dvc.dirs import global_config_dir, site_cache_dir
|
||||||
from dvc.env import DVC_GLOBAL_CONFIG_DIR
|
from dvc.env import DVC_GLOBAL_CONFIG_DIR
|
||||||
|
|
||||||
|
|
||||||
@@ -6,3 +10,8 @@ def test_global_config_dir_respects_env_var(monkeypatch):
|
|||||||
path = "/some/random/path"
|
path = "/some/random/path"
|
||||||
monkeypatch.setenv(DVC_GLOBAL_CONFIG_DIR, path)
|
monkeypatch.setenv(DVC_GLOBAL_CONFIG_DIR, path)
|
||||||
assert global_config_dir() == path
|
assert global_config_dir() == path
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.platform != "linux", reason="Only for Unix platforms")
|
||||||
|
def test_site_cache_dir_on_unix():
|
||||||
|
assert site_cache_dir() == "/var/tmp/dvc"
|
||||||
|
|||||||
Reference in New Issue
Block a user