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 2023-06-04 16:41:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-platformdirs (Old)
and /work/SRC/openSUSE:Factory/.python-platformdirs.new.15902 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-platformdirs"
Sun Jun 4 16:41:34 2023 rev:8 rq:1090568 version:3.5.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-platformdirs/python-platformdirs.changes
2023-04-22 22:00:31.537239830 +0200
+++
/work/SRC/openSUSE:Factory/.python-platformdirs.new.15902/python-platformdirs.changes
2023-06-04 16:41:41.869806709 +0200
@@ -1,0 +2,15 @@
+Fri Jun 2 20:55:07 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 3.5.1:
+ * Add 3.12 support
+ * Add tox.ini to sdist
+ * removing Windows versions
+ * Better handling for UNIX support
+ * platformdirs: introduce `user_music_dir()`
+ * platformdirs: introduce `user_videos_dir()`
+ * Adding platformdirs.PlatformDirs to docs
+ * Fix linter failures
+ * Exclude bots from generated release notes
+ * platformdirs: introduce `user_pictures_dir()`
+
+-------------------------------------------------------------------
Old:
----
platformdirs-3.2.0.tar.gz
New:
----
platformdirs-3.5.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-platformdirs.spec ++++++
--- /var/tmp/diff_new_pack.L2JKjH/_old 2023-06-04 16:41:42.485810375 +0200
+++ /var/tmp/diff_new_pack.L2JKjH/_new 2023-06-04 16:41:42.493810423 +0200
@@ -18,7 +18,7 @@
%{?sle15_python_module_pythons}
Name: python-platformdirs
-Version: 3.2.0
+Version: 3.5.1
Release: 0
Summary: Module for determining appropriate platform-specific dirs
License: MIT
++++++ platformdirs-3.2.0.tar.gz -> platformdirs-3.5.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/PKG-INFO
new/platformdirs-3.5.1/PKG-INFO
--- old/platformdirs-3.2.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: platformdirs
-Version: 3.2.0
+Version: 3.5.1
Summary: A small Python package for determining appropriate platform-specific
dirs, e.g. a "user data dir".
Project-URL: Documentation, https://platformdirs.readthedocs.io
Project-URL: Homepage, https://github.com/platformdirs/platformdirs
@@ -15,29 +15,29 @@
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.7
Requires-Dist: typing-extensions>=4.5; python_version < '3.8'
Provides-Extra: docs
-Requires-Dist: furo>=2022.12.7; extra == 'docs'
+Requires-Dist: furo>=2023.3.27; extra == 'docs'
Requires-Dist: proselint>=0.13; extra == 'docs'
-Requires-Dist: sphinx-autodoc-typehints!=1.23.4,>=1.22; extra == 'docs'
-Requires-Dist: sphinx>=6.1.3; extra == 'docs'
+Requires-Dist: sphinx-autodoc-typehints!=1.23.4,>=1.23; extra == 'docs'
+Requires-Dist: sphinx>=6.2.1; extra == 'docs'
Provides-Extra: test
Requires-Dist: appdirs==1.4.4; extra == 'test'
Requires-Dist: covdefaults>=2.3; extra == 'test'
Requires-Dist: pytest-cov>=4; extra == 'test'
Requires-Dist: pytest-mock>=3.10; extra == 'test'
-Requires-Dist: pytest>=7.2.2; extra == 'test'
+Requires-Dist: pytest>=7.3.1; extra == 'test'
Description-Content-Type: text/x-rst
The problem
@@ -54,7 +54,7 @@
~/Library/Application Support/<AppName>
-If on Windows (at least English Win XP) that should be::
+If on Windows (at least English Win) that should be::
C:\Documents and Settings\<User>\Application Data\Local
Settings\<AppAuthor>\<AppName>
@@ -113,7 +113,7 @@
>>> user_runtime_dir(appname, appauthor)
'/Users/trentm/Library/Caches/TemporaryItems/SuperApp'
-On Windows 7:
+On Windows:
.. code-block:: pycon
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/README.rst
new/platformdirs-3.5.1/README.rst
--- old/platformdirs-3.2.0/README.rst 2020-02-02 01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/README.rst 2020-02-02 01:00:00.000000000 +0100
@@ -12,7 +12,7 @@
~/Library/Application Support/<AppName>
-If on Windows (at least English Win XP) that should be::
+If on Windows (at least English Win) that should be::
C:\Documents and Settings\<User>\Application Data\Local
Settings\<AppAuthor>\<AppName>
@@ -71,7 +71,7 @@
>>> user_runtime_dir(appname, appauthor)
'/Users/trentm/Library/Caches/TemporaryItems/SuperApp'
-On Windows 7:
+On Windows:
.. code-block:: pycon
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/pyproject.toml
new/platformdirs-3.5.1/pyproject.toml
--- old/platformdirs-3.2.0/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
+++ new/platformdirs-3.5.1/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
@@ -2,7 +2,7 @@
build-backend = "hatchling.build"
requires = [
"hatch-vcs>=0.3",
- "hatchling>=1.13",
+ "hatchling>=1.14.1",
]
[project]
@@ -31,13 +31,13 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
- "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
@@ -49,15 +49,15 @@
'typing-extensions>=4.5; python_version < "3.8"',
]
optional-dependencies.docs = [
- "furo>=2022.12.7",
+ "furo>=2023.3.27",
"proselint>=0.13",
- "sphinx>=6.1.3",
- "sphinx-autodoc-typehints!=1.23.4,>=1.22",
+ "sphinx>=6.2.1",
+ "sphinx-autodoc-typehints!=1.23.4,>=1.23",
]
optional-dependencies.test = [
"appdirs==1.4.4",
"covdefaults>=2.3",
- "pytest>=7.2.2",
+ "pytest>=7.3.1",
"pytest-cov>=4",
"pytest-mock>=3.10",
]
@@ -68,7 +68,7 @@
[tool.hatch]
build.hooks.vcs.version-file = "src/platformdirs/version.py"
-build.targets.sdist.include = ["/src", "/tests"]
+build.targets.sdist.include = ["/src", "/tests", "/tox.ini"]
version.source = "vcs"
[tool.black]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/src/platformdirs/__init__.py
new/platformdirs-3.5.1/src/platformdirs/__init__.py
--- old/platformdirs-3.2.0/src/platformdirs/__init__.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/src/platformdirs/__init__.py 2020-02-02
01:00:00.000000000 +0100
@@ -243,6 +243,27 @@
return PlatformDirs().user_documents_dir
+def user_pictures_dir() -> str:
+ """
+ :returns: pictures directory tied to the user
+ """
+ return PlatformDirs().user_pictures_dir
+
+
+def user_videos_dir() -> str:
+ """
+ :returns: videos directory tied to the user
+ """
+ return PlatformDirs().user_videos_dir
+
+
+def user_music_dir() -> str:
+ """
+ :returns: music directory tied to the user
+ """
+ return PlatformDirs().user_music_dir
+
+
def user_runtime_dir(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
@@ -466,6 +487,27 @@
return PlatformDirs().user_documents_path
+def user_pictures_path() -> Path:
+ """
+ :returns: pictures path tied to the user
+ """
+ return PlatformDirs().user_pictures_path
+
+
+def user_videos_path() -> Path:
+ """
+ :returns: videos path tied to the user
+ """
+ return PlatformDirs().user_videos_path
+
+
+def user_music_path() -> Path:
+ """
+ :returns: music path tied to the user
+ """
+ return PlatformDirs().user_music_path
+
+
def user_runtime_path(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
@@ -502,6 +544,9 @@
"user_state_dir",
"user_log_dir",
"user_documents_dir",
+ "user_pictures_dir",
+ "user_videos_dir",
+ "user_music_dir",
"user_runtime_dir",
"site_data_dir",
"site_config_dir",
@@ -512,6 +557,9 @@
"user_state_path",
"user_log_path",
"user_documents_path",
+ "user_pictures_path",
+ "user_videos_path",
+ "user_music_path",
"user_runtime_path",
"site_data_path",
"site_config_path",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/src/platformdirs/__main__.py
new/platformdirs-3.5.1/src/platformdirs/__main__.py
--- old/platformdirs-3.2.0/src/platformdirs/__main__.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/src/platformdirs/__main__.py 2020-02-02
01:00:00.000000000 +0100
@@ -9,6 +9,9 @@
"user_state_dir",
"user_log_dir",
"user_documents_dir",
+ "user_pictures_dir",
+ "user_videos_dir",
+ "user_music_dir",
"user_runtime_dir",
"site_data_dir",
"site_config_dir",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/src/platformdirs/android.py
new/platformdirs-3.5.1/src/platformdirs/android.py
--- old/platformdirs-3.2.0/src/platformdirs/android.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/src/platformdirs/android.py 2020-02-02
01:00:00.000000000 +0100
@@ -73,6 +73,27 @@
return _android_documents_folder()
@property
+ def user_pictures_dir(self) -> str:
+ """
+ :return: pictures directory tied to the user e.g.
``/storage/emulated/0/Pictures``
+ """
+ return _android_pictures_folder()
+
+ @property
+ def user_videos_dir(self) -> str:
+ """
+ :return: videos directory tied to the user e.g.
``/storage/emulated/0/DCIM/Camera``
+ """
+ return _android_videos_folder()
+
+ @property
+ def user_music_dir(self) -> str:
+ """
+ :return: music directory tied to the user e.g.
``/storage/emulated/0/Music``
+ """
+ return _android_music_folder()
+
+ @property
def user_runtime_dir(self) -> str:
"""
:return: runtime directory tied to the user, same as `user_cache_dir`
if not opinionated else ``tmp`` in it,
@@ -121,6 +142,54 @@
return documents_dir
+@lru_cache(maxsize=1)
+def _android_pictures_folder() -> str:
+ """:return: pictures folder for the Android OS"""
+ # Get directories with pyjnius
+ try:
+ from jnius import autoclass
+
+ Context = autoclass("android.content.Context") # noqa: N806
+ Environment = autoclass("android.os.Environment") # noqa: N806
+ pictures_dir: str =
Context.getExternalFilesDir(Environment.DIRECTORY_PICTURES).getAbsolutePath()
+ except Exception:
+ pictures_dir = "/storage/emulated/0/Pictures"
+
+ return pictures_dir
+
+
+@lru_cache(maxsize=1)
+def _android_videos_folder() -> str:
+ """:return: videos folder for the Android OS"""
+ # Get directories with pyjnius
+ try:
+ from jnius import autoclass
+
+ Context = autoclass("android.content.Context") # noqa: N806
+ Environment = autoclass("android.os.Environment") # noqa: N806
+ videos_dir: str =
Context.getExternalFilesDir(Environment.DIRECTORY_DCIM).getAbsolutePath()
+ except Exception:
+ videos_dir = "/storage/emulated/0/DCIM/Camera"
+
+ return videos_dir
+
+
+@lru_cache(maxsize=1)
+def _android_music_folder() -> str:
+ """:return: music folder for the Android OS"""
+ # Get directories with pyjnius
+ try:
+ from jnius import autoclass
+
+ Context = autoclass("android.content.Context") # noqa: N806
+ Environment = autoclass("android.os.Environment") # noqa: N806
+ music_dir: str =
Context.getExternalFilesDir(Environment.DIRECTORY_MUSIC).getAbsolutePath()
+ except Exception:
+ music_dir = "/storage/emulated/0/Music"
+
+ return music_dir
+
+
__all__ = [
"Android",
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/src/platformdirs/api.py
new/platformdirs-3.5.1/src/platformdirs/api.py
--- old/platformdirs-3.2.0/src/platformdirs/api.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/src/platformdirs/api.py 2020-02-02
01:00:00.000000000 +0100
@@ -125,6 +125,21 @@
@property
@abstractmethod
+ def user_pictures_dir(self) -> str:
+ """:return: pictures directory tied to the user"""
+
+ @property
+ @abstractmethod
+ def user_videos_dir(self) -> str:
+ """:return: videos directory tied to the user"""
+
+ @property
+ @abstractmethod
+ def user_music_dir(self) -> str:
+ """:return: music directory tied to the user"""
+
+ @property
+ @abstractmethod
def user_runtime_dir(self) -> str:
""":return: runtime directory tied to the user"""
@@ -174,6 +189,21 @@
return Path(self.user_documents_dir)
@property
+ def user_pictures_path(self) -> Path:
+ """:return: pictures path tied to the user"""
+ return Path(self.user_pictures_dir)
+
+ @property
+ def user_videos_path(self) -> Path:
+ """:return: videos path tied to the user"""
+ return Path(self.user_videos_dir)
+
+ @property
+ def user_music_path(self) -> Path:
+ """:return: music path tied to the user"""
+ return Path(self.user_music_dir)
+
+ @property
def user_runtime_path(self) -> Path:
""":return: runtime path tied to the user"""
return Path(self.user_runtime_dir)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/src/platformdirs/macos.py
new/platformdirs-3.5.1/src/platformdirs/macos.py
--- old/platformdirs-3.2.0/src/platformdirs/macos.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/src/platformdirs/macos.py 2020-02-02
01:00:00.000000000 +0100
@@ -60,6 +60,21 @@
return os.path.expanduser("~/Documents")
@property
+ def user_pictures_dir(self) -> str:
+ """:return: pictures directory tied to the user, e.g. ``~/Pictures``"""
+ return os.path.expanduser("~/Pictures")
+
+ @property
+ def user_videos_dir(self) -> str:
+ """:return: videos directory tied to the user, e.g. ``~/Movies``"""
+ return os.path.expanduser("~/Movies")
+
+ @property
+ def user_music_dir(self) -> str:
+ """:return: music directory tied to the user, e.g. ``~/Music``"""
+ return os.path.expanduser("~/Music")
+
+ @property
def user_runtime_dir(self) -> str:
""":return: runtime directory tied to the user, e.g.
``~/Library/Caches/TemporaryItems/$appname/$version``"""
return
self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems"))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/src/platformdirs/unix.py
new/platformdirs-3.5.1/src/platformdirs/unix.py
--- old/platformdirs-3.2.0/src/platformdirs/unix.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/src/platformdirs/unix.py 2020-02-02
01:00:00.000000000 +0100
@@ -7,12 +7,13 @@
from .api import PlatformDirsABC
-if sys.platform.startswith("linux"): # pragma: no branch # no op check, only
to please the type checker
- from os import getuid
-else:
+if sys.platform == "win32":
def getuid() -> int:
- raise RuntimeError("should only be used on Linux")
+ raise RuntimeError("should only be used on Unix")
+
+else:
+ from os import getuid
class Unix(PlatformDirsABC):
@@ -127,13 +128,28 @@
"""
:return: documents directory tied to the user, e.g. ``~/Documents``
"""
- documents_dir = _get_user_dirs_folder("XDG_DOCUMENTS_DIR")
- if documents_dir is None:
- documents_dir = os.environ.get("XDG_DOCUMENTS_DIR", "").strip()
- if not documents_dir:
- documents_dir = os.path.expanduser("~/Documents")
+ return _get_user_media_dir("XDG_DOCUMENTS_DIR", "~/Documents")
- return documents_dir
+ @property
+ def user_pictures_dir(self) -> str:
+ """
+ :return: pictures directory tied to the user, e.g. ``~/Pictures``
+ """
+ return _get_user_media_dir("XDG_PICTURES_DIR", "~/Pictures")
+
+ @property
+ def user_videos_dir(self) -> str:
+ """
+ :return: videos directory tied to the user, e.g. ``~/Videos``
+ """
+ return _get_user_media_dir("XDG_VIDEOS_DIR", "~/Videos")
+
+ @property
+ def user_music_dir(self) -> str:
+ """
+ :return: music directory tied to the user, e.g. ``~/Music``
+ """
+ return _get_user_media_dir("XDG_MUSIC_DIR", "~/Music")
@property
def user_runtime_dir(self) -> str:
@@ -168,6 +184,16 @@
return Path(directory)
+def _get_user_media_dir(env_var: str, fallback_tilde_path: str) -> str:
+ media_dir = _get_user_dirs_folder(env_var)
+ if media_dir is None:
+ media_dir = os.environ.get(env_var, "").strip()
+ if not media_dir:
+ media_dir = os.path.expanduser(fallback_tilde_path)
+
+ return media_dir
+
+
def _get_user_dirs_folder(key: str) -> str | None:
"""Return directory from user-dirs.dirs config file. See
https://freedesktop.org/wiki/Software/xdg-user-dirs/"""
user_dirs_config_path = os.path.join(Unix().user_config_dir,
"user-dirs.dirs")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/src/platformdirs/version.py
new/platformdirs-3.5.1/src/platformdirs/version.py
--- old/platformdirs-3.2.0/src/platformdirs/version.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/src/platformdirs/version.py 2020-02-02
01:00:00.000000000 +0100
@@ -1,4 +1,4 @@
# file generated by setuptools_scm
# don't change, don't track in version control
-__version__ = version = '3.2.0'
-__version_tuple__ = version_tuple = (3, 2, 0)
+__version__ = version = '3.5.1'
+__version_tuple__ = version_tuple = (3, 5, 1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/src/platformdirs/windows.py
new/platformdirs-3.5.1/src/platformdirs/windows.py
--- old/platformdirs-3.2.0/src/platformdirs/windows.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/src/platformdirs/windows.py 2020-02-02
01:00:00.000000000 +0100
@@ -102,6 +102,27 @@
return os.path.normpath(get_win_folder("CSIDL_PERSONAL"))
@property
+ def user_pictures_dir(self) -> str:
+ """
+ :return: pictures directory tied to the user e.g.
``%USERPROFILE%\\Pictures``
+ """
+ return os.path.normpath(get_win_folder("CSIDL_MYPICTURES"))
+
+ @property
+ def user_videos_dir(self) -> str:
+ """
+ :return: videos directory tied to the user e.g.
``%USERPROFILE%\\Videos``
+ """
+ return os.path.normpath(get_win_folder("CSIDL_MYVIDEO"))
+
+ @property
+ def user_music_dir(self) -> str:
+ """
+ :return: music directory tied to the user e.g. ``%USERPROFILE%\\Music``
+ """
+ return os.path.normpath(get_win_folder("CSIDL_MYMUSIC"))
+
+ @property
def user_runtime_dir(self) -> str:
"""
:return: runtime directory tied to the user, e.g.
@@ -113,8 +134,9 @@
def get_win_folder_from_env_vars(csidl_name: str) -> str:
"""Get folder from environment variables."""
- if csidl_name == "CSIDL_PERSONAL": # does not have an environment name
- return os.path.join(os.path.normpath(os.environ["USERPROFILE"]),
"Documents")
+ result = get_win_folder_if_csidl_name_not_env_var(csidl_name)
+ if result is not None:
+ return result
env_var_name = {
"CSIDL_APPDATA": "APPDATA",
@@ -129,6 +151,22 @@
return result
+def get_win_folder_if_csidl_name_not_env_var(csidl_name: str) -> str | None:
+ """Get folder for a CSIDL name that does not exist as an environment
variable."""
+ if csidl_name == "CSIDL_PERSONAL":
+ return os.path.join(os.path.normpath(os.environ["USERPROFILE"]),
"Documents")
+
+ if csidl_name == "CSIDL_MYPICTURES":
+ return os.path.join(os.path.normpath(os.environ["USERPROFILE"]),
"Pictures")
+
+ if csidl_name == "CSIDL_MYVIDEO":
+ return os.path.join(os.path.normpath(os.environ["USERPROFILE"]),
"Videos")
+
+ if csidl_name == "CSIDL_MYMUSIC":
+ return os.path.join(os.path.normpath(os.environ["USERPROFILE"]),
"Music")
+ return None
+
+
def get_win_folder_from_registry(csidl_name: str) -> str:
"""Get folder from the registry.
@@ -141,6 +179,9 @@
"CSIDL_COMMON_APPDATA": "Common AppData",
"CSIDL_LOCAL_APPDATA": "Local AppData",
"CSIDL_PERSONAL": "Personal",
+ "CSIDL_MYPICTURES": "My Pictures",
+ "CSIDL_MYVIDEO": "My Video",
+ "CSIDL_MYMUSIC": "My Music",
}.get(csidl_name)
if shell_folder_name is None:
raise ValueError(f"Unknown CSIDL name: {csidl_name}")
@@ -160,6 +201,9 @@
"CSIDL_COMMON_APPDATA": 35,
"CSIDL_LOCAL_APPDATA": 28,
"CSIDL_PERSONAL": 5,
+ "CSIDL_MYPICTURES": 39,
+ "CSIDL_MYVIDEO": 14,
+ "CSIDL_MYMUSIC": 13,
}.get(csidl_name)
if csidl_const is None:
raise ValueError(f"Unknown CSIDL name: {csidl_name}")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/tests/conftest.py
new/platformdirs-3.5.1/tests/conftest.py
--- old/platformdirs-3.2.0/tests/conftest.py 2020-02-02 01:00:00.000000000
+0100
+++ new/platformdirs-3.5.1/tests/conftest.py 2020-02-02 01:00:00.000000000
+0100
@@ -12,6 +12,9 @@
"user_state_dir",
"user_log_dir",
"user_documents_dir",
+ "user_pictures_dir",
+ "user_videos_dir",
+ "user_music_dir",
"user_runtime_dir",
"site_data_dir",
"site_config_dir",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/tests/test_android.py
new/platformdirs-3.5.1/tests/test_android.py
--- old/platformdirs-3.2.0/tests/test_android.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/tests/test_android.py 2020-02-02
01:00:00.000000000 +0100
@@ -52,6 +52,9 @@
"user_state_dir": f"/data/data/com.example/files{suffix}",
"user_log_dir": f"/data/data/com.example/cache{suffix}{'' if
params.get('opinion', True) is False else '/log'}",
"user_documents_dir": "/storage/emulated/0/Documents",
+ "user_pictures_dir": "/storage/emulated/0/Pictures",
+ "user_videos_dir": "/storage/emulated/0/DCIM/Camera",
+ "user_music_dir": "/storage/emulated/0/Music",
"user_runtime_dir": f"/data/data/com.example/cache{suffix}{'' if not
params.get('opinion', True) else '/tmp'}",
}
expected = expected_map[func]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/tests/test_comp_with_appdirs.py
new/platformdirs-3.5.1/tests/test_comp_with_appdirs.py
--- old/platformdirs-3.2.0/tests/test_comp_with_appdirs.py 2020-02-02
01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/tests/test_comp_with_appdirs.py 2020-02-02
01:00:00.000000000 +0100
@@ -60,12 +60,12 @@
}
if func in msg: # pragma: no cover
pytest.skip(f"`appdirs.{func}` {msg[func]} on macOS") # pragma:
no cover
- if sys.platform == "linux":
+ elif sys.platform != "win32":
msg = { # pragma: no cover
"user_log_dir": "Uses XDG_STATE_DIR instead of
appdirs.user_data_dir per the XDG spec",
}
if func in msg: # pragma: no cover
- pytest.skip(f"`appdirs.{func}` {msg[func]} on Linux") # pragma:
no cover
+ pytest.skip(f"`appdirs.{func}` {msg[func]} on Unix") # pragma: no
cover
new = getattr(platformdirs, func)(*params)
old = getattr(appdirs, func)(*params)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/tests/test_macos.py
new/platformdirs-3.5.1/tests/test_macos.py
--- old/platformdirs-3.2.0/tests/test_macos.py 2020-02-02 01:00:00.000000000
+0100
+++ new/platformdirs-3.5.1/tests/test_macos.py 2020-02-02 01:00:00.000000000
+0100
@@ -33,6 +33,9 @@
"user_state_dir": f"{home}/Library/Application Support{suffix}",
"user_log_dir": f"{home}/Library/Logs{suffix}",
"user_documents_dir": f"{home}/Documents",
+ "user_pictures_dir": f"{home}/Pictures",
+ "user_videos_dir": f"{home}/Movies",
+ "user_music_dir": f"{home}/Music",
"user_runtime_dir": f"{home}/Library/Caches/TemporaryItems{suffix}",
}
expected = expected_map[func]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/tests/test_unix.py
new/platformdirs-3.5.1/tests/test_unix.py
--- old/platformdirs-3.2.0/tests/test_unix.py 2020-02-02 01:00:00.000000000
+0100
+++ new/platformdirs-3.5.1/tests/test_unix.py 2020-02-02 01:00:00.000000000
+0100
@@ -10,41 +10,61 @@
from _pytest.monkeypatch import MonkeyPatch
from pytest_mock import MockerFixture
+from platformdirs import unix
from platformdirs.unix import Unix
-def test_user_documents_dir(mocker: MockerFixture) -> None:
- example_path = "/home/example/ExampleDocumentsFolder"
[email protected]("prop", ["user_documents_dir", "user_pictures_dir",
"user_videos_dir", "user_music_dir"])
+def test_user_media_dir(mocker: MockerFixture, prop: str) -> None:
+ example_path = "/home/example/ExampleMediaFolder"
mock = mocker.patch("platformdirs.unix._get_user_dirs_folder")
mock.return_value = example_path
- assert Unix().user_documents_dir == example_path
+ assert getattr(Unix(), prop) == example_path
-def test_user_documents_dir_env_var(mocker: MockerFixture) -> None:
- # Mock documents dir not being in user-dirs.dirs file
[email protected](
+ ("env_var", "prop"),
+ [
+ pytest.param("XDG_DOCUMENTS_DIR", "user_documents_dir",
id="user_documents_dir"),
+ pytest.param("XDG_PICTURES_DIR", "user_pictures_dir",
id="user_pictures_dir"),
+ pytest.param("XDG_VIDEOS_DIR", "user_videos_dir",
id="user_videos_dir"),
+ pytest.param("XDG_MUSIC_DIR", "user_music_dir", id="user_music_dir"),
+ ],
+)
+def test_user_media_dir_env_var(mocker: MockerFixture, env_var: str, prop:
str) -> None:
+ # Mock media dir not being in user-dirs.dirs file
mock = mocker.patch("platformdirs.unix._get_user_dirs_folder")
mock.return_value = None
- example_path = "/home/example/ExampleDocumentsFolder"
- mocker.patch.dict(os.environ, {"XDG_DOCUMENTS_DIR": example_path})
+ example_path = "/home/example/ExampleMediaFolder"
+ mocker.patch.dict(os.environ, {env_var: example_path})
- assert Unix().user_documents_dir == example_path
+ assert getattr(Unix(), prop) == example_path
-def test_user_documents_dir_default(mocker: MockerFixture) -> None:
- # Mock documents dir not being in user-dirs.dirs file
[email protected](
+ ("env_var", "prop", "default_abs_path"),
+ [
+ pytest.param("XDG_DOCUMENTS_DIR", "user_documents_dir",
"/home/example/Documents", id="user_documents_dir"),
+ pytest.param("XDG_PICTURES_DIR", "user_pictures_dir",
"/home/example/Pictures", id="user_pictures_dir"),
+ 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"),
+ ],
+)
+def test_user_media_dir_default(mocker: MockerFixture, env_var: str, prop:
str, default_abs_path: str) -> None:
+ # Mock media dir not being in user-dirs.dirs file
mock = mocker.patch("platformdirs.unix._get_user_dirs_folder")
mock.return_value = None
- # Mock no XDG_DOCUMENTS_DIR env variable being set
- mocker.patch.dict(os.environ, {"XDG_DOCUMENTS_DIR": ""})
+ # Mock no XDG env variable being set
+ mocker.patch.dict(os.environ, {env_var: ""})
# Mock home directory
mocker.patch.dict(os.environ, {"HOME": "/home/example"})
# Mock home directory for running the test on Windows
mocker.patch.dict(os.environ, {"USERPROFILE": "/home/example"})
- assert Unix().user_documents_dir == "/home/example/Documents"
+ assert getattr(Unix(), prop) == default_abs_path
class XDGVariable(typing.NamedTuple):
@@ -109,18 +129,16 @@
assert result == "/tmp/custom-dir"
-def test_platform_non_linux(monkeypatch: MonkeyPatch) -> None:
- from platformdirs import unix
-
+def test_platform_on_win32(monkeypatch: MonkeyPatch, mocker: MockerFixture) ->
None:
+ monkeypatch.delenv("XDG_RUNTIME_DIR", raising=False)
+ mocker.patch("sys.platform", "win32")
+ prev_unix = unix
+ importlib.reload(unix)
try:
- with monkeypatch.context() as context:
- context.setattr(sys, "platform", "magic")
- monkeypatch.delenv("XDG_RUNTIME_DIR", raising=False)
- importlib.reload(unix)
- with pytest.raises(RuntimeError, match="should only be used on Linux"):
+ with pytest.raises(RuntimeError, match="should only be used on Unix"):
unix.Unix().user_runtime_dir
finally:
- importlib.reload(unix)
+ sys.modules["platformdirs.unix"] = prev_unix
def test_ensure_exists_creates_folder(mocker: MockerFixture, tmp_path: Path)
-> None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/platformdirs-3.2.0/tox.ini
new/platformdirs-3.5.1/tox.ini
--- old/platformdirs-3.2.0/tox.ini 1970-01-01 01:00:00.000000000 +0100
+++ new/platformdirs-3.5.1/tox.ini 2020-02-02 01:00:00.000000000 +0100
@@ -0,0 +1,117 @@
+[tox]
+requires =
+ tox>=4.2
+env_list =
+ fix
+ py312
+ py311
+ py310
+ py39
+ py38
+ py37
+ pypy3
+ type
+ coverage
+ readme
+ docs
+skip_missing_interpreters = true
+
+[testenv]
+description = run the unit tests with pytest under {basepython}
+package = wheel
+wheel_build_env = .pkg
+extras =
+ test
+pass_env =
+ ANDROID_DATA
+ ANDROID_ROOT
+set_env =
+ COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
+ COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml
+ _COVERAGE_SRC = {envsitepackagesdir}/platformdirs
+commands =
+ pytest {tty:--color=yes} {posargs: \
+ --junitxml {toxworkdir}{/}junit.{envname}.xml --cov
{envsitepackagesdir}{/}platformdirs \
+ --cov {toxinidir}{/}tests \
+ --cov-config=pyproject.toml --no-cov-on-fail --cov-report
term-missing:skip-covered --cov-context=test \
+ --cov-report html:{envtmpdir}{/}htmlcov --cov-report
xml:{toxworkdir}{/}coverage.{envname}.xml \
+ tests}
+
+[testenv:fix]
+description = run static analysis and style check using flake8
+skip_install = true
+deps =
+ pre-commit>=3.3.1
+pass_env =
+ HOMEPATH
+ PROGRAMDATA
+commands =
+ pre-commit run --all-files --show-diff-on-failure
+
+[testenv:type]
+description = run type check on code base
+deps =
+ mypy==1.2
+set_env =
+ {tty:MYPY_FORCE_COLOR = 1}
+commands =
+ mypy --strict src
+ mypy --strict tests
+
+[testenv:coverage]
+description = combine coverage files and generate diff (against DIFF_AGAINST
defaulting to origin/main)
+skip_install = true
+deps =
+ covdefaults>=2.3
+ coverage[toml]>=7.2.5
+ diff-cover>=7.5
+extras =
+parallel_show_output = true
+pass_env =
+ DIFF_AGAINST
+set_env =
+ COVERAGE_FILE = {toxworkdir}/.coverage
+commands =
+ coverage combine
+ coverage report --skip-covered --show-missing
+ coverage xml -o {toxworkdir}/coverage.xml
+ coverage html -d {toxworkdir}/htmlcov
+ diff-cover --compare-branch {env:DIFF_AGAINST:origin/main}
{toxworkdir}/coverage.xml
+depends =
+ py311
+ py310
+ py39
+ py38
+ py37
+ pypy3
+
+[testenv:readme]
+description = check that the long description is valid
+skip_install = true
+deps =
+ build[virtualenv]>=0.10
+ twine>=4.0.2
+pass_env =
+ *
+change_dir = {toxinidir}
+commands =
+ python -m build -o {envtmpdir} .
+ twine check {envtmpdir}/*
+
+[testenv:docs]
+base_python = 3.10
+extras =
+ docs
+commands =
+ python -c 'import glob; import subprocess; subprocess.call(["proselint"] +
glob.glob("docs/*.rst"))'
+ sphinx-build -d "{envtmpdir}/doctree" docs "{toxworkdir}/docs_out" --color
-b html {posargs}
+ python -c 'import pathlib; print("documentation available under
\{0\}".format((pathlib.Path(r"{toxworkdir}") / "docs_out" /
"index.html").as_uri()))'
+
+[testenv:dev]
+description = generate a DEV environment
+package = editable
+extras =
+ test
+commands =
+ python -m pip list --format=columns
+ python -c 'import sys; print(sys.executable)'