|
1 | | -import click |
2 | | -from packaging.version import parse as parse_version |
3 | 1 | from tornado.ioloop import IOLoop |
4 | 2 |
|
5 | | -CLICK_VERSION = parse_version(click.__version__) |
6 | | - |
7 | | -py3_err_msg = """ |
8 | | -Warning: Your terminal does not set locales. |
9 | | -
|
10 | | -If you use unicode text inputs for command line options then this may cause |
11 | | -undesired behavior. This is rare. |
12 | | -
|
13 | | -If you don't use unicode characters in command line options then you can safely |
14 | | -ignore this message. This is the common case. |
15 | | -
|
16 | | -You can support unicode inputs by specifying encoding environment variables, |
17 | | -though exact solutions may depend on your system: |
18 | | -
|
19 | | - $ export LC_ALL=C.UTF-8 |
20 | | - $ export LANG=C.UTF-8 |
21 | | -
|
22 | | -For more information see: http://click.pocoo.org/5/python3/ |
23 | | -""".lstrip() |
24 | | - |
25 | | - |
26 | | -def check_python_3(): |
27 | | - """Ensures that the environment is good for unicode on Python 3.""" |
28 | | - # https://github.com/pallets/click/issues/448#issuecomment-246029304 |
29 | | - import click.core |
30 | | - |
31 | | - # TODO: Remove use of internal click functions |
32 | | - if CLICK_VERSION < parse_version("8.0.0"): |
33 | | - click.core._verify_python3_env = lambda: None |
34 | | - else: |
35 | | - click.core._verify_python_env = lambda: None |
36 | | - |
37 | | - try: |
38 | | - from click import _unicodefun |
39 | | - |
40 | | - if CLICK_VERSION < parse_version("8.0.0"): |
41 | | - _unicodefun._verify_python3_env() |
42 | | - else: |
43 | | - _unicodefun._verify_python_env() |
44 | | - except (TypeError, RuntimeError): |
45 | | - import click |
46 | | - |
47 | | - click.echo(py3_err_msg, err=True) |
48 | | - |
49 | 3 |
|
50 | 4 | def install_signal_handlers(loop=None, cleanup=None): |
51 | 5 | """ |
|
0 commit comments