]> granicus.if.org Git - python/commitdiff
Don't use dir() to find instance attribute names.
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>
Mon, 3 Sep 2001 15:47:21 +0000 (15:47 +0000)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>
Mon, 3 Sep 2001 15:47:21 +0000 (15:47 +0000)
Lib/distutils/dist.py

index 3803f5cc681013cb27251ede7c2971aef10e8a94..40dcc96e27fd5742e2a642ba721e3c485cf7efee 100644 (file)
@@ -122,9 +122,7 @@ class Distribution:
         # worth it.  Also delegate 'get_XXX()' methods to the 'metadata'
         # object in a sneaky and underhanded (but efficient!) way.
         self.metadata = DistributionMetadata()
-        method_basenames = dir(self.metadata) + \
-                           ['fullname', 'contact', 'contact_email']
-        for basename in method_basenames:
+        for basename in self.metadata._METHOD_BASENAMES:
             method_name = "get_" + basename
             setattr(self, method_name, getattr(self.metadata, method_name))
 
@@ -962,6 +960,12 @@ class DistributionMetadata:
     author, and so forth.
     """
 
+    _METHOD_BASENAMES = ("name", "version", "author", "author_email",
+                         "maintainer", "maintainer_email", "url",
+                         "license", "description", "long_description",
+                         "keywords", "platforms", "fullname", "contact",
+                         "contact_email", "licence")
+
     def __init__ (self):
         self.name = None
         self.version = None