Background
setup.py installs the config tree (clush.conf, groups.conf, the *.d/
dirs and *.example files) through setuptools data_files at the relative path
etc/clustershell/. In a wheel / PEP 517 install that path is placed relative
to the install location, so:
- venv →
<venv>/etc/clustershell/ ✅ (found via config_paths()'s
sys.prefix/etc/clustershell entry)
pip install --user → ~/.local/etc/clustershell/ ✅
- system
/usr prefix → /usr/etc/clustershell/ ❌ (not /etc)
The last one is the awkward case: Python packaging has no notion of a system
/etc, and data_files ties everything to the install location. Today we work
around it with (a) the multi-path search in Defaults.config_paths() and (b) the
RPM spec moving /usr/etc → %{_sysconfdir}. It works, but it surprises people.
(Man pages are not affected: share/man lands at /usr/share/man under a /usr
prefix, which is correct. This is specific to the etc/ config dir.)
Proposal (do this at the Python 2 drop)
Dropping py2 is the natural time — we move to a pyproject.toml build (started in
#606) and can stop using data_files for config. Let each install channel place
config itself instead of forcing it through the package:
-
Distro packages own /etc: the spec installs conf/* to
%{_sysconfdir}/clustershell directly (the same way it already installs man
pages and vim files), so the data_files route and the /usr/etc → /etc
move both go away.
-
pip/venv ships the library only (it already runs on built-in defaults).
Two options for the example configs:
- (a) keep them in the sdist
conf/ for packagers and docs, and don't install
them into the environment at all; or
- (b) carry them as
package_data inside the package, readable via
importlib.resources, so pip/venv users can still find reference copies.
Leaning (b); (a) is simpler.
Note: the pyproject.toml in #606 doesn't yet install config files or man pages,
so handling those is part of finishing that migration — this issue covers config.
Behavior change / things to watch
- venv & pip users currently get example configs dropped at
<prefix>/etc/clustershell; after this they won't. Document
CLUSTERSHELL_CFGDIR and copying the examples in the migration notes.
config_paths()'s sys.prefix/etc/clustershell entry would no longer be
filled by an install — keep it for backward compatibility, or remove it on
purpose.
importlib.resources.files() needs Python 3.9+; if the minimum Python version
is lower then, use the importlib_resources backport or the older API.
Acceptance criteria
Related
Background
setup.pyinstalls the config tree (clush.conf,groups.conf, the*.d/dirs and
*.examplefiles) through setuptoolsdata_filesat the relative pathetc/clustershell/. In a wheel / PEP 517 install that path is placed relativeto the install location, so:
<venv>/etc/clustershell/✅ (found viaconfig_paths()'ssys.prefix/etc/clustershellentry)pip install --user→~/.local/etc/clustershell/✅/usrprefix →/usr/etc/clustershell/❌ (not/etc)The last one is the awkward case: Python packaging has no notion of a system
/etc, anddata_filesties everything to the install location. Today we workaround it with (a) the multi-path search in
Defaults.config_paths()and (b) theRPM spec moving
/usr/etc→%{_sysconfdir}. It works, but it surprises people.(Man pages are not affected:
share/manlands at/usr/share/manunder a/usrprefix, which is correct. This is specific to the
etc/config dir.)Proposal (do this at the Python 2 drop)
Dropping py2 is the natural time — we move to a
pyproject.tomlbuild (started in#606) and can stop using
data_filesfor config. Let each install channel placeconfig itself instead of forcing it through the package:
Distro packages own
/etc: the spec installsconf/*to%{_sysconfdir}/clustershelldirectly (the same way it already installs manpages and vim files), so the
data_filesroute and the/usr/etc→/etcmove both go away.
pip/venv ships the library only (it already runs on built-in defaults).
Two options for the example configs:
conf/for packagers and docs, and don't installthem into the environment at all; or
package_datainside the package, readable viaimportlib.resources, so pip/venv users can still find reference copies.Leaning (b); (a) is simpler.
Note: the
pyproject.tomlin #606 doesn't yet install config files or man pages,so handling those is part of finishing that migration — this issue covers config.
Behavior change / things to watch
<prefix>/etc/clustershell; after this they won't. DocumentCLUSTERSHELL_CFGDIRand copying the examples in the migration notes.config_paths()'ssys.prefix/etc/clustershellentry would no longer befilled by an install — keep it for backward compatibility, or remove it on
purpose.
importlib.resources.files()needs Python 3.9+; if the minimum Python versionis lower then, use the
importlib_resourcesbackport or the older API.Acceptance criteria
pyproject.toml(From setup.py to pyproject #606), config files are no longer installed viadata_filespackage_data)/etc/clustershelldirectly;/usr/etc→/etcmove removed<prefix>/etc/clustershell; library still runs on defaultsRelated
setup.py→pyproject.tomlmigration (the migration this depends on)setup.py build/install