Skip to content

Commit

Permalink
Trac #27670: package install can print confusing error messages
Browse files Browse the repository at this point in the history
For example, while installing the kash3 package, the output includes the
following lines:

{{{
usage: sage-spkg-uninstall [-h] [-v] [-k] spkg [sage_local]
sage-spkg-uninstall: error: argument spkg: invalid spkg_type value:
'kash3'
}}}

This is due to the uninstall script throwing incorrect error types.
After applying this ticket's patch, the output reads:

{{{
usage: sage-spkg-uninstall [-h] [-v] [-k] spkg [sage_local]
sage-spkg-uninstall: error: argument spkg: 'kash3' is not a known spkg
}}}

Which is at least more sensible.  `kash3` is not known because it is an
old-style package that didn't create a directory in `build/pkgs`.

URL: https://trac.sagemath.org/27670
Reported by: gh-BrentBaccala
Ticket author(s): Brent Baccala
Reviewer(s): Erik Bray
  • Loading branch information
Release Manager authored and vbraun committed May 2, 2019
2 parents 90333e0 + f0afed6 commit 4d8a9c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build/sage_bootstrap/uninstall.py
Expand Up @@ -252,7 +252,7 @@ def dir_type(path):
"""

if path and not pth.isdir(path):
raise argparse.ArgumentError(
raise argparse.ArgumentTypeError(
"'{0}' is not a directory".format(path))

return path
Expand All @@ -267,7 +267,7 @@ def spkg_type(pkg):
pkgbase = pth.join(PKGS, pkg)

if not pth.isdir(pkgbase):
raise argparse.ArgumentError(
raise argparse.ArgumentTypeError(
"'{0}' is not a known spkg".format(pkg))

return pkg
Expand Down

0 comments on commit 4d8a9c1

Please sign in to comment.