]> granicus.if.org Git - python/commitdiff
Define 'self.force' in the constructor and remove the hack in '__getattr__()'
authorGreg Ward <gward@python.net>
Mon, 10 Apr 2000 13:11:51 +0000 (13:11 +0000)
committerGreg Ward <gward@python.net>
Mon, 10 Apr 2000 13:11:51 +0000 (13:11 +0000)
to account for it not being defined in the constructor.

Lib/distutils/cmd.py

index 16008c4fd0389593508292ab172d961a70b58a8b..b3d16648d0b510fe749cbd69c6e3f832b246e08b 100644 (file)
@@ -59,6 +59,12 @@ class Command:
         self._verbose = None
         self._dry_run = None
 
+        # Some commands define a 'self.force' option to ignore file
+        # timestamps, but methods defined *here* assume that
+        # 'self.force' exists for all commands.  So define it here
+        # just to be safe.
+        self.force = None
+
         # The 'help' flag is just used for command-line parsing, so
         # none of that complicated bureaucracy is needed.
         self.help = 0
@@ -79,11 +85,6 @@ class Command:
                 return getattr (self.distribution, attr)
             else:
                 return myval
-
-        # Needed because some Command methods assume 'self.force' exists,
-        # but not all commands define 'self.force'.  Ugh.
-        elif attr == 'force':
-            return None
         else:
             raise AttributeError, attr