Skip to content

Commit

Permalink
Merge pull request #725 from dandi/enh-et
Browse files Browse the repository at this point in the history
ENH: exit with non-0 when "bad_version" of dandi-cli is used
  • Loading branch information
yarikoptic committed Jul 22, 2021
2 parents 3c2eac7 + 9ac410b commit cf0c118
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion dandi/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,21 @@ def main(ctx, log_level, pdb=False):
try:
import etelemetry

etelemetry.check_available_version("dandi/dandi-cli", __version__, lgr=lgr)
try:
etelemetry.check_available_version(
"dandi/dandi-cli", __version__, lgr=lgr, raise_exception=True
)
except etelemetry.client.BadVersionError:
# note: SystemExit is based of BaseException, so is not Exception
raise SystemExit(
"DANDI CLI has detected that you are using a version that is known to "
"contain bugs, is incompatible with our current data archive, or has "
"other significant performance limitations. "
"To continue using DANDI CLI, please upgrade your dandi client to a newer "
"version (e.g., using pip install --upgrade dandi if you installed using pip). "
"If you have any issues, please contact the DANDI "
"helpdesk at https://github.com/dandi/helpdesk/issues/new/choose ."
)
except Exception as exc:
lgr.warning(
"Failed to check for a more recent version available with etelemetry: %s",
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ install_requires =
click
click-didyoumean
dandischema ~= 0.2.10
etelemetry >= 0.2.0
etelemetry >= 0.2.2
fasteners
fscacher
# Specifying != might be what causes pip 19.3.1 first to install hdmf 1.5.1
Expand Down

0 comments on commit cf0c118

Please sign in to comment.