aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/config.py
diff options
context:
space:
mode:
authoridle sign <idlesign@yandex.ru>2016-12-10 13:33:57 +0700
committerJason R. Coombs <jaraco@jaraco.com>2016-12-10 11:23:00 -0500
commita262947e39e6125ee15d3752a2124acf0c62bda6 (patch)
treedcd271dbd114a22e19dac3f18b2f3fccb1740bb7 /setuptools/config.py
parentb73891f82d5f1a353a2ad0090b1f5edece921508 (diff)
downloadexternal_python_setuptools-a262947e39e6125ee15d3752a2124acf0c62bda6.tar.gz
external_python_setuptools-a262947e39e6125ee15d3752a2124acf0c62bda6.tar.bz2
external_python_setuptools-a262947e39e6125ee15d3752a2124acf0c62bda6.zip
Implemented find() configuration support for `packages`.
Diffstat (limited to 'setuptools/config.py')
-rw-r--r--setuptools/config.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/setuptools/config.py b/setuptools/config.py
index 007d24e2..743575f0 100644
--- a/setuptools/config.py
+++ b/setuptools/config.py
@@ -361,7 +361,10 @@ class ConfigHandler(object):
method_postfix = '_%s' % section_name
section_parser_method = getattr(
- self, 'parse_section%s' % method_postfix, None)
+ self,
+ # Dots in section names are tranlsated into dunderscores.
+ ('parse_section%s' % method_postfix).replace('.', '__'),
+ None)
if section_parser_method is None:
raise DistutilsOptionError(
@@ -481,8 +484,34 @@ class ConfigOptionsHandler(ConfigHandler):
if not value.startswith(find_directive):
return self._parse_list(value)
+ # Read function arguments from a dedicated section.
+ find_kwargs = self.parse_section_packages__find(
+ self.sections.get('packages.find', {}))
+
from setuptools import find_packages
- return find_packages()
+
+ return find_packages(**find_kwargs)
+
+ def parse_section_packages__find(self, section_options):
+ """Parses `packages.find` configuration file section.
+
+ To be used in conjunction with _parse_packages().
+
+ :param dict section_options:
+ """
+ section_data = self._parse_section_to_dict(
+ section_options, self._parse_list)
+
+ valid_keys = ['where', 'include', 'exclude']
+
+ find_kwargs = dict(
+ [(k, v) for k, v in section_data.items() if k in valid_keys and v])
+
+ where = find_kwargs.get('where')
+ if where is not None:
+ find_kwargs['where'] = where[0] # cast list to single val
+
+ return find_kwargs
def parse_section_entry_points(self, section_options):
"""Parses `entry_points` configuration file section.