diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2001-09-03 15:47:21 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2001-09-03 15:47:21 (GMT) |
commit | a8aefe535c879c8b0f5201961648a89c8e3d7887 (patch) | |
tree | 350614bf5ffd24015a742bc27ef3d0437bb23e73 /Lib/distutils | |
parent | 49417e76d5fd52b1814db1b7be4cb6f4939a8c65 (diff) | |
download | cpython-a8aefe535c879c8b0f5201961648a89c8e3d7887.zip cpython-a8aefe535c879c8b0f5201961648a89c8e3d7887.tar.gz cpython-a8aefe535c879c8b0f5201961648a89c8e3d7887.tar.bz2 |
Don't use dir() to find instance attribute names.
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/dist.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index 3803f5c..40dcc96 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -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 |