From 0254a2fda8e8bd4f289d01e2179191e936517f04 Mon Sep 17 00:00:00 2001 From: Carsten Klein Date: Fri, 17 Aug 2018 14:58:35 +0200 Subject: Rename find_namepaces_ns to find_namespace_packages (#1423) * fix #1419 PEP420: add find_namespace: directive * fix #1419 PEP420: add find_namespace: directive to documentation * fix #1419 PEP420: add tests * fix #1419 PEP420: clean up code * fix #1419 PEP420: fix typo in documentation * fix #1419 PEP420: fix typo in documentation * fix #1419 PEP420: clean up code * fix #1419 PEP420: add changelog entry * fixup! fix #1419 PEP420: add tests * fix #1419 PEP420: cleanup code refactor markers * #1420: Rename find_namespace_ns to find_namespace_packages * #1420: update changelog entry --- setuptools/config.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'setuptools/config.py') diff --git a/setuptools/config.py b/setuptools/config.py index 5f908cf1..0da3dbc9 100644 --- a/setuptools/config.py +++ b/setuptools/config.py @@ -8,7 +8,7 @@ from importlib import import_module from distutils.errors import DistutilsOptionError, DistutilsFileError from setuptools.extern.packaging.version import LegacyVersion, parse -from setuptools.extern.six import string_types +from setuptools.extern.six import string_types, PY3 __metaclass__ = type @@ -515,16 +515,24 @@ class ConfigOptionsHandler(ConfigHandler): :param value: :rtype: list """ - find_directive = 'find:' + find_directives = ['find:', 'find_namespace:'] + trimmed_value = value.strip() - if not value.startswith(find_directive): + if not trimmed_value in find_directives: return self._parse_list(value) + findns = trimmed_value == find_directives[1] + if findns and not PY3: + raise DistutilsOptionError('find_namespace: directive is unsupported on Python < 3.3') + # Read function arguments from a dedicated section. find_kwargs = self.parse_section_packages__find( self.sections.get('packages.find', {})) - from setuptools import find_packages + if findns: + from setuptools import find_namespace_packages as find_packages + else: + from setuptools import find_packages return find_packages(**find_kwargs) -- cgit v1.2.3