Commit 8eccacec authored by matze's avatar matze

__package_pip: add optional dependencies

This is a poor implementation of optional dependencies for pip packages.
It ensures to install them if the package will be installed, but does
not take into account if they must be added/removed after the package is
already installed. Also, it will not be autoremoved, as all dependencies
will not be removed.
parent 7cf85c46
Pipeline #3134 failed with stage
in 1 minute and 10 seconds
......@@ -56,6 +56,19 @@ fi
case "$state_should" in
present)
if [ -f "$__object/parameter/extra" ]
then
while read extra
do
if [ "$extras" ]; then
extras="$extras,$extra"
else
extras="$extra"
fi
done < "$__object/parameter/extra"
name="${name}[${extras}]"
fi
if [ "$runas" ]
then
echo "su -c '$pip install -q $name' $runas"
......
......@@ -22,6 +22,11 @@ OPTIONAL PARAMETERS
name
If supplied, use the name and not the object id as the package name.
extra
Extra optional dependencies which should be installed along the selected
package. Can be specified multiple times. Will only be applied if the
package actually will be installed, but will not explicitly checked.
pip
Instead of using pip from PATH, use the specific pip path.
......@@ -46,6 +51,14 @@ EXAMPLES
# Use pip in a virtualenv located at /foo/shinken_virtualenv as user foo
__package_pip pyro --state present --pip /foo/shinken_virtualenv/bin/pip --runas foo
# Install package with optional dependencies
__package_pip mautrix-telegram --extra speedups --extra webp_convert --extra hq_thumbnails
# or do a little cheating
__package_pip mautrix-telegram --extra speedups,webp_convert,hq_thumbnails
# or take all extras
__package_pip mautrix-telegram --extra all
SEE ALSO
--------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment