Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-platformdirs for
openSUSE:Factory checked in at 2026-06-29 17:29:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-platformdirs (Old)
and /work/SRC/openSUSE:Factory/.python-platformdirs.new.11887 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-platformdirs"
Mon Jun 29 17:29:37 2026 rev:22 rq:1362146 version:4.10.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-platformdirs/python-platformdirs.changes
2026-04-13 23:18:43.231712596 +0200
+++
/work/SRC/openSUSE:Factory/.python-platformdirs.new.11887/python-platformdirs.changes
2026-06-29 17:30:05.525474465 +0200
@@ -1,0 +2,8 @@
+Sun Jun 28 10:07:25 UTC 2026 - Dirk Müller <[email protected]>
+
+- update to 4.10.0:
+ * feat: add user_projects_dir for $XDG_PROJECTS_DIR
+ * feat: add user_publicshare_dir, user_templates_dir,
+ user_fonts_dir, user_preference_dir
+
+-------------------------------------------------------------------
Old:
----
platformdirs-4.9.6.tar.gz
New:
----
platformdirs-4.10.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-platformdirs.spec ++++++
--- /var/tmp/diff_new_pack.157AVc/_old 2026-06-29 17:30:06.329501848 +0200
+++ /var/tmp/diff_new_pack.157AVc/_new 2026-06-29 17:30:06.333501986 +0200
@@ -27,7 +27,7 @@
%{?pythons_for_pypi}
%{?sle15_python_module_pythons}
Name: python-platformdirs%{psuffix}
-Version: 4.9.6
+Version: 4.10.0
Release: 0
Summary: Module for determining appropriate platform-specific dirs
License: MIT
++++++ platformdirs-4.9.6.tar.gz -> platformdirs-4.10.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/PKG-INFO
new/platformdirs-4.10.0/PKG-INFO
--- old/platformdirs-4.9.6/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: platformdirs
-Version: 4.9.6
+Version: 4.10.0
Summary: A small Python package for determining appropriate platform-specific
dirs, e.g. a `user data dir`.
Project-URL: Changelog,
https://platformdirs.readthedocs.io/en/latest/changelog.html
Project-URL: Documentation, https://platformdirs.readthedocs.io
@@ -75,14 +75,26 @@
## Directory types
+**Application directories** — scoped to your app name and version:
+
- **Data**: Persistent application data (`user_data_dir`, `site_data_dir`)
- **Config**: Configuration files and settings (`user_config_dir`,
`site_config_dir`)
+- **Preference**: User preferences, distinct from config on macOS
(`user_preference_dir`)
- **Cache**: Cached data that can be regenerated (`user_cache_dir`,
`site_cache_dir`)
- **State**: Non-essential runtime state like window positions
(`user_state_dir`, `site_state_dir`)
- **Logs**: Log files (`user_log_dir`, `site_log_dir`)
- **Runtime**: Runtime files like sockets and PIDs (`user_runtime_dir`,
`site_runtime_dir`)
-Each type has both `user_*` (per-user, writable) and `site_*` (system-wide,
read-only for users) variants.
+App dirs have both `user_*` (per-user, writable) and `site_*` (system-wide,
read-only) variants where applicable.
+
+**User media directories** — standard user-facing folders, not scoped to app
name:
+
+- **Documents** (`user_documents_dir`), **Downloads** (`user_downloads_dir`)
+- **Pictures** (`user_pictures_dir`), **Videos** (`user_videos_dir`),
**Music** (`user_music_dir`)
+- **Desktop** (`user_desktop_dir`), **Projects** (`user_projects_dir`)
+- **Public share** (`user_publicshare_dir`), **Templates**
(`user_templates_dir`)
+- **Fonts** (`user_fonts_dir`) — user-writable font installation directory
+- **Executable** (`user_bin_dir`, `site_bin_dir`), **Applications**
(`user_applications_dir`, `site_applications_dir`)
## Documentation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/README.md
new/platformdirs-4.10.0/README.md
--- old/platformdirs-4.9.6/README.md 2020-02-02 01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/README.md 2020-02-02 01:00:00.000000000 +0100
@@ -45,14 +45,26 @@
## Directory types
+**Application directories** — scoped to your app name and version:
+
- **Data**: Persistent application data (`user_data_dir`, `site_data_dir`)
- **Config**: Configuration files and settings (`user_config_dir`,
`site_config_dir`)
+- **Preference**: User preferences, distinct from config on macOS
(`user_preference_dir`)
- **Cache**: Cached data that can be regenerated (`user_cache_dir`,
`site_cache_dir`)
- **State**: Non-essential runtime state like window positions
(`user_state_dir`, `site_state_dir`)
- **Logs**: Log files (`user_log_dir`, `site_log_dir`)
- **Runtime**: Runtime files like sockets and PIDs (`user_runtime_dir`,
`site_runtime_dir`)
-Each type has both `user_*` (per-user, writable) and `site_*` (system-wide,
read-only for users) variants.
+App dirs have both `user_*` (per-user, writable) and `site_*` (system-wide,
read-only) variants where applicable.
+
+**User media directories** — standard user-facing folders, not scoped to app
name:
+
+- **Documents** (`user_documents_dir`), **Downloads** (`user_downloads_dir`)
+- **Pictures** (`user_pictures_dir`), **Videos** (`user_videos_dir`),
**Music** (`user_music_dir`)
+- **Desktop** (`user_desktop_dir`), **Projects** (`user_projects_dir`)
+- **Public share** (`user_publicshare_dir`), **Templates**
(`user_templates_dir`)
+- **Fonts** (`user_fonts_dir`) — user-writable font installation directory
+- **Executable** (`user_bin_dir`, `site_bin_dir`), **Applications**
(`user_applications_dir`, `site_applications_dir`)
## Documentation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/src/platformdirs/__init__.py
new/platformdirs-4.10.0/src/platformdirs/__init__.py
--- old/platformdirs-4.9.6/src/platformdirs/__init__.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/src/platformdirs/__init__.py 2020-02-02
01:00:00.000000000 +0100
@@ -344,6 +344,31 @@
return PlatformDirs().user_desktop_dir
+def user_projects_dir() -> str:
+ """:returns: projects directory tied to the user"""
+ return PlatformDirs().user_projects_dir
+
+
+def user_publicshare_dir() -> str:
+ """:returns: public share directory tied to the user"""
+ return PlatformDirs().user_publicshare_dir
+
+
+def user_templates_dir() -> str:
+ """:returns: templates directory tied to the user"""
+ return PlatformDirs().user_templates_dir
+
+
+def user_fonts_dir() -> str:
+ """:returns: fonts directory tied to the user"""
+ return PlatformDirs().user_fonts_dir
+
+
+def user_preference_dir() -> str:
+ """:returns: preference directory tied to the user"""
+ return PlatformDirs().user_preference_dir
+
+
def user_bin_dir() -> str:
""":returns: bin directory tied to the user"""
return PlatformDirs().user_bin_dir
@@ -720,6 +745,31 @@
return PlatformDirs().user_desktop_path
+def user_projects_path() -> Path:
+ """:returns: projects path tied to the user"""
+ return PlatformDirs().user_projects_path
+
+
+def user_publicshare_path() -> Path:
+ """:returns: public share path tied to the user"""
+ return PlatformDirs().user_publicshare_path
+
+
+def user_templates_path() -> Path:
+ """:returns: templates path tied to the user"""
+ return PlatformDirs().user_templates_path
+
+
+def user_fonts_path() -> Path:
+ """:returns: fonts path tied to the user"""
+ return PlatformDirs().user_fonts_path
+
+
+def user_preference_path() -> Path:
+ """:returns: preference path tied to the user"""
+ return PlatformDirs().user_preference_path
+
+
def user_bin_path() -> Path:
""":returns: bin path tied to the user"""
return PlatformDirs().user_bin_path
@@ -842,16 +892,26 @@
"user_documents_path",
"user_downloads_dir",
"user_downloads_path",
+ "user_fonts_dir",
+ "user_fonts_path",
"user_log_dir",
"user_log_path",
"user_music_dir",
"user_music_path",
"user_pictures_dir",
"user_pictures_path",
+ "user_preference_dir",
+ "user_preference_path",
+ "user_projects_dir",
+ "user_projects_path",
+ "user_publicshare_dir",
+ "user_publicshare_path",
"user_runtime_dir",
"user_runtime_path",
"user_state_dir",
"user_state_path",
+ "user_templates_dir",
+ "user_templates_path",
"user_videos_dir",
"user_videos_path",
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/src/platformdirs/__main__.py
new/platformdirs-4.10.0/src/platformdirs/__main__.py
--- old/platformdirs-4.9.6/src/platformdirs/__main__.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/src/platformdirs/__main__.py 2020-02-02
01:00:00.000000000 +0100
@@ -15,6 +15,11 @@
"user_pictures_dir",
"user_videos_dir",
"user_music_dir",
+ "user_projects_dir",
+ "user_publicshare_dir",
+ "user_templates_dir",
+ "user_fonts_dir",
+ "user_preference_dir",
"user_bin_dir",
"site_bin_dir",
"user_applications_dir",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/src/platformdirs/_xdg.py
new/platformdirs-4.10.0/src/platformdirs/_xdg.py
--- old/platformdirs-4.9.6/src/platformdirs/_xdg.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/src/platformdirs/_xdg.py 2020-02-02
01:00:00.000000000 +0100
@@ -119,6 +119,34 @@
return super().user_desktop_dir
@property
+ def user_projects_dir(self) -> str:
+ """:returns: projects directory tied to the user, from
``$XDG_PROJECTS_DIR`` if set, else platform default"""
+ if path := os.environ.get("XDG_PROJECTS_DIR", "").strip():
+ return os.path.expanduser(path) # noqa: PTH111 # API returns
str, not Path
+ return super().user_projects_dir
+
+ @property
+ def user_publicshare_dir(self) -> str:
+ """:returns: public share directory tied to the user, from
``$XDG_PUBLICSHARE_DIR`` if set, else platform default"""
+ if path := os.environ.get("XDG_PUBLICSHARE_DIR", "").strip():
+ return os.path.expanduser(path) # noqa: PTH111 # API returns
str, not Path
+ return super().user_publicshare_dir
+
+ @property
+ def user_templates_dir(self) -> str:
+ """:returns: templates directory tied to the user, from
``$XDG_TEMPLATES_DIR`` if set, else platform default"""
+ if path := os.environ.get("XDG_TEMPLATES_DIR", "").strip():
+ return os.path.expanduser(path) # noqa: PTH111 # API returns
str, not Path
+ return super().user_templates_dir
+
+ @property
+ def user_fonts_dir(self) -> str:
+ """:returns: fonts directory tied to the user, from
``$XDG_DATA_HOME/fonts`` if set, else platform default"""
+ if path := os.environ.get("XDG_DATA_HOME", "").strip():
+ return f"{os.path.expanduser(path)}/fonts" # noqa: PTH111 # API
returns str, not Path
+ return super().user_fonts_dir
+
+ @property
def user_applications_dir(self) -> str:
""":returns: applications directory tied to the user, from
``$XDG_DATA_HOME`` if set, else platform default"""
if path := os.environ.get("XDG_DATA_HOME", "").strip():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/src/platformdirs/android.py
new/platformdirs-4.10.0/src/platformdirs/android.py
--- old/platformdirs-4.9.6/src/platformdirs/android.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/src/platformdirs/android.py 2020-02-02
01:00:00.000000000 +0100
@@ -108,6 +108,31 @@
return "/storage/emulated/0/Desktop"
@property
+ def user_projects_dir(self) -> str:
+ """:returns: projects directory tied to the user e.g.
``/storage/emulated/0/Projects``"""
+ return "/storage/emulated/0/Projects"
+
+ @property
+ def user_publicshare_dir(self) -> str:
+ """:returns: public share directory tied to the user e.g.
``/storage/emulated/0/Public``"""
+ return "/storage/emulated/0/Public"
+
+ @property
+ def user_templates_dir(self) -> str:
+ """:returns: templates directory tied to the user e.g.
``/storage/emulated/0/Templates``"""
+ return "/storage/emulated/0/Templates"
+
+ @property
+ def user_fonts_dir(self) -> str:
+ """:returns: fonts directory tied to the user e.g.
``/storage/emulated/0/fonts``"""
+ return "/storage/emulated/0/fonts"
+
+ @property
+ def user_preference_dir(self) -> str:
+ """:returns: preference directory tied to the user, same as
``user_config_dir``"""
+ return self.user_config_dir
+
+ @property
def user_bin_dir(self) -> str:
""":returns: bin directory tied to the user, e.g.
``/data/user/<userid>/<packagename>/files/bin``"""
return os.path.join(cast("str", _android_folder()), "files", "bin") #
noqa: PTH118
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/src/platformdirs/api.py
new/platformdirs-4.10.0/src/platformdirs/api.py
--- old/platformdirs-4.9.6/src/platformdirs/api.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/src/platformdirs/api.py 2020-02-02
01:00:00.000000000 +0100
@@ -210,6 +210,31 @@
@property
@abstractmethod
+ def user_projects_dir(self) -> str:
+ """:returns: projects directory tied to the user"""
+
+ @property
+ @abstractmethod
+ def user_publicshare_dir(self) -> str:
+ """:returns: public share directory tied to the user"""
+
+ @property
+ @abstractmethod
+ def user_templates_dir(self) -> str:
+ """:returns: templates directory tied to the user"""
+
+ @property
+ @abstractmethod
+ def user_fonts_dir(self) -> str:
+ """:returns: fonts directory tied to the user"""
+
+ @property
+ @abstractmethod
+ def user_preference_dir(self) -> str:
+ """:returns: preference directory tied to the user"""
+
+ @property
+ @abstractmethod
def user_bin_dir(self) -> str:
""":returns: bin directory tied to the user"""
@@ -323,6 +348,31 @@
return Path(self.user_desktop_dir)
@property
+ def user_projects_path(self) -> Path:
+ """:returns: projects path tied to the user"""
+ return Path(self.user_projects_dir)
+
+ @property
+ def user_publicshare_path(self) -> Path:
+ """:returns: public share path tied to the user"""
+ return Path(self.user_publicshare_dir)
+
+ @property
+ def user_templates_path(self) -> Path:
+ """:returns: templates path tied to the user"""
+ return Path(self.user_templates_dir)
+
+ @property
+ def user_fonts_path(self) -> Path:
+ """:returns: fonts path tied to the user"""
+ return Path(self.user_fonts_dir)
+
+ @property
+ def user_preference_path(self) -> Path:
+ """:returns: preference path tied to the user"""
+ return Path(self.user_preference_dir)
+
+ @property
def user_bin_path(self) -> Path:
""":returns: bin path tied to the user"""
return Path(self.user_bin_dir)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/src/platformdirs/macos.py
new/platformdirs-4.10.0/src/platformdirs/macos.py
--- old/platformdirs-4.9.6/src/platformdirs/macos.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/src/platformdirs/macos.py 2020-02-02
01:00:00.000000000 +0100
@@ -50,6 +50,11 @@
return self._first_item_as_path_if_multipath(self.site_data_dir)
@property
+ def site_config_path(self) -> Path:
+ """:returns: config 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_config_dir)
+
+ @property
def user_config_dir(self) -> str:
""":returns: config directory tied to the user, same as
`user_data_dir`"""
return self._base_user_app_support_dir()
@@ -130,6 +135,31 @@
return os.path.expanduser("~/Desktop") # noqa: PTH111
@property
+ def user_projects_dir(self) -> str:
+ """:returns: projects directory tied to the user, e.g.
``~/Projects``"""
+ return os.path.expanduser("~/Projects") # noqa: PTH111
+
+ @property
+ def user_publicshare_dir(self) -> str:
+ """:returns: public share directory tied to the user, e.g.
``~/Public``"""
+ return os.path.expanduser("~/Public") # noqa: PTH111 # API returns
str, not Path
+
+ @property
+ def user_templates_dir(self) -> str:
+ """:returns: templates directory tied to the user, e.g.
``~/Templates``"""
+ return os.path.expanduser("~/Templates") # noqa: PTH111 # API
returns str, not Path
+
+ @property
+ def user_fonts_dir(self) -> str:
+ """:returns: fonts directory tied to the user, e.g.
``~/Library/Fonts``"""
+ return os.path.expanduser("~/Library/Fonts") # noqa: PTH111 # API
returns str, not Path
+
+ @property
+ def user_preference_dir(self) -> str:
+ """:returns: preference directory tied to the user, e.g.
``~/Library/Preferences/AppName``"""
+ return
self._append_app_name_and_version(os.path.expanduser("~/Library/Preferences"))
# noqa: PTH111 # API returns str, not Path
+
+ @property
def user_bin_dir(self) -> str:
""":returns: bin directory tied to the user, e.g. ``~/.local/bin``"""
return os.path.expanduser("~/.local/bin") # noqa: PTH111
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/src/platformdirs/unix.py
new/platformdirs-4.10.0/src/platformdirs/unix.py
--- old/platformdirs-4.9.6/src/platformdirs/unix.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/src/platformdirs/unix.py 2020-02-02
01:00:00.000000000 +0100
@@ -124,6 +124,31 @@
return _get_user_media_dir("XDG_DESKTOP_DIR", "~/Desktop")
@property
+ def user_projects_dir(self) -> str:
+ """:returns: projects directory tied to the user, e.g.
``~/Projects``"""
+ return _get_user_media_dir("XDG_PROJECTS_DIR", "~/Projects")
+
+ @property
+ def user_publicshare_dir(self) -> str:
+ """:returns: public share directory tied to the user, e.g.
``~/Public``"""
+ return _get_user_media_dir("XDG_PUBLICSHARE_DIR", "~/Public")
+
+ @property
+ def user_templates_dir(self) -> str:
+ """:returns: templates directory tied to the user, e.g.
``~/Templates``"""
+ return _get_user_media_dir("XDG_TEMPLATES_DIR", "~/Templates")
+
+ @property
+ def user_fonts_dir(self) -> str:
+ """:returns: fonts directory tied to the user, e.g.
``~/.local/share/fonts``"""
+ return f"{os.path.expanduser('~/.local/share')}/fonts" # noqa: PTH111
# API returns str, not Path
+
+ @property
+ def user_preference_dir(self) -> str:
+ """:returns: preference directory tied to the user, same as
``user_config_dir``"""
+ return self.user_config_dir
+
+ @property
def user_bin_dir(self) -> str:
""":returns: bin directory tied to the user, e.g. ``~/.local/bin``"""
return os.path.expanduser("~/.local/bin") # noqa: PTH111
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/src/platformdirs/version.py
new/platformdirs-4.10.0/src/platformdirs/version.py
--- old/platformdirs-4.9.6/src/platformdirs/version.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/src/platformdirs/version.py 2020-02-02
01:00:00.000000000 +0100
@@ -18,7 +18,7 @@
commit_id: str | None
__commit_id__: str | None
-__version__ = version = '4.9.6'
-__version_tuple__ = version_tuple = (4, 9, 6)
+__version__ = version = '4.10.0'
+__version_tuple__ = version_tuple = (4, 10, 0)
__commit_id__ = commit_id = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/src/platformdirs/windows.py
new/platformdirs-4.10.0/src/platformdirs/windows.py
--- old/platformdirs-4.9.6/src/platformdirs/windows.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/src/platformdirs/windows.py 2020-02-02
01:00:00.000000000 +0100
@@ -4,6 +4,7 @@
import os
import sys
+from pathlib import Path
from typing import TYPE_CHECKING, Final
from .api import PlatformDirsABC
@@ -134,6 +135,31 @@
return os.path.normpath(get_win_folder("CSIDL_DESKTOPDIRECTORY"))
@property
+ def user_projects_dir(self) -> str:
+ r""":returns: projects directory tied to the user, e.g.
``%USERPROFILE%\Projects``"""
+ return os.path.normpath(os.path.expanduser("~/Projects")) # noqa:
PTH111
+
+ @property
+ def user_publicshare_dir(self) -> str:
+ r""":returns: public share directory e.g. ``C:\Users\Public``"""
+ return os.path.normpath(os.environ.get("PUBLIC",
str(Path("~").expanduser().parent / "Public")))
+
+ @property
+ def user_templates_dir(self) -> str:
+ r""":returns: templates directory tied to the user e.g.
``%APPDATA%\Microsoft\Windows\Templates``"""
+ return os.path.normpath(str(Path(get_win_folder("CSIDL_APPDATA")) /
"Microsoft" / "Windows" / "Templates"))
+
+ @property
+ def user_fonts_dir(self) -> str:
+ r""":returns: fonts directory tied to the user e.g.
``%LOCALAPPDATA%\Microsoft\Windows\Fonts``"""
+ return
os.path.normpath(str(Path(get_win_folder("CSIDL_LOCAL_APPDATA")) / "Microsoft"
/ "Windows" / "Fonts"))
+
+ @property
+ def user_preference_dir(self) -> str:
+ r""":returns: preference directory tied to the user, same as
``user_config_dir``"""
+ return self.user_config_dir
+
+ @property
def user_bin_dir(self) -> str:
r""":returns: bin directory tied to the user, e.g.
``%LOCALAPPDATA%\Programs``"""
return
os.path.normpath(os.path.join(get_win_folder("CSIDL_LOCAL_APPDATA"),
"Programs")) # noqa: PTH118
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/tests/conftest.py
new/platformdirs-4.10.0/tests/conftest.py
--- old/platformdirs-4.9.6/tests/conftest.py 2020-02-02 01:00:00.000000000
+0100
+++ new/platformdirs-4.10.0/tests/conftest.py 2020-02-02 01:00:00.000000000
+0100
@@ -18,6 +18,11 @@
"user_pictures_dir",
"user_videos_dir",
"user_music_dir",
+ "user_projects_dir",
+ "user_publicshare_dir",
+ "user_templates_dir",
+ "user_fonts_dir",
+ "user_preference_dir",
"user_bin_dir",
"site_bin_dir",
"user_applications_dir",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/tests/test_android.py
new/platformdirs-4.10.0/tests/test_android.py
--- old/platformdirs-4.9.6/tests/test_android.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/tests/test_android.py 2020-02-02
01:00:00.000000000 +0100
@@ -63,6 +63,11 @@
"user_videos_dir": "/storage/emulated/0/DCIM/Camera",
"user_music_dir": "/storage/emulated/0/Music",
"user_desktop_dir": "/storage/emulated/0/Desktop",
+ "user_projects_dir": "/storage/emulated/0/Projects",
+ "user_publicshare_dir": "/storage/emulated/0/Public",
+ "user_templates_dir": "/storage/emulated/0/Templates",
+ "user_fonts_dir": "/storage/emulated/0/fonts",
+ "user_preference_dir": f"/data/data/com.example/shared_prefs{suffix}",
"user_bin_dir": "/data/data/com.example/files/bin",
"site_bin_dir": "/data/data/com.example/files/bin",
"user_applications_dir": f"/data/data/com.example/files{suffix}",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/tests/test_macos.py
new/platformdirs-4.10.0/tests/test_macos.py
--- old/platformdirs-4.9.6/tests/test_macos.py 2020-02-02 01:00:00.000000000
+0100
+++ new/platformdirs-4.10.0/tests/test_macos.py 2020-02-02 01:00:00.000000000
+0100
@@ -83,6 +83,11 @@
"user_videos_dir": f"{home}/Movies",
"user_music_dir": f"{home}/Music",
"user_desktop_dir": f"{home}/Desktop",
+ "user_projects_dir": f"{home}/Projects",
+ "user_publicshare_dir": f"{home}/Public",
+ "user_templates_dir": f"{home}/Templates",
+ "user_fonts_dir": f"{home}/Library/Fonts",
+ "user_preference_dir": f"{home}/Library/Preferences{suffix}",
"user_bin_dir": f"{home}/.local/bin",
"site_bin_dir": "/usr/local/bin",
"user_applications_dir": f"{home}/Applications",
@@ -112,6 +117,7 @@
"site_runtime_dir",
"site_cache_path",
"site_data_path",
+ "site_config_path",
],
)
@pytest.mark.parametrize("multipath", [pytest.param(True, id="multipath"),
pytest.param(False, id="singlepath")])
@@ -143,6 +149,7 @@
expected_path_map = {
"site_cache_path":
Path(f"{prefix['homebrew_prefix']}/var/cache{suffix}"),
"site_data_path":
Path(f"{prefix['homebrew_prefix']}/share{suffix}"),
+ "site_config_path":
Path(f"{prefix['homebrew_prefix']}/share{suffix}"),
}
expected_map = {
"site_data_dir": f"{prefix['homebrew_prefix']}/share{suffix}",
@@ -270,6 +277,11 @@
"user_videos_dir": f"{home}/Movies",
"user_music_dir": f"{home}/Music",
"user_desktop_dir": f"{home}/Desktop",
+ "user_projects_dir": f"{home}/Projects",
+ "user_publicshare_dir": f"{home}/Public",
+ "user_templates_dir": f"{home}/Templates",
+ "user_fonts_dir": f"{home}/Library/Fonts",
+ "user_preference_dir": f"{home}/Library/Preferences",
"user_bin_dir": f"{home}/.local/bin",
"site_bin_dir": "/usr/local/bin",
"user_applications_dir": f"{home}/Applications",
@@ -376,3 +388,33 @@
assert config_value in config_dirs
assert config_value not in data_dirs
assert data_value not in config_dirs
+
+
[email protected]("_clear_xdg_env")
+def test_macos_site_runtime_path(mocker: MockerFixture) -> None:
+ py_version = sys.version_info
+ builtin_py_prefix = (
+
"/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework"
+ f"/Versions/{py_version.major}.{py_version.minor}"
+ )
+ mocker.patch("sys.prefix", builtin_py_prefix)
+ result = MacOS(appname="foo").site_runtime_path
+ home = str(Path("~").expanduser())
+ assert result == Path(f"{home}/Library/Caches/TemporaryItems/foo")
+
+
[email protected]("_clear_xdg_env")
+def test_macos_ensure_exists_preexisting_dir(mocker: MockerFixture, tmp_path:
Path) -> None:
+ py_version = sys.version_info
+ builtin_py_prefix = (
+
"/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework"
+ f"/Versions/{py_version.major}.{py_version.minor}"
+ )
+ mocker.patch("sys.prefix", builtin_py_prefix)
+ mocker.patch("platformdirs.macos.os.path.expanduser", lambda p:
str(tmp_path / p.lstrip("~/")))
+ dirs = MacOS(appname="foo", ensure_exists=True)
+ first = dirs.user_data_dir
+ assert Path(first).exists()
+ # Calling again with an already-existing directory must not raise.
+ second = dirs.user_data_dir
+ assert first == second
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/tests/test_unix.py
new/platformdirs-4.10.0/tests/test_unix.py
--- old/platformdirs-4.9.6/tests/test_unix.py 2020-02-02 01:00:00.000000000
+0100
+++ new/platformdirs-4.10.0/tests/test_unix.py 2020-02-02 01:00:00.000000000
+0100
@@ -33,6 +33,9 @@
"user_videos_dir",
"user_music_dir",
"user_desktop_dir",
+ "user_projects_dir",
+ "user_publicshare_dir",
+ "user_templates_dir",
],
)
def test_user_media_dir(mocker: MockerFixture, prop: str) -> None:
@@ -51,6 +54,9 @@
pytest.param("XDG_VIDEOS_DIR", "user_videos_dir",
id="user_videos_dir"),
pytest.param("XDG_MUSIC_DIR", "user_music_dir", id="user_music_dir"),
pytest.param("XDG_DESKTOP_DIR", "user_desktop_dir",
id="user_desktop_dir"),
+ pytest.param("XDG_PROJECTS_DIR", "user_projects_dir",
id="user_projects_dir"),
+ pytest.param("XDG_PUBLICSHARE_DIR", "user_publicshare_dir",
id="user_publicshare_dir"),
+ pytest.param("XDG_TEMPLATES_DIR", "user_templates_dir",
id="user_templates_dir"),
],
)
def test_user_media_dir_env_var(mocker: MockerFixture, env_var: str, prop:
str) -> None:
@@ -73,6 +79,9 @@
pytest.param("XDG_VIDEOS_DIR", "user_videos_dir",
"/home/example/Videos", id="user_videos_dir"),
pytest.param("XDG_MUSIC_DIR", "user_music_dir", "/home/example/Music",
id="user_music_dir"),
pytest.param("XDG_DESKTOP_DIR", "user_desktop_dir",
"/home/example/Desktop", id="user_desktop_dir"),
+ pytest.param("XDG_PROJECTS_DIR", "user_projects_dir",
"/home/example/Projects", id="user_projects_dir"),
+ pytest.param("XDG_PUBLICSHARE_DIR", "user_publicshare_dir",
"/home/example/Public", id="user_publicshare_dir"),
+ pytest.param("XDG_TEMPLATES_DIR", "user_templates_dir",
"/home/example/Templates", id="user_templates_dir"),
],
)
def test_user_media_dir_default(mocker: MockerFixture, env_var: str, prop:
str, default_abs_path: str) -> None:
@@ -91,6 +100,21 @@
assert getattr(Unix(), prop) == default_abs_path
+def test_user_fonts_dir_default(mocker: MockerFixture) -> None:
+ mocker.patch.dict(os.environ, {"XDG_DATA_HOME": "", "HOME":
"/home/example", "USERPROFILE": "/home/example"})
+ assert Unix().user_fonts_dir == "/home/example/.local/share/fonts"
+
+
+def test_user_fonts_dir_xdg_data_home(mocker: MockerFixture) -> None:
+ mocker.patch.dict(os.environ, {"XDG_DATA_HOME": "/custom/data"})
+ assert Unix().user_fonts_dir == "/custom/data/fonts"
+
+
+def test_user_preference_dir_is_config_dir() -> None:
+ dirs = Unix(appname="MyApp", version="1.0")
+ assert dirs.user_preference_dir == dirs.user_config_dir
+
+
class XDGVariable(typing.NamedTuple):
name: str
default_value: str
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-4.9.6/tests/test_windows.py
new/platformdirs-4.10.0/tests/test_windows.py
--- old/platformdirs-4.9.6/tests/test_windows.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-4.10.0/tests/test_windows.py 2020-02-02
01:00:00.000000000 +0100
@@ -3,7 +3,9 @@
import ctypes
import importlib
import os
+import pathlib
import sys
+from pathlib import Path
from typing import TYPE_CHECKING, Any
from unittest.mock import MagicMock
@@ -90,6 +92,15 @@
"user_videos_dir": os.path.normpath(_WIN_FOLDERS["CSIDL_MYVIDEO"]),
"user_music_dir": os.path.normpath(_WIN_FOLDERS["CSIDL_MYMUSIC"]),
"user_desktop_dir":
os.path.normpath(_WIN_FOLDERS["CSIDL_DESKTOPDIRECTORY"]),
+ "user_projects_dir":
os.path.normpath(pathlib.Path("~/Projects").expanduser()),
+ "user_publicshare_dir": os.path.normpath(
+ os.environ.get("PUBLIC", str(Path("~").expanduser().parent /
"Public"))
+ ),
+ "user_templates_dir": os.path.normpath(
+ str(Path(_WIN_FOLDERS["CSIDL_APPDATA"]) / "Microsoft" / "Windows"
/ "Templates")
+ ),
+ "user_fonts_dir": os.path.normpath(str(Path(_LOCAL) / "Microsoft" /
"Windows" / "Fonts")),
+ "user_preference_dir": local,
"user_bin_dir": os.path.join(_LOCAL, "Programs"), # noqa: PTH118
"site_bin_dir": os.path.join(_COMMON, "bin"), # noqa: PTH118
"user_applications_dir":
os.path.normpath(_WIN_FOLDERS["CSIDL_PROGRAMS"]),
@@ -246,14 +257,14 @@
from platformdirs.windows import get_win_folder_via_ctypes as fresh_fn
# noqa: PLC0415
result = fresh_fn("CSIDL_LOCAL_APPDATA")
-
- assert result == r"C:\Users\Test\AppData\Local"
- mock_shell32.SHGetKnownFolderPath.assert_called_once()
- flags_arg = mock_shell32.SHGetKnownFolderPath.call_args[0][1]
- assert flags_arg == _KF_FLAG_DONT_VERIFY
finally:
_cleanup_ctypes_mocks()
+ assert result == r"C:\Users\Test\AppData\Local"
+ mock_shell32.SHGetKnownFolderPath.assert_called_once()
+ flags_arg = mock_shell32.SHGetKnownFolderPath.call_args[0][1]
+ assert flags_arg == _KF_FLAG_DONT_VERIFY
+
def test_get_win_folder_via_ctypes_unknown_csidl(mocker: MockerFixture) ->
None:
if sys.platform != "win32":