Skip to content
Myr

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

4 files+22 added−15 removed

modified:click/_bashcomplete.py+3 added-3 removed
1import os2from click.utils import echo3from click.parser import split_arg_string4from click.core import MultiCommand, Option2from .utils import echo3from .parser import split_arg_string4from .core import MultiCommand, Option567COMPLETION_SCRIPT = '''8%(complete_func)s() {
66 unmodified lines
modified:click/core.py+1 added-1 removed
22 unmodified lines
23 complete_instr = os.environ.get(complete_var)24 if not complete_instr:25 return2627 from click._bashcomplete import bashcomplete27 from ._bashcomplete import bashcomplete28 if bashcomplete(cmd, prog_name, complete_var, complete_instr):29 sys.exit(1)3031
1311 unmodified lines
modified:click/testing.py+17 added-11 removed
1import os2import sys3import click3import shutil4import tempfile5import contextlib67from ._compat import iteritems, PY28910# 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.14clickpkg = sys.modules[__name__.rsplit('.', 1)[0]]151617if PY2:18 from cStringIO import StringIO19else:20 import io
166 unmodified lines
187 sys.stdout.write(char)188 sys.stdout.flush()189 return char190185 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 = _getchar197198 old_env = {}199 try:200 for key, value in iteritems(env):
17 unmodified lines
218 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_func225226 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.232233 This returns a :class:`Result` object.234
60 unmodified lines
modified:CHANGES+1 added
19 unmodified lines
20- 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.2526Version 2.427-----------28
97 unmodified lines