summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-08-27 17:29:08 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-08-28 02:48:07 -0400
commit25caabb2e9ae6548e452eff1bdabeeb23386e1ab (patch)
treec1f03121422368682a4f3df1c82b0d8118c9f82d
parent9890d1a8827d894d67f0e3a31b443f13becb1e3b (diff)
downloadbuildstream-25caabb2e9ae6548e452eff1bdabeeb23386e1ab.tar.gz
buildstream/data/bst: Adding a bash completion scriptlet.
Currently this gets installed at ${prefix}/share/bash-completion/completions but this is not exactly correct.
-rw-r--r--buildstream/data/bst21
-rwxr-xr-xsetup.py18
2 files changed, 38 insertions, 1 deletions
diff --git a/buildstream/data/bst b/buildstream/data/bst
new file mode 100644
index 000000000..a71f6d3fd
--- /dev/null
+++ b/buildstream/data/bst
@@ -0,0 +1,21 @@
+# BuildStream bash completion scriptlet.
+#
+# On systems which use the bash-completion module for
+# completion discovery with bash, this can be installed at:
+#
+# pkg-config --variable=completionsdir bash-completion
+#
+# If BuildStream is not installed system wide, you can
+# simply source this script to enable completions or append
+# this script to your ~/.bash_completions.
+#
+_bst_completion() {
+ local IFS=$'
+'
+ COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
+ COMP_CWORD=$COMP_CWORD \
+ _BST_COMPLETION=complete $1 ) )
+ return 0
+}
+
+complete -F _bst_completion -o nospace bst;
diff --git a/setup.py b/setup.py
index 80b367cae..a13a06472 100755
--- a/setup.py
+++ b/setup.py
@@ -108,7 +108,23 @@ setup(name='BuildStream',
packages=find_packages(),
package_data={'buildstream': ['plugins/*/*.py', 'plugins/*/*.yaml',
'data/*.yaml', 'data/*.sh.in']},
- data_files=[('share/man/man1', list_man_pages())],
+ data_files=[
+ # This is a weak attempt to integrate with the user nicely,
+ # installing things outside of the python package itself with pip is
+ # not recommended, but there seems to be no standard structure for
+ # addressing this; so just installing this here.
+ #
+ # These do not get installed in developer mode (`pip install --user -e .`)
+ #
+ # The completions are ignored by bash unless it happens to be installed
+ # in the right directory; this is more like a weak statement that we
+ # attempt to install bash completion scriptlet.
+ #
+ ('share/man/man1', list_man_pages()),
+ ('share/bash-completion/completions', [
+ os.path.join('buildstream', 'data', 'bst')
+ ])
+ ],
install_requires=[
'setuptools',
'psutil',