diff options
author | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-11-14 22:27:18 +0000 |
---|---|---|
committer | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-11-14 22:27:18 +0000 |
commit | fa6fb5c9da640532db63db2aa9111c523cb35fe4 (patch) | |
tree | 2d8ef6fa4612960b3f19c467b3e0a6c5e100fa9c | |
parent | a927524c43d391579a17b3630606f350f44acf3c (diff) | |
download | mgarepo-fa6fb5c9da640532db63db2aa9111c523cb35fe4.tar mgarepo-fa6fb5c9da640532db63db2aa9111c523cb35fe4.tar.gz mgarepo-fa6fb5c9da640532db63db2aa9111c523cb35fe4.tar.bz2 mgarepo-fa6fb5c9da640532db63db2aa9111c523cb35fe4.tar.xz mgarepo-fa6fb5c9da640532db63db2aa9111c523cb35fe4.zip |
Don't say "invalid command CMD" when this is not the real error
Sometimes when a module used by repsys is missing, the given error message
is "invalid command CMD", instead of a exception trace showing that there's
something wrong with with the repsys setup.
This change fixes this issue by counting the number of frames in the
exception trace. When the command module is not available there will be
only one frame (being the function that is trying to import the command's
module), otherwise there will be more frames (because the found module will
already be present in the trace).
This fix is probably valid for smart too.
-rw-r--r-- | CHANGES | 2 | ||||
-rwxr-xr-x | repsys | 9 |
2 files changed, 6 insertions, 5 deletions
@@ -3,6 +3,8 @@ - make 'repsys submit' without package name or revision number work again - the fix for the unreleased commits problem in the previous release was wrong, really fixed it +- don't give the wrong message "invalid command 'CMD'" when this is not + the case * 1.6.19 - added complement for SILENT: CLOG, which hides everything that does not @@ -65,11 +65,10 @@ def dispatch_command(command, argv, debug=0): commands_module = getattr(repsys_module, "commands") command_module = getattr(commands_module, command) except (ImportError, AttributeError): - if debug: - import traceback - traceback.print_exc() - sys.exit(1) - raise Error, "invalid command '%s'" % command + etype, exc, tb = sys.exc_info() + if tb.tb_next is None and not debug: + raise Error, "invalid command '%s'" % command + raise command_module.main() if __name__ == "__main__": |