From 472c79f95cc41a3e85d6b212347d6b006c9c3c26 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Thu, 14 Sep 2017 22:07:13 +0200 Subject: support `setup_requires` in setup.cfg --- setuptools/__init__.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'setuptools/__init__.py') diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 04f76740..7da47fbe 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -109,7 +109,27 @@ class PEP420PackageFinder(PackageFinder): find_packages = PackageFinder.find -setup = distutils.core.setup + +def _install_setup_requires(attrs): + # Note: do not use `setuptools.Distribution` directly, as + # our PEP 517 backend patch `distutils.core.Distribution`. + dist = distutils.core.Distribution(dict( + (k, v) for k, v in attrs.items() + if k in ('dependency_links', 'setup_requires') + )) + # Honor setup.cfg's options. + dist.parse_config_files(ignore_option_errors=True) + if dist.setup_requires: + dist.fetch_build_eggs(dist.setup_requires) + + +def setup(**attrs): + # Make sure we have any requirements needed to interpret 'attrs'. + _install_setup_requires(attrs) + return distutils.core.setup(**attrs) + +setup.__doc__ = distutils.core.setup.__doc__ + _Command = monkey.get_unpatched(distutils.core.Command) -- cgit v1.2.3 From cca86c7f1d4040834c3265ccecdd9e21b4036df5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 3 Jun 2018 09:50:25 -0400 Subject: Use Python 3 syntax for new-style clasess --- setuptools/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'setuptools/__init__.py') diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 7da47fbe..ce55ec35 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -15,6 +15,8 @@ from setuptools.dist import Distribution, Feature from setuptools.depends import Require from . import monkey +__metaclass__ = type + __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages', @@ -31,7 +33,7 @@ run_2to3_on_doctests = True lib2to3_fixer_packages = ['lib2to3.fixes'] -class PackageFinder(object): +class PackageFinder: """ Generate a list of all Python packages found within a directory """ -- cgit v1.2.3 From 2b7a2dd7bfd7d742c8816d45150b9e495f5970f8 Mon Sep 17 00:00:00 2001 From: Carsten Klein Date: Wed, 4 Jul 2018 10:04:01 -0400 Subject: Add find_packages_ns() This fixes GH #97 by introducing an alternate version of find_packages that works with PEP 420 namespace packages. --- setuptools/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'setuptools/__init__.py') diff --git a/setuptools/__init__.py b/setuptools/__init__.py index ce55ec35..e705f0d1 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -1,12 +1,14 @@ """Extensions to the 'distutils' for large or complex distributions""" import os +import sys import functools import distutils.core import distutils.filelist from distutils.util import convert_path from fnmatch import fnmatchcase +from setuptools.extern.six import PY3 from setuptools.extern.six.moves import filter, map import setuptools.version @@ -17,11 +19,15 @@ from . import monkey __metaclass__ = type + __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', - 'find_packages', + 'find_packages' ] +if PY3: + __all__.append('find_packages_ns') + __version__ = setuptools.version.__version__ bootstrap_install_from = None @@ -111,6 +117,9 @@ class PEP420PackageFinder(PackageFinder): find_packages = PackageFinder.find +if PY3: + find_packages_ns = PEP420PackageFinder.find + def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as -- cgit v1.2.3 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/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'setuptools/__init__.py') diff --git a/setuptools/__init__.py b/setuptools/__init__.py index e705f0d1..54309b57 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -26,7 +26,7 @@ __all__ = [ ] if PY3: - __all__.append('find_packages_ns') + __all__.append('find_namespace_packages') __version__ = setuptools.version.__version__ @@ -118,7 +118,7 @@ class PEP420PackageFinder(PackageFinder): find_packages = PackageFinder.find if PY3: - find_packages_ns = PEP420PackageFinder.find + find_namespace_packages = PEP420PackageFinder.find def _install_setup_requires(attrs): -- cgit v1.2.3 From 5854b0eba03dd257e30efff68f1632bdec5f0416 Mon Sep 17 00:00:00 2001 From: Junhan Huang Date: Sat, 27 Oct 2018 16:26:51 -0400 Subject: Add custom deprecation warning classes `DeprecationWarning` is not visible by default in the latest versions of CPython, so this switches the deprecation warnings in setuptools and pkg_resources over to custom classes derived from `Warning` instead. Fixes issue github issue #159 Co-authored-by: Junhan Huang Co-authored-by: Marton Pono --- setuptools/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'setuptools/__init__.py') diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 54309b57..e438036a 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -8,6 +8,8 @@ import distutils.filelist from distutils.util import convert_path from fnmatch import fnmatchcase +from ._deprecation_warning import SetuptoolsDeprecationWarning + from setuptools.extern.six import PY3 from setuptools.extern.six.moves import filter, map @@ -22,6 +24,7 @@ __metaclass__ = type __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', + 'SetuptoolsDeprecationWarning', 'find_packages' ] @@ -188,4 +191,5 @@ def findall(dir=os.curdir): return list(files) +# Apply monkey patches monkey.patch_all() -- cgit v1.2.3