forked from ungleich-public/cdist
__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.
This commit is contained in:
parent
7cf85c4659
commit
8eccacec59
3 changed files with 27 additions and 0 deletions
|
@ -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
|
||||
--------
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
extra
|
Loading…
Reference in a new issue