summaryrefslogtreecommitdiff
path: root/setuptools/config.py
diff options
context:
space:
mode:
authoridle sign <idlesign@yandex.ru>2016-12-04 17:11:37 +0700
committeridle sign <idlesign@yandex.ru>2016-12-04 17:11:37 +0700
commit21333fe86db1888dbee134043ea8a2f85b69d439 (patch)
tree92d03d00444d467ccb9bd0e52da867f7967612dc /setuptools/config.py
parent68c03bee07c55a9c337f1cb98fc102a3710add4b (diff)
downloadpython-setuptools-git-21333fe86db1888dbee134043ea8a2f85b69d439.tar.gz
Added `metadata` section aliases.
Diffstat (limited to 'setuptools/config.py')
-rw-r--r--setuptools/config.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/setuptools/config.py b/setuptools/config.py
index a04c3ce8..0c88df79 100644
--- a/setuptools/config.py
+++ b/setuptools/config.py
@@ -18,6 +18,12 @@ class ConfigHandler(object):
"""
+ aliases = {}
+ """Options aliases.
+ For compatibility with various packages. E.g.: d2to1 and pbr.
+
+ """
+
strict_mode = True
"""Flag. Whether unknown options in config should
raise DistutilsOptionError exception, or pass silently.
@@ -48,6 +54,9 @@ class ConfigHandler(object):
unknown = tuple()
target_obj = self.target_obj
+ # Translate alias into real name.
+ option_name = self.aliases.get(option_name, option_name)
+
current_value = getattr(target_obj, option_name, unknown)
if current_value is unknown:
@@ -216,9 +225,18 @@ class ConfigHandler(object):
class ConfigMetadataHandler(ConfigHandler):
section_prefix = 'metadata'
+
+ aliases = {
+ 'author-email': 'author_email',
+ 'home_page': 'url',
+ 'summary': 'description',
+ 'classifier': 'classifiers',
+ 'platform': 'platforms',
+ }
+
strict_mode = False
- """We need to keep it loose, to be compatible with `pbr` package
- which also uses `metadata` section.
+ """We need to keep it loose, to be partially compatible with
+ `pbr` and `d2to1` packages which also uses `metadata` section.
"""