[Python-checkins] distutils2: now a command can be any kind of class

tarek.ziade python-checkins at python.org
Mon Oct 11 16:42:37 CEST 2010


tarek.ziade pushed 5cefa438a1fc to distutils2:

http://hg.python.org/distutils2/rev/5cefa438a1fc
changeset:   763:5cefa438a1fc
tag:         tip
user:        Tarek Ziade <tarek at ziade.org>
date:        Mon Oct 11 16:42:22 2010 +0200
summary:     now a command can be any kind of class
files:       distutils2/dist.py

diff --git a/distutils2/dist.py b/distutils2/dist.py
--- a/distutils2/dist.py
+++ b/distutils2/dist.py
@@ -425,9 +425,11 @@
 
         # Require that the command class be derived from Command -- want
         # to be sure that the basic "command" interface is implemented.
-        if not issubclass(cmd_class, Command):
+        for meth in ('initialize_options', 'finalize_options', 'run'):
+            if hasattr(cmd_class, meth):
+                continue
             raise DistutilsClassError(
-                  "command class %s must subclass Command" % cmd_class)
+                  'command "%s" must implement "%s"' % (cmd_class. meth))
 
         # Also make sure that the command object provides a list of its
         # known options.

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list