Added vendoring support to click.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Armin Ronacher · committed by Armin Ronacher · parent 77269f3 · Browse files · 4 files·+22 added−15 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+22 added−15 removed
- other:+22 added−15 removed
Provenance
- Commit
cbe8b00- Tree
abab8e9- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
77269f3
4 files changed+22 added−15 removed
modified:click/_bashcomplete.py+3 added-3 removed
1 import os2-from click.utils import echo3-from click.parser import split_arg_string4-from click.core import MultiCommand, Option2+from .utils import echo3+from .parser import split_arg_string4+from .core import MultiCommand, Option5 6 7 COMPLETION_SCRIPT = '''8 %(complete_func)s() {66 unmodified linesmodified:click/core.py+1 added-1 removed
22 unmodified lines23 complete_instr = os.environ.get(complete_var)24 if not complete_instr:25 return26 27- from click._bashcomplete import bashcomplete27+ from ._bashcomplete import bashcomplete28 if bashcomplete(cmd, prog_name, complete_var, complete_instr):29 sys.exit(1)30 31 1311 unmodified linesmodified:click/testing.py+17 added-11 removed
1 import os2 import sys3-import click3 import shutil4 import tempfile5 import contextlib6 7 from ._compat import iteritems, PY28 9 10+# If someone wants to vendor click, we want to ensure the11+# correct package is discovered. Ideally we could use a12+# relative import here but unfortunately Python does not13+# support that.14+clickpkg = sys.modules[__name__.rsplit('.', 1)[0]]15+16+17 if PY2:18 from cStringIO import StringIO19 else:20 import io166 unmodified lines187 sys.stdout.write(char)188 sys.stdout.flush()189 return char190 185- old_visible_prompt_func = click.termui.visible_prompt_func186- old_hidden_prompt_func = click.termui.hidden_prompt_func187- old__getchar_func = click.termui._getchar188- click.termui.visible_prompt_func = visible_input189- click.termui.hidden_prompt_func = hidden_input190- click.termui._getchar = _getchar191+ old_visible_prompt_func = clickpkg.termui.visible_prompt_func192+ old_hidden_prompt_func = clickpkg.termui.hidden_prompt_func193+ old__getchar_func = clickpkg.termui._getchar194+ clickpkg.termui.visible_prompt_func = visible_input195+ clickpkg.termui.hidden_prompt_func = hidden_input196+ clickpkg.termui._getchar = _getchar197 198 old_env = {}199 try:200 for key, value in iteritems(env):17 unmodified lines218 os.environ[key] = value219 sys.stdout = old_stdout220 sys.stderr = old_stderr221 sys.stdin = old_stdin216- click.termui.visible_prompt_func = old_visible_prompt_func217- click.termui.hidden_prompt_func = old_hidden_prompt_func218- click.termui._getchar = old__getchar_func222+ clickpkg.termui.visible_prompt_func = old_visible_prompt_func223+ clickpkg.termui.hidden_prompt_func = old_hidden_prompt_func224+ clickpkg.termui._getchar = old__getchar_func225 226 def invoke(self, cli, args=None, input=None, env=None,227 catch_exceptions=True, **extra):228 """Invokes a command in an isolated environment. The arguments are229 forwarded directly to the command line script, the `extra` keyword224- arguments are passed to the :meth:`~click.Command.main` function of230+ arguments are passed to the :meth:`~clickpkg.Command.main` function of231 the command.232 233 This returns a :class:`Result` object.234 60 unmodified linesmodified:CHANGES+1 added
19 unmodified lines20 - when definining options without actual valid option strings21 now, Click will give an error message instead of silently22 passing. This should catch situations where users wanted to23 created arguments instead of options.24+- Restructured Click internally to support vendoring.25 26 Version 2.427 -----------28 97 unmodified lines