diff options
Diffstat (limited to 'lib/spack/external/_pytest/_argcomplete.py')
-rw-r--r-- | lib/spack/external/_pytest/_argcomplete.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/spack/external/_pytest/_argcomplete.py b/lib/spack/external/_pytest/_argcomplete.py index 3ab679d8be..965ec79513 100644 --- a/lib/spack/external/_pytest/_argcomplete.py +++ b/lib/spack/external/_pytest/_argcomplete.py @@ -57,26 +57,29 @@ If things do not work right away: which should throw a KeyError: 'COMPLINE' (which is properly set by the global argcomplete script). """ - +from __future__ import absolute_import, division, print_function import sys import os from glob import glob + class FastFilesCompleter: 'Fast file completer class' + def __init__(self, directories=True): self.directories = directories def __call__(self, prefix, **kwargs): """only called on non option completions""" - if os.path.sep in prefix[1:]: # + if os.path.sep in prefix[1:]: prefix_dir = len(os.path.dirname(prefix) + os.path.sep) else: prefix_dir = 0 completion = [] globbed = [] if '*' not in prefix and '?' not in prefix: - if prefix[-1] == os.path.sep: # we are on unix, otherwise no bash + # we are on unix, otherwise no bash + if not prefix or prefix[-1] == os.path.sep: globbed.extend(glob(prefix + '.*')) prefix += '*' globbed.extend(glob(prefix)) @@ -96,7 +99,8 @@ if os.environ.get('_ARGCOMPLETE'): filescompleter = FastFilesCompleter() def try_argcomplete(parser): - argcomplete.autocomplete(parser) + argcomplete.autocomplete(parser, always_complete_options=False) else: - def try_argcomplete(parser): pass + def try_argcomplete(parser): + pass filescompleter = None |