diff Lib/packaging/command/__init__.py @ 72126:e4576486544c

Cleanup: move code out of a try block
author Éric Araujo <merwok@netwok.org>
date Tue, 30 Aug 2011 00:45:59 +0200
parents 1a31c3be88b1
children 6330a08cfedf
line wrap: on
line diff
--- a/Lib/packaging/command/__init__.py	Mon Aug 29 22:03:46 2011 +0200
+++ b/Lib/packaging/command/__init__.py	Tue Aug 30 00:45:59 2011 +0200
@@ -30,6 +30,8 @@
     'upload': 'packaging.command.upload.upload',
     'upload_docs': 'packaging.command.upload_docs.upload_docs'}
 
+# XXX use OrderedDict to preserve the grouping (build-related, install-related,
+# distribution-related)
 STANDARD_COMMANDS = set(_COMMANDS)
 
 
@@ -48,9 +50,9 @@
     """Return the registered command"""
     try:
         cls = _COMMANDS[name]
-        if isinstance(cls, str):
-            cls = resolve_name(cls)
-            _COMMANDS[name] = cls
-        return cls
     except KeyError:
         raise PackagingModuleError("Invalid command %s" % name)
+    if isinstance(cls, str):
+        cls = resolve_name(cls)
+        _COMMANDS[name] = cls
+    return cls