From 8add71a50c8abb59fc4e4062c5b399225eb03482 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 27 Feb 2013 11:01:51 +0530 Subject: [PATCH] Fix zsh detection on ubuntu --- src/calibre/linux.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/calibre/linux.py b/src/calibre/linux.py index 9a4b87c03a..5f0a2ec7d7 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -129,11 +129,19 @@ class ZshCompleter(object): # {{{ self.opts = opts self.dest = None base = os.path.dirname(self.opts.staging_sharedir) + self.detect_zsh(base) + if not self.dest and base == '/usr/share': + # Ubuntu puts site-functions in /usr/local/share + self.detect_zsh('/usr/local/share') + + self.commands = {} + + def detect_zsh(self, base): for x in ('vendor-completions', 'vendor-functions', 'site-functions'): c = os.path.join(base, 'zsh', x) if os.path.isdir(c) and os.access(c, os.W_OK): self.dest = os.path.join(c, '_calibre') - self.commands = {} + break def get_options(self, parser, cover_opts=('--cover',), opf_opts=('--opf',), file_map={}):