Hello community, here is the log from the commit of package python-xdg for openSUSE:Factory checked in at 2020-11-12 22:37:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-xdg (Old) and /work/SRC/openSUSE:Factory/.python-xdg.new.24930 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-xdg" Thu Nov 12 22:37:08 2020 rev:2 rq:847009 version:5.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-xdg/python-xdg.changes 2020-09-15 16:26:27.622491678 +0200 +++ /work/SRC/openSUSE:Factory/.python-xdg.new.24930/python-xdg.changes 2020-11-12 22:37:37.178030799 +0100 @@ -1,0 +2,6 @@ +Mon Nov 9 04:44:33 UTC 2020 - Steve Kowalik <[email protected]> + +- Update to 5.0.0: + * No upstream changelog + +------------------------------------------------------------------- Old: ---- xdg-4.0.1.tar.gz New: ---- xdg-5.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-xdg.spec ++++++ --- /var/tmp/diff_new_pack.NFayIO/_old 2020-11-12 22:37:40.810034591 +0100 +++ /var/tmp/diff_new_pack.NFayIO/_new 2020-11-12 22:37:40.814034595 +0100 @@ -18,11 +18,10 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-xdg -Version: 4.0.1 +Version: 5.0.0 Release: 0 Summary: Variables defined by the XDG Base Directory Specification License: ISC -Group: Development/Languages/Python URL: https://github.com/srstevenson/xdg Source: https://files.pythonhosted.org/packages/source/x/xdg/xdg-%{version}.tar.gz Source1: https://raw.githubusercontent.com/srstevenson/xdg/master/test/test_xdg.py ++++++ test_xdg.py ++++++ --- /var/tmp/diff_new_pack.NFayIO/_old 2020-11-12 22:37:40.850034633 +0100 +++ /var/tmp/diff_new_pack.NFayIO/_new 2020-11-12 22:37:40.854034637 +0100 @@ -1,214 +1,130 @@ """Test suite for xdg.""" import os -import sys from pathlib import Path -from typing import TYPE_CHECKING, Callable -import pytest # pylint: disable=import-error +from _pytest.monkeypatch import MonkeyPatch -# pylint: disable=import-error,unused-import -if TYPE_CHECKING: - from _pytest.monkeypatch import MonkeyPatch # noqa -# pylint: enable=import-error,unused-import +import xdg HOME_DIR = Path("/homedir") [email protected] # type: ignore -def unimport() -> None: - """Ensure xdg is absent from sys.modules.""" - try: - del sys.modules["xdg"] - except KeyError: - pass +def test_xdg_cache_home_unset(monkeypatch: MonkeyPatch) -> None: + """Test xdg_cache_home when XDG_CACHE_HOME is unset.""" + monkeypatch.delenv("XDG_CACHE_HOME", raising=False) + monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) + assert xdg.xdg_cache_home() == HOME_DIR / ".cache" -# pylint: disable=import-outside-toplevel,no-self-use,redefined-outer-name -# pylint: disable=unused-argument +def test_xdg_cache_home_empty(monkeypatch: MonkeyPatch) -> None: + """Test xdg_cache_home when XDG_CACHE_HOME is empty.""" + monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) + monkeypatch.setenv("XDG_CACHE_HOME", "") + assert xdg.xdg_cache_home() == HOME_DIR / ".cache" -class TestXdgCacheHome: - """Tests for XDG_CACHE_HOME.""" +def test_xdg_cache_home_set(monkeypatch: MonkeyPatch) -> None: + """Test xdg_cache_home when XDG_CACHE_HOME is set.""" + monkeypatch.setenv("XDG_CACHE_HOME", "/xdg_cache_home") + assert xdg.xdg_cache_home() == Path("/xdg_cache_home") - def test_unset( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_CACHE_HOME is unset.""" - monkeypatch.delenv("XDG_CACHE_HOME", raising=False) - monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) - from xdg import XDG_CACHE_HOME - assert XDG_CACHE_HOME == HOME_DIR / ".cache" +def test_xdg_config_dirs_unset(monkeypatch: MonkeyPatch) -> None: + """Test xdg_config_dirs when XDG_CONFIG_DIRS is unset.""" + monkeypatch.delenv("XDG_CONFIG_DIRS", raising=False) + assert xdg.xdg_config_dirs() == [Path("/etc/xdg")] - def test_empty( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_CACHE_HOME is empty.""" - monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) - monkeypatch.setenv("XDG_CACHE_HOME", "") - from xdg import XDG_CACHE_HOME - assert XDG_CACHE_HOME == HOME_DIR / ".cache" +def test_xdg_config_dirs_empty(monkeypatch: MonkeyPatch) -> None: + """Test xdg_config_dirs when XDG_CONFIG_DIRS is empty.""" + monkeypatch.setenv("XDG_CONFIG_DIRS", "") + assert xdg.xdg_config_dirs() == [Path("/etc/xdg")] - def test_set(self, monkeypatch: "MonkeyPatch", unimport: Callable) -> None: - """Test when XDG_CACHE_HOME is set.""" - monkeypatch.setenv("XDG_CACHE_HOME", "/xdg_cache_home") - from xdg import XDG_CACHE_HOME - assert XDG_CACHE_HOME == Path("/xdg_cache_home") +def test_xdg_config_dirs_set(monkeypatch: MonkeyPatch) -> None: + """Test xdg_config_dirs when XDG_CONFIG_DIRS is set.""" + monkeypatch.setenv("XDG_CONFIG_DIRS", "/first:/sec/ond") + assert xdg.xdg_config_dirs() == [Path("/first"), Path("/sec/ond")] -class TestXdgConfigDirs: - """Tests for XDG_CONFIG_DIRS.""" +def test_xdg_config_home_unset(monkeypatch: MonkeyPatch) -> None: + """Test xdg_config_home when XDG_CONFIG_HOME is unset.""" + monkeypatch.delenv("XDG_CONFIG_HOME", raising=False) + monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) + assert xdg.xdg_config_home() == HOME_DIR / ".config" - def test_unset( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_CONFIG_DIRS is unset.""" - monkeypatch.delenv("XDG_CONFIG_DIRS", raising=False) - from xdg import XDG_CONFIG_DIRS - assert XDG_CONFIG_DIRS == [Path("/etc/xdg")] +def test_xdg_config_home_empty(monkeypatch: MonkeyPatch) -> None: + """Test xdg_config_home when XDG_CONFIG_HOME is empty.""" + monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) + monkeypatch.setenv("XDG_CONFIG_HOME", "") + assert xdg.xdg_config_home() == HOME_DIR / ".config" - def test_empty( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_CONFIG_DIRS is empty.""" - monkeypatch.setenv("XDG_CONFIG_DIRS", "") - from xdg import XDG_CONFIG_DIRS - assert XDG_CONFIG_DIRS == [Path("/etc/xdg")] +def test_xdg_config_home_set(monkeypatch: MonkeyPatch) -> None: + """Test xdg_config_home when XDG_CONFIG_HOME is set.""" + monkeypatch.setenv("XDG_CONFIG_HOME", "/xdg_config_home") + assert xdg.xdg_config_home() == Path("/xdg_config_home") - def test_set(self, monkeypatch: "MonkeyPatch", unimport: Callable) -> None: - """Test when XDG_CONFIG_DIRS is set.""" - monkeypatch.setenv("XDG_CONFIG_DIRS", "/first:/sec/ond") - from xdg import XDG_CONFIG_DIRS - assert XDG_CONFIG_DIRS == [Path("/first"), Path("/sec/ond")] +def test_xdg_data_dirs_unset(monkeypatch: MonkeyPatch) -> None: + """Test xdg_data_dirs when XDG_DATA_DIRS is unset.""" + monkeypatch.delenv("XDG_DATA_DIRS", raising=False) + assert xdg.xdg_data_dirs() == [ + Path("/usr/local/share/"), + Path("/usr/share/"), + ] -class TestXdgConfigHome: - """Tests for XDG_CONFIG_HOME.""" +def test_xdg_data_dirs_empty(monkeypatch: MonkeyPatch) -> None: + """Test xdg_data_dirs when XDG_DATA_DIRS is empty.""" + monkeypatch.setenv("XDG_DATA_DIRS", "") + assert xdg.xdg_data_dirs() == [ + Path("/usr/local/share/"), + Path("/usr/share/"), + ] - def test_unset( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_CONFIG_HOME is unset.""" - monkeypatch.delenv("XDG_CONFIG_HOME", raising=False) - monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) - from xdg import XDG_CONFIG_HOME - assert XDG_CONFIG_HOME == HOME_DIR / ".config" +def test_xdg_data_dirs_set(monkeypatch: MonkeyPatch) -> None: + """Test xdg_data_dirs when XDG_DATA_DIRS is set.""" + monkeypatch.setenv("XDG_DATA_DIRS", "/first/:/sec/ond/") + assert xdg.xdg_data_dirs() == [Path("/first/"), Path("/sec/ond/")] - def test_empty( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_CONFIG_HOME is empty.""" - monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) - monkeypatch.setenv("XDG_CONFIG_HOME", "") - from xdg import XDG_CONFIG_HOME - assert XDG_CONFIG_HOME == HOME_DIR / ".config" +def test_xdg_data_home_unset(monkeypatch: MonkeyPatch) -> None: + """Test xdg_data_home when XDG_DATA_HOME is unset.""" + monkeypatch.delenv("XDG_DATA_HOME", raising=False) + monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) + assert xdg.xdg_data_home() == HOME_DIR / ".local" / "share" - def test_set(self, monkeypatch: "MonkeyPatch", unimport: Callable) -> None: - """Test when XDG_CONFIG_HOME is set.""" - monkeypatch.setenv("XDG_CONFIG_HOME", "/xdg_config_home") - from xdg import XDG_CONFIG_HOME - assert XDG_CONFIG_HOME == Path("/xdg_config_home") +def test_xdg_data_home_empty(monkeypatch: MonkeyPatch) -> None: + """Test xdg_data_home when XDG_DATA_HOME is empty.""" + monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) + monkeypatch.setenv("XDG_DATA_HOME", "") + assert xdg.xdg_data_home() == HOME_DIR / ".local" / "share" -class TestXdgDataDirs: - """Tests for XDG_DATA_DIRS.""" +def test_xdg_data_home_set(monkeypatch: MonkeyPatch) -> None: + """Test xdg_data_home when XDG_DATA_HOME is set.""" + monkeypatch.setenv("XDG_DATA_HOME", "/xdg_data_home") + assert xdg.xdg_data_home() == Path("/xdg_data_home") - def test_unset( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_DATA_DIRS is unset.""" - monkeypatch.delenv("XDG_DATA_DIRS", raising=False) - from xdg import XDG_DATA_DIRS - assert XDG_DATA_DIRS == [ - Path("/usr/local/share/"), - Path("/usr/share/"), - ] +def test_xdg_runtime_dir_unset(monkeypatch: MonkeyPatch) -> None: + """Test xdg_runtime_dir when XDG_RUNTIME_DIR is unset.""" + monkeypatch.delenv("XDG_RUNTIME_DIR", raising=False) + assert xdg.xdg_runtime_dir() is None - def test_empty( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_DATA_DIRS is empty.""" - monkeypatch.setenv("XDG_DATA_DIRS", "") - from xdg import XDG_DATA_DIRS - assert XDG_DATA_DIRS == [ - Path("/usr/local/share/"), - Path("/usr/share/"), - ] +def test_xdg_runtime_dir_empty(monkeypatch: MonkeyPatch) -> None: + """Test xdg_runtime_dir when XDG_RUNTIME_DIR is empty.""" + monkeypatch.setenv("XDG_RUNTIME_DIR", "") + assert xdg.xdg_runtime_dir() == Path("") - def test_set(self, monkeypatch: "MonkeyPatch", unimport: Callable) -> None: - """Test when XDG_DATA_DIRS is set.""" - monkeypatch.setenv("XDG_DATA_DIRS", "/first/:/sec/ond/") - from xdg import XDG_DATA_DIRS - assert XDG_DATA_DIRS == [Path("/first/"), Path("/sec/ond/")] - - -class TestXdgDataHome: - """Tests for XDG_DATA_HOME.""" - - def test_unset( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_DATA_HOME is unset.""" - monkeypatch.delenv("XDG_DATA_HOME", raising=False) - monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) - from xdg import XDG_DATA_HOME - - assert XDG_DATA_HOME == HOME_DIR / ".local" / "share" - - def test_empty( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_DATA_HOME is empty.""" - monkeypatch.setenv("HOME", os.fspath(HOME_DIR)) - monkeypatch.setenv("XDG_DATA_HOME", "") - from xdg import XDG_DATA_HOME - - assert XDG_DATA_HOME == HOME_DIR / ".local" / "share" - - def test_set(self, monkeypatch: "MonkeyPatch", unimport: Callable) -> None: - """Test when XDG_DATA_HOME is set.""" - monkeypatch.setenv("XDG_DATA_HOME", "/xdg_data_home") - from xdg import XDG_DATA_HOME - - assert XDG_DATA_HOME == Path("/xdg_data_home") - - -class TestXdgRuntimeDir: - """Tests for XDG_RUNTIME_DIR.""" - - def test_unset( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_RUNTIME_DIR is unset.""" - monkeypatch.delenv("XDG_RUNTIME_DIR", raising=False) - from xdg import XDG_RUNTIME_DIR - - assert XDG_RUNTIME_DIR is None - - def test_empty( - self, monkeypatch: "MonkeyPatch", unimport: Callable - ) -> None: - """Test when XDG_RUNTIME_DIR is empty.""" - monkeypatch.setenv("XDG_RUNTIME_DIR", "") - from xdg import XDG_RUNTIME_DIR - - assert XDG_RUNTIME_DIR == Path("") - - def test_set(self, monkeypatch: "MonkeyPatch", unimport: Callable) -> None: - """Test when XDG_RUNTIME_DIR is set.""" - monkeypatch.setenv("XDG_RUNTIME_DIR", "/xdg_runtime_dir") - from xdg import XDG_RUNTIME_DIR - - assert XDG_RUNTIME_DIR == Path("/xdg_runtime_dir") +def test_xdg_runtime_dir_set(monkeypatch: MonkeyPatch) -> None: + """Test xdg_runtime_dir when XDG_RUNTIME_DIR is set.""" + monkeypatch.setenv("XDG_RUNTIME_DIR", "/xdg_runtime_dir") + assert xdg.xdg_runtime_dir() == Path("/xdg_runtime_dir") ++++++ xdg-4.0.1.tar.gz -> xdg-5.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-4.0.1/LICENCE new/xdg-5.0.0/LICENCE --- old/xdg-4.0.1/LICENCE 2019-07-21 22:06:41.430503400 +0200 +++ new/xdg-5.0.0/LICENCE 2020-10-29 17:01:31.360000000 +0100 @@ -1,4 +1,4 @@ -Copyright © 2016-2019 Scott Stevenson <[email protected]> +Copyright © 2016-2020 Scott Stevenson <[email protected]> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-4.0.1/PKG-INFO new/xdg-5.0.0/PKG-INFO --- old/xdg-4.0.1/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/xdg-5.0.0/PKG-INFO 2020-10-29 17:06:57.495794500 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: xdg -Version: 4.0.1 +Version: 5.0.0 Summary: Variables defined by the XDG Base Directory Specification Home-page: https://github.com/srstevenson/xdg License: ISC @@ -17,22 +17,25 @@ Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Project-URL: Repository, https://github.com/srstevenson/xdg Description-Content-Type: text/markdown # xdg -`xdg` is a tiny Python module which provides the variables defined by the [XDG -Base Directory Specification][spec], to save you from duplicating the same -snippet of logic in every Python utility you write that deals with user cache, -configuration, or data files. It has no external dependencies. +`xdg` is a Python module which provides functions to return paths to the +directories defined by the [XDG Base Directory Specification][spec], to save you +from duplicating the same snippet of logic in every Python utility you write +that deals with user cache, configuration, or data files. It has no external +dependencies. ## Installation To install the latest release from [PyPI], use [pip]: ```bash -pip install xdg +python -m pip install xdg ``` In Python projects using [Poetry] or [Pipenv] for dependency management, add @@ -43,27 +46,34 @@ ## Usage ```python -from xdg import (XDG_CACHE_HOME, XDG_CONFIG_DIRS, XDG_CONFIG_HOME, - XDG_DATA_DIRS, XDG_DATA_HOME, XDG_RUNTIME_DIR) +from xdg import ( + xdg_cache_home, + xdg_config_dirs, + xdg_config_home, + xdg_data_dirs, + xdg_data_home, + xdg_runtime_dir, +) ``` -`XDG_CACHE_HOME`, `XDG_CONFIG_HOME`, and `XDG_DATA_HOME` are [`pathlib.Path` -objects][path] containing the value of the environment variable of the same -name, or the default defined in the specification if the environment variable is -unset or empty. - -`XDG_CONFIG_DIRS` and `XDG_DATA_DIRS` are lists of `pathlib.Path` objects -containing the value of the environment variable of the same name split on -colons, or the default defined in the specification if the environment variable -is unset or empty. - -`XDG_RUNTIME_DIR` is a `pathlib.Path` object containing the value of the -environment variable of the same name, or `None` if the environment variable is -unset. +`xdg_cache_home()`, `xdg_config_home()`, and `xdg_data_home()` return +[`pathlib.Path` objects][path] containing the value of the environment variable +named `XDG_CACHE_HOME`, `XDG_CONFIG_HOME`, and `XDG_DATA_HOME` respectively, or +the default defined in the specification if the environment variable is unset or +empty. + +`xdg_config_dirs()` and `xdg_data_dirs()` return a list of `pathlib.Path` +objects containing the value, split on colons, of the environment variable named +`XDG_CONFIG_DIRS` and `XDG_DATA_DIRS` respectively, or the default defined in +the specification if the environment variable is unset or empty. + +`xdg_runtime_dir()` returns a `pathlib.Path` object containing the value of the +`XDG_RUNTIME_DIR` environment variable, or `None` if the environment variable is +not set. ## Copyright -Copyright © 2016-2019 [Scott Stevenson]. +Copyright © 2016-2020 [Scott Stevenson]. `xdg` is distributed under the terms of the [ISC licence]. @@ -71,7 +81,7 @@ [path]: https://docs.python.org/3/library/pathlib.html#pathlib.Path [pip]: https://pip.pypa.io/en/stable/ [pipenv]: https://docs.pipenv.org/ -[poetry]: https://poetry.eustace.io/ +[poetry]: https://python-poetry.org/ [pypi]: https://pypi.org/project/xdg/ [scott stevenson]: https://scott.stevenson.io [spec]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-4.0.1/README.md new/xdg-5.0.0/README.md --- old/xdg-4.0.1/README.md 2019-07-21 22:19:48.863453000 +0200 +++ new/xdg-5.0.0/README.md 2020-10-29 17:04:33.145000000 +0100 @@ -1,16 +1,17 @@ # xdg -`xdg` is a tiny Python module which provides the variables defined by the [XDG -Base Directory Specification][spec], to save you from duplicating the same -snippet of logic in every Python utility you write that deals with user cache, -configuration, or data files. It has no external dependencies. +`xdg` is a Python module which provides functions to return paths to the +directories defined by the [XDG Base Directory Specification][spec], to save you +from duplicating the same snippet of logic in every Python utility you write +that deals with user cache, configuration, or data files. It has no external +dependencies. ## Installation To install the latest release from [PyPI], use [pip]: ```bash -pip install xdg +python -m pip install xdg ``` In Python projects using [Poetry] or [Pipenv] for dependency management, add @@ -21,27 +22,34 @@ ## Usage ```python -from xdg import (XDG_CACHE_HOME, XDG_CONFIG_DIRS, XDG_CONFIG_HOME, - XDG_DATA_DIRS, XDG_DATA_HOME, XDG_RUNTIME_DIR) +from xdg import ( + xdg_cache_home, + xdg_config_dirs, + xdg_config_home, + xdg_data_dirs, + xdg_data_home, + xdg_runtime_dir, +) ``` -`XDG_CACHE_HOME`, `XDG_CONFIG_HOME`, and `XDG_DATA_HOME` are [`pathlib.Path` -objects][path] containing the value of the environment variable of the same -name, or the default defined in the specification if the environment variable is -unset or empty. - -`XDG_CONFIG_DIRS` and `XDG_DATA_DIRS` are lists of `pathlib.Path` objects -containing the value of the environment variable of the same name split on -colons, or the default defined in the specification if the environment variable -is unset or empty. - -`XDG_RUNTIME_DIR` is a `pathlib.Path` object containing the value of the -environment variable of the same name, or `None` if the environment variable is -unset. +`xdg_cache_home()`, `xdg_config_home()`, and `xdg_data_home()` return +[`pathlib.Path` objects][path] containing the value of the environment variable +named `XDG_CACHE_HOME`, `XDG_CONFIG_HOME`, and `XDG_DATA_HOME` respectively, or +the default defined in the specification if the environment variable is unset or +empty. + +`xdg_config_dirs()` and `xdg_data_dirs()` return a list of `pathlib.Path` +objects containing the value, split on colons, of the environment variable named +`XDG_CONFIG_DIRS` and `XDG_DATA_DIRS` respectively, or the default defined in +the specification if the environment variable is unset or empty. + +`xdg_runtime_dir()` returns a `pathlib.Path` object containing the value of the +`XDG_RUNTIME_DIR` environment variable, or `None` if the environment variable is +not set. ## Copyright -Copyright © 2016-2019 [Scott Stevenson]. +Copyright © 2016-2020 [Scott Stevenson]. `xdg` is distributed under the terms of the [ISC licence]. @@ -49,7 +57,7 @@ [path]: https://docs.python.org/3/library/pathlib.html#pathlib.Path [pip]: https://pip.pypa.io/en/stable/ [pipenv]: https://docs.pipenv.org/ -[poetry]: https://poetry.eustace.io/ +[poetry]: https://python-poetry.org/ [pypi]: https://pypi.org/project/xdg/ [scott stevenson]: https://scott.stevenson.io [spec]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-4.0.1/pyproject.toml new/xdg-5.0.0/pyproject.toml --- old/xdg-4.0.1/pyproject.toml 2019-07-21 22:20:13.320037600 +0200 +++ new/xdg-5.0.0/pyproject.toml 2020-10-29 17:05:04.746000000 +0100 @@ -1,17 +1,13 @@ [tool.black] line-length = 79 -target-version = ["py36"] [tool.isort] -combine_as_imports = true -force_grid_wrap = 0 -include_trailing_comma = true +profile = "black" line_length = 79 -multi_line_output = 3 [tool.poetry] name = "xdg" -version = "4.0.1" +version = "5.0.0" description = "Variables defined by the XDG Base Directory Specification" authors = ["Scott Stevenson <[email protected]>"] license = "ISC" @@ -34,16 +30,11 @@ [tool.poetry.dev-dependencies] black = "=18.9b0" flake8 = "^3.6" -flake8-bugbear = "^18.8" -flake8-docstrings = "^1.3" -flake8-comprehensions = "^1.4" -mypy = "^0.660.0" +isort = "^5.0.0" +mypy = "^0.782" nox = "^2018.10" -pylint = "^2.2" +pylint = "^2.6.0" pytest = "^4.1" -docargs = "^0.0.9" -flake8-per-file-ignores = "^0.7.0" -isort = "^4.3.5" [build-system] requires = ["poetry>=0.12"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-4.0.1/setup.py new/xdg-5.0.0/setup.py --- old/xdg-4.0.1/setup.py 1970-01-01 01:00:00.000000000 +0100 +++ new/xdg-5.0.0/setup.py 2020-10-29 17:06:57.495372000 +0100 @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from distutils.core import setup +from setuptools import setup package_dir = \ {'': 'src'} @@ -12,11 +12,13 @@ setup_kwargs = { 'name': 'xdg', - 'version': '4.0.1', + 'version': '5.0.0', 'description': 'Variables defined by the XDG Base Directory Specification', - 'long_description': '# xdg\n\n`xdg` is a tiny Python module which provides the variables defined by the [XDG\nBase Directory Specification][spec], to save you from duplicating the same\nsnippet of logic in every Python utility you write that deals with user cache,\nconfiguration, or data files. It has no external dependencies.\n\n## Installation\n\nTo install the latest release from [PyPI], use [pip]:\n\n```bash\npip install xdg\n```\n\nIn Python projects using [Poetry] or [Pipenv] for dependency management, add\n`xdg` as a dependency with `poetry add xdg` or `pipenv install xdg`.\nAlternatively, since `xdg` is only a single file you may prefer to just copy\n`src/xdg/__init__.py` from the source distribution into your project.\n\n## Usage\n\n```python\nfrom xdg import (XDG_CACHE_HOME, XDG_CONFIG_DIRS, XDG_CONFIG_HOME,\n XDG_DATA_DIRS, XDG_DATA_HOME, XDG_RUNTIME_DIR)\n```\n\n`XDG_CACHE_HOME`, `XDG_CONFIG_HOME`, and `XDG_DATA_HOME` are [`pathlib.Path`\nobjects][path] containing the value of the environment variable of the same\nname, or the default defined in the specification if the environment variable is\nunset or empty.\n\n`XDG_CONFIG_DIRS` and `XDG_DATA_DIRS` are lists of `pathlib.Path` objects\ncontaining the value of the environment variable of the same name split on\ncolons, or the default defined in the specification if the environment variable\nis unset or empty.\n\n`XDG_RUNTIME_DIR` is a `pathlib.Path` object containing the value of the\nenvironment variable of the same name, or `None` if the environment variable is\nunset.\n\n## Copyright\n\nCopyright © 2016-2019 [Scott Stevenson].\n\n`xdg` is distributed under the terms of the [ISC licence].\n\n[isc licence]: https://opensource.org/licenses/ISC\n[path]: https://docs.python.org/3/library/pathlib.html#pathlib.Path\n[pip]: https://pip.pypa.io/en/stable/\n[pipenv]: https://docs.pipenv.org/\n[poetry]: https://poetry.eustace.io/\n[pypi]: https://pypi.org/project/xdg/\n[scott stevenson]: https://scott.stevenson.io\n[spec]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\n', + 'long_description': '# xdg\n\n`xdg` is a Python module which provides functions to return paths to the\ndirectories defined by the [XDG Base Directory Specification][spec], to save you\nfrom duplicating the same snippet of logic in every Python utility you write\nthat deals with user cache, configuration, or data files. It has no external\ndependencies.\n\n## Installation\n\nTo install the latest release from [PyPI], use [pip]:\n\n```bash\npython -m pip install xdg\n```\n\nIn Python projects using [Poetry] or [Pipenv] for dependency management, add\n`xdg` as a dependency with `poetry add xdg` or `pipenv install xdg`.\nAlternatively, since `xdg` is only a single file you may prefer to just copy\n`src/xdg/__init__.py` from the source distribution into your project.\n\n## Usage\n\n```python\nfrom xdg import (\n xdg_cache_home,\n xdg_config_dirs,\n xdg_config_home,\n xdg_data_dirs,\n xdg_data_home,\n xdg_runtime_dir,\n)\n```\n\n`xdg_cache_home()`, `xdg_config_home()`, and `xdg_data_home()` return\n[`pathlib.Path` objects][path] containing the value of the environment variable\nnamed `XDG_CACHE_HOME`, `XDG_CONFIG_HOME`, and `XDG_DATA_HOME` respectively, or\nthe default defined in the specification if the environment variable is unset or\nempty.\n\n`xdg_config_dirs()` and `xdg_data_dirs()` return a list of `pathlib.Path`\nobjects containing the value, split on colons, of the environment variable named\n`XDG_CONFIG_DIRS` and `XDG_DATA_DIRS` respectively, or the default defined in\nthe specification if the environment variable is unset or empty.\n\n`xdg_runtime_dir()` returns a `pathlib.Path` object containing the value of the\n`XDG_RUNTIME_DIR` environment variable, or `None` if the environment variable is\nnot set.\n\n## Copyright\n\nCopyright © 2016-2020 [Scott Stevenson].\n\n`xdg` is distributed under the terms of the [ISC licence].\n\n[isc licence]: https://opensource.org/licenses/ISC\n[path]: https://docs.python.org/3/library/pathlib.html#pathlib.Path\n[pip]: https://pip.pypa.io/en/stable/\n[pipenv]: https://docs.pipenv.org/\n[poetry]: https://python-poetry.org/\n[pypi]: https://pypi.org/project/xdg/\n[scott stevenson]: https://scott.stevenson.io\n[spec]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\n', 'author': 'Scott Stevenson', 'author_email': '[email protected]', + 'maintainer': None, + 'maintainer_email': None, 'url': 'https://github.com/srstevenson/xdg', 'package_dir': package_dir, 'packages': packages, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-4.0.1/src/xdg/__init__.py new/xdg-5.0.0/src/xdg/__init__.py --- old/xdg-4.0.1/src/xdg/__init__.py 2019-07-21 22:19:48.864034000 +0200 +++ new/xdg-5.0.0/src/xdg/__init__.py 2020-10-29 17:04:33.182000000 +0100 @@ -1,4 +1,4 @@ -# Copyright © 2016-2019 Scott Stevenson <[email protected]> +# Copyright © 2016-2020 Scott Stevenson <[email protected]> # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the @@ -16,27 +16,37 @@ """XDG Base Directory Specification variables. -XDG_CACHE_HOME, XDG_CONFIG_HOME, and XDG_DATA_HOME are pathlib.Path -objects containing the value of the environment variable of the same -name, or the default defined in the specification if the environment -variable is unset or empty. - -XDG_CONFIG_DIRS and XDG_DATA_DIRS are lists of pathlib.Path objects -containing the value of the environment variable of the same name split -on colons, or the default defined in the specification if the -environment variable is unset or empty. +xdg_cache_home(), xdg_config_home(), and xdg_data_home() return +pathlib.Path objects containing the value of the environment variable +named XDG_CACHE_HOME, XDG_CONFIG_HOME, and XDG_DATA_HOME respectively, +or the default defined in the specification if the environment variable +is unset or empty. + +xdg_config_dirs() and xdg_data_dirs() return a list of pathlib.Path +objects containing the value, split on colons, of the environment +variable named XDG_CONFIG_DIRS and XDG_DATA_DIRS respectively, or the +default defined in the specification if the environment variable is +unset or empty. -XDG_RUNTIME_DIR is a pathlib.Path object containing the value of the -environment variable of the same name, or None if the environment +xdg_runtime_dir() returns a pathlib.Path object containing the value of +the XDG_RUNTIME_DIR environment variable, or None if the environment variable is not set. """ +# pylint: disable=fixme + import os from pathlib import Path from typing import List, Optional __all__ = [ + "xdg_cache_home", + "xdg_config_dirs", + "xdg_config_home", + "xdg_data_dirs", + "xdg_data_home", + "xdg_runtime_dir", "XDG_CACHE_HOME", "XDG_CONFIG_DIRS", "XDG_CONFIG_HOME", @@ -45,7 +55,10 @@ "XDG_RUNTIME_DIR", ] -HOME = Path(os.path.expandvars("$HOME")) + +def _home_dir() -> Path: + """Return a Path corresponding to the user's home directory.""" + return Path(os.path.expandvars("$HOME")) def _path_from_env(variable: str, default: Path) -> Path: @@ -103,20 +116,51 @@ return default -XDG_CACHE_HOME = _path_from_env("XDG_CACHE_HOME", HOME / ".cache") +def xdg_cache_home() -> Path: + """Return a Path corresponding to XDG_CACHE_HOME.""" + return _path_from_env("XDG_CACHE_HOME", _home_dir() / ".cache") -XDG_CONFIG_DIRS = _paths_from_env("XDG_CONFIG_DIRS", [Path("/etc/xdg")]) -XDG_CONFIG_HOME = _path_from_env("XDG_CONFIG_HOME", HOME / ".config") +def xdg_config_dirs() -> List[Path]: + """Return a list of Paths corresponding to XDG_CONFIG_DIRS.""" + return _paths_from_env("XDG_CONFIG_DIRS", [Path("/etc/xdg")]) -XDG_DATA_DIRS = _paths_from_env( - "XDG_DATA_DIRS", - [Path(path) for path in "/usr/local/share/:/usr/share/".split(":")], -) -XDG_DATA_HOME = _path_from_env("XDG_DATA_HOME", HOME / ".local" / "share") +def xdg_config_home() -> Path: + """Return a Path corresponding to XDG_CONFIG_HOME.""" + return _path_from_env("XDG_CONFIG_HOME", _home_dir() / ".config") + + +def xdg_data_dirs() -> List[Path]: + """Return a list of Paths corresponding to XDG_DATA_DIRS.""" + return _paths_from_env( + "XDG_DATA_DIRS", + [Path(path) for path in "/usr/local/share/:/usr/share/".split(":")], + ) + + +def xdg_data_home() -> Path: + """Return a Path corresponding to XDG_DATA_HOME.""" + return _path_from_env("XDG_DATA_HOME", _home_dir() / ".local" / "share") + + +def xdg_runtime_dir() -> Optional[Path]: + """Return a Path corresponding to XDG_RUNTIME_DIR. + + If the XDG_RUNTIME_DIR environment variable is not set, None will be + returned as per the specification. + + """ + try: + return Path(os.environ["XDG_RUNTIME_DIR"]) + except KeyError: + return None + -try: - XDG_RUNTIME_DIR: Optional[Path] = Path(os.environ["XDG_RUNTIME_DIR"]) -except KeyError: - XDG_RUNTIME_DIR = None +# The following variables are deprecated, but remain for backward compatibility. +XDG_CACHE_HOME = xdg_cache_home() +XDG_CONFIG_DIRS = xdg_config_dirs() +XDG_CONFIG_HOME = xdg_config_home() +XDG_DATA_DIRS = xdg_data_dirs() +XDG_DATA_HOME = xdg_data_home() +XDG_RUNTIME_DIR = xdg_runtime_dir() _______________________________________________ openSUSE Commits mailing list -- [email protected] To unsubscribe, email [email protected] List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/[email protected]
