Convert pvc-client-cli into a proper Python module

Also fixes up the Debian packaging such that this works how I would
want, with proper module installation while leaving everything else
untouched. Finally implements automatic installation and removal of the
BASH completion for the PVC command.
This commit is contained in:
2021-06-23 04:08:02 -04:00
parent f0db631947
commit f248d579df
21 changed files with 68 additions and 36 deletions

View File

@ -1,3 +0,0 @@
client-cli/pvc.py usr/share/pvc
client-cli/cli_lib usr/share/pvc
client-cli/scripts usr/share/pvc

View File

@ -1,4 +1,6 @@
#!/bin/sh
# Install client binary to /usr/bin via symlink
ln -s /usr/share/pvc/pvc.py /usr/bin/pvc
# Generate the bash completion configuration
if [ -d /etc/bash_completion.d ]; then
_PVC_COMPLETE=source_bash pvc > /etc/bash_completion.d/pvc
fi

View File

@ -1,4 +1,6 @@
#!/bin/sh
# Remove client binary symlink
rm -f /usr/bin/pvc
# Remove the bash completion
if [ -f /etc/bash_completion.d/pvc ]; then
rm -f /etc/bash_completion.d/pvc
fi

12
debian/rules vendored
View File

@ -1,13 +1,19 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
export DH_VERBOSE = 1
%:
dh $@
dh $@ --with python3
override_dh_python3:
cd $(CURDIR)/client-cli; pybuild --system=distutils --dest-dir=../debian/pvc-client-cli/
mkdir -p debian/pvc-client-cli/usr/lib/python3
mv debian/pvc-client-cli/usr/lib/python3*/* debian/pvc-client-cli/usr/lib/python3/
rm -r $(CURDIR)/client-cli/.pybuild $(CURDIR)/client-cli/pvc.egg-info
override_dh_auto_clean:
find . -name "__pycache__" -exec rm -r {} \; || true
find . -name "__pycache__" -o -name ".pybuild" -exec rm -r {} \; || true
# If you need to rebuild the Sphinx documentation
# Add spinxdoc to the dh --with line