Skip to content

Commit 02fb544

Browse files
authored
Merge pull request #19 from nexB/scancode-2529-click-8
Support Click 8 aboutcode-org/scancode-toolkit#2529 Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
2 parents 06d2e64 + 475e625 commit 02fb544

4 files changed

Lines changed: 59 additions & 19 deletions

File tree

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ vNext
55
-----
66

77

8+
Version 21.5.25
9+
---------------
10+
11+
- Fix click-realted bug https://github.com/nexB/scancode-toolkit/issues/2529
12+
- Add tests to run on the latest of every dependency
13+
14+
815
Version 21.5.12
916
---------------
1017

azure-pipelines.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
################################################################################
32
# We use Azure to run the full tests suites on multiple Python 3.x
43
# on multiple Windows, macOS and Linux versions all on 64 bits
@@ -62,3 +61,33 @@ jobs:
6261
python_versions: ['3.6', '3.7', '3.8', '3.9']
6362
test_suites:
6463
all: tmp\Scripts\pytest -n 2 -vvs
64+
65+
66+
################################################################################
67+
# Test using a plain pip install to get the latest of all wheels
68+
################################################################################
69+
70+
71+
- template: etc/ci/azure-posix.yml
72+
parameters:
73+
job_name: ubuntu20_cpython_latest_from_pip
74+
image_name: ubuntu-20.04
75+
python_versions: ['3.6', '3.7', '3.8', '3.9']
76+
test_suites:
77+
all: tmp/bin/pip install --force-reinstall --upgrade -e . && tmp/bin/pytest -n 2 -vvs
78+
79+
- template: etc/ci/azure-win.yml
80+
parameters:
81+
job_name: win2019_cpython_latest_from_pip
82+
image_name: windows-2019
83+
python_versions: ['3.6', '3.7', '3.8', '3.9']
84+
test_suites:
85+
all: tmp\Scripts\pip install --force-reinstall --upgrade -e . && tmp\Scripts\pytest -n 2 -vvs
86+
87+
- template: etc/ci/azure-posix.yml
88+
parameters:
89+
job_name: macos1015_cpython_latest_from_pip
90+
image_name: macos-10.15
91+
python_versions: ['3.6', '3.7', '3.8', '3.9']
92+
test_suites:
93+
all: tmp/bin/pip install --force-reinstall --upgrade -e . && tmp/bin/pytest -n 2 -vvs

src/commoncode/cliutils.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import sys
1010

1111
import click
12-
click.disable_unicode_literals_warning = True
12+
1313
from click.utils import echo
1414
from click.termui import style
1515
from click.types import BoolParamType
@@ -352,6 +352,7 @@ def __init__(
352352
allow_from_autoenv=True,
353353
type=None, # NOQA
354354
help=None, # NOQA
355+
hidden=False,
355356
# custom additions #
356357
# a string that set the CLI help group for this option
357358
help_group=MISC_GROUP,
@@ -365,24 +366,21 @@ def __init__(
365366
# a sequence of other option name strings that this option
366367
# conflicts with if they are set
367368
conflicting_options=(),
368-
# a flag set to True if this option should be hidden from the CLI help
369-
hidden=False,
370369
**kwargs
371370
):
372-
373371
super(PluggableCommandLineOption, self).__init__(
374-
param_decls,
375-
show_default,
376-
prompt,
377-
confirmation_prompt,
378-
hide_input,
379-
is_flag,
380-
flag_value,
381-
multiple,
382-
count,
383-
allow_from_autoenv,
384-
type,
385-
help,
372+
param_decls=param_decls,
373+
show_default=show_default,
374+
prompt=prompt,
375+
confirmation_prompt=confirmation_prompt,
376+
hide_input=hide_input,
377+
is_flag=is_flag,
378+
flag_value=flag_value,
379+
multiple=multiple,
380+
count=count,
381+
allow_from_autoenv=allow_from_autoenv,
382+
type=type,
383+
help=help,
386384
**kwargs
387385
)
388386

@@ -418,6 +416,7 @@ def get_help_record(self, ctx):
418416
return click.Option.get_help_record(self, ctx)
419417

420418

419+
421420
def validate_option_dependencies(ctx):
422421
"""
423422
Validate all PluggableCommandLineOption dependencies in the `ctx` Click

tests/test_cliutils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,13 @@ def test_GroupedHelpCommand_help_with_group(self):
138138
from commoncode.cliutils import CORE_GROUP
139139

140140
@click.command(name='scan', cls=GroupedHelpCommand)
141-
@click.option('--opt', is_flag=True, help='Help text for option',
142-
help_group=CORE_GROUP, cls=PluggableCommandLineOption)
141+
@click.option(
142+
'--opt',
143+
is_flag=True,
144+
help='Help text for option',
145+
help_group=CORE_GROUP,
146+
cls=PluggableCommandLineOption,
147+
)
143148
def scan(opt):
144149
pass
145150

0 commit comments

Comments
 (0)