Import command not module
authorGuido Günther <agx@sigxcpu.org>
Wed, 2 Apr 2014 22:04:18 +0000 (00:04 +0200)
committerGuido Günther <agx@sigxcpu.org>
Thu, 3 Apr 2014 16:05:33 +0000 (18:05 +0200)
This matches the function name

gbp/scripts/supercommand.py

index 4f2721f3553e3abeb1016014391e766f1d6d7763..2eb64de2aa2c657831c06650d4b4b3c307e053af 100644 (file)
@@ -44,10 +44,11 @@ The most commonly used commands are:
     import-dscs  - import multiple Debian source packages
 """
 
-def import_command(modulename):
+def import_command(cmd):
     """
     Import the module that implements the given command
     """
+    modulename = sanitize(cmd)
     if (not re.match(r'[a-z][a-z0-9_]', modulename) or
         modulename in invalid_modules):
         raise ImportError('Illegal module name %s' % modulename)
@@ -69,9 +70,8 @@ def supercommand(argv=None):
         usage()
         return 0
 
-    modulename = sanitize(cmd)
     try:
-        module = import_command(modulename)
+        module = import_command(cmd)
     except ImportError as e:
         print >>sys.stderr, "'%s' is not a valid command." % cmd
         usage()