(self, command)
Return the class that implements the Distutils command named by
        'command'.  First we check the 'cmdclass' dictionary; if the
        command is mentioned there, we fetch the class object from the
        dictionary and return it.  Otherwise we load the command module
        ("distutils.command." + command) and fetch the command class from
        the module.  The loaded class is also stored in 'cmdclass'
        to speed future calls to 'get_command_class()'.

        Raises DistutilsModuleError if the expected module could not be
        found, or if that module does not define the expected class.
Return the class that implements the Distutils command named by
        'command'.  First we check the 'cmdclass' dictionary; if the
        command is mentioned there, we fetch the class object from the
        dictionary and return it.  Otherwise we load the command module
        ("distutils.command." + command) and fetch the command class from
        the module.  The loaded class is also stored in 'cmdclass'
        to speed future calls to 'get_command_class()'.
Return the class that implements the Distutils command named by command . First we check the cmdclass dictionary ; if the command is mentioned there we fetch the class object from the dictionary and return it . Otherwise we load the command module ( distutils . command . + command ) and fetch the command class from the module . The loaded class is also stored in cmdclass to speed future calls to get_command_class () .
def get_command_class(self, command):
        """Return the class that implements the Distutils command named by
        'command'.  First we check the 'cmdclass' dictionary; if the
        command is mentioned there, we fetch the class object from the
        dictionary and return it.  Otherwise we load the command module
        ("distutils.command." + command) and fetch the command class from
        the module.  The loaded class is also stored in 'cmdclass'
        to speed future calls to 'get_command_class()'.

        Raises DistutilsModuleError if the expected module could not be
        found, or if that module does not define the expected class.
        """
        klass = self.cmdclass.get(command)
        if klass:
            return klass

        for pkgname in self.get_command_packages():
            module_name = "%s.%s" % (pkgname, command)
            klass_name = command

            try:
                __import__(module_name)
                module = sys.modules[module_name]
            except ImportError:
                continue

            try:
                klass = getattr(module, klass_name)
            except AttributeError:
                raise DistutilsModuleError(
                    "invalid command '%s' (no class '%s' in module '%s')"
                    % (command, klass_name, module_name))

            self.cmdclass[command] = klass
            return klass

        raise DistutilsModuleError("invalid command '%s'" % command)
def get_command_class ( self , command ) : klass = self . cmdclass . get ( command ) if klass : return klass for pkgname in self . get_command_packages ( ) : module_name = "%s.%s" % ( pkgname , command ) klass_name = command try : __import__ ( module_name ) module = sys . modules [ module_name ] except ImportError : continue try : klass = getattr ( module , klass_name ) except AttributeError : raise DistutilsModuleError ( "invalid command '%s' (no class '%s' in module '%s')" % ( command , klass_name , module_name ) ) self . cmdclass [ command ] = klass return klass raise DistutilsModuleError ( "invalid command '%s'" % command )