Skip to content

Commit 9f60576

Browse files
committed
fix config loading if XDG_CONFIG_HOME defined
Fixes: #72 Signed-off-by: Arthur Zamarin <[email protected]>
1 parent b780cf9 commit 9f60576

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

doc/man/config.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ Config files are supported by most subcommands of ``pkgdev`` from any of three
55
locations. Listed in order of increasing precedence these include the
66
following:
77

8-
- system config -- /etc/pkgdev/pkgdev.conf
9-
- user config -- ~/.config/pkgdev/pkgdev.conf
10-
- custom config -- specified via the --config option
8+
- system config -- ``/etc/pkgdev/pkgdev.conf``
9+
- user config -- ``${XDG_CONFIG_HOME}/pkgdev/pkgdev.conf``
10+
- user config -- ``~/.config/pkgdev/pkgdev.conf``
11+
- custom config -- specified via the ``--config`` option
1112

1213
Any settings from a config file with higher precedence will override matching
1314
settings from a config file with a lower precedence, e.g. user settings
@@ -33,7 +34,8 @@ related values. To find all possible configuration options, run:
3334
[gentoo]
3435
push.ask = true
3536

36-
- Add `Signed-off-by` consenting to the `Certificate of Origin <https://www.gentoo.org/glep/glep-0076.html#certificate-of-origin>`_
37+
- Add `Signed-off-by` consenting to the `Certificate of Origin
38+
<https://www.gentoo.org/glep/glep-0076.html#certificate-of-origin>`_
3739
to all commits::
3840

3941
[DEFAULT]

src/pkgdev/const.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@ def _GET_CONST(attr, default_value):
2626
# determine XDG compatible paths
2727
for xdg_var, var_name, fallback_dir in (
2828
('XDG_CONFIG_HOME', 'USER_CONFIG_PATH', '~/.config'),
29-
('XDG_CACHE_HOME', 'USER_CACHE_PATH', '~/.cache'),
3029
('XDG_DATA_HOME', 'USER_DATA_PATH', '~/.local/share')):
3130
setattr(
3231
_module, var_name,
33-
os.environ.get(xdg_var, os.path.join(os.path.expanduser(fallback_dir), 'pkgdev')))
32+
os.path.join(os.environ.get(xdg_var, os.path.expanduser(fallback_dir)), 'pkgdev'))
3433

3534
REPO_PATH = _GET_CONST('REPO_PATH', _reporoot)
3635
DATA_PATH = _GET_CONST('DATA_PATH', '%(REPO_PATH)s/data')
3736

38-
USER_CACHE_DIR = getattr(_module, 'USER_CACHE_PATH')
3937
USER_CONF_FILE = os.path.join(getattr(_module, 'USER_CONFIG_PATH'), 'pkgdev.conf')
4038
SYSTEM_CONF_FILE = '/etc/pkgdev/pkgdev.conf'
4139
BUNDLED_CONF_FILE = os.path.join(DATA_PATH, 'pkgdev.conf')

0 commit comments

Comments
 (0)