Skip to content

Commit 23c8ef0

Browse files
committed
Add "--no-check-version" CLI option to scancode
This version check causes problems when running in a firewalled environment (in my case, hanging for 30 seconds before timing out). This just adds a CLI option to skip it entirely. Signed-off-by: Yunus Rahbar <[email protected]>
1 parent 3be07db commit 23c8ef0

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,4 @@ The following organizations or individuals have contributed to ScanCode:
9292
- Yash D. Saraf @yashdsaraf
9393
- Yash Nisar @yash-nisar
9494
- Yash Sharma @yasharmaster
95+
- Yunus Rahbar @yns88

src/scancode/cli.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,14 @@ def validate_depth(ctx, param, value):
326326
'are stored. (By default temporary files are deleted when a scan is '
327327
'completed.)',
328328
help_group=cliutils.MISC_GROUP, sort_order=1000, cls=PluggableCommandLineOption)
329+
330+
@click.option(
331+
"--check-version/--no-check-version",
332+
help="Whether to check for new versions. Defaults to true.",
333+
default=True,
334+
# not yet supported in Click 6.7 but added in PluggableCommandLineOption
335+
hidden=True,
336+
help_group=cliutils.MISC_GROUP, sort_order=1000, cls=PluggableCommandLineOption)
329337
def scancode(
330338
ctx,
331339
input, # NOQA
@@ -343,6 +351,7 @@ def scancode(
343351
test_slow_mode,
344352
test_error_mode,
345353
keep_temp_files,
354+
check_version,
346355
echo_func=echo_stderr,
347356
*args,
348357
**kwargs,
@@ -454,10 +463,11 @@ def scancode(
454463
)
455464

456465
# check for updates
457-
from scancode.outdated import check_scancode_version
458-
outdated = check_scancode_version()
459-
if not quiet and outdated:
460-
echo_stderr(outdated, fg='yellow')
466+
if check_version:
467+
from scancode.outdated import check_scancode_version
468+
outdated = check_scancode_version()
469+
if not quiet and outdated:
470+
echo_stderr(outdated, fg='yellow')
461471

462472
except click.UsageError as e:
463473
# this will exit

0 commit comments

Comments
 (0)