Merge pull request #1994 from con-f-use/master

honor order attribute in "finalize_distibution_options" group of entrypoints
This commit is contained in:
Jason R. Coombs 2020-02-15 18:16:14 -05:00 committed by GitHub
commit ad8bfa8825
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -0,0 +1 @@
Fixed a bug in the "setuptools.finalize_distribution_options" hook that lead to ignoring the order attribute of entry points managed by this hook.

View File

@ -731,13 +731,13 @@ class Distribution(_Distribution):
to influence the order of execution. Smaller numbers
go first and the default is 0.
"""
hook_key = 'setuptools.finalize_distribution_options'
group = 'setuptools.finalize_distribution_options'
def by_order(hook):
return getattr(hook, 'order', 0)
eps = pkg_resources.iter_entry_points(hook_key)
eps = map(lambda e: e.load(), pkg_resources.iter_entry_points(group))
for ep in sorted(eps, key=by_order):
ep.load()(self)
ep(self)
def _finalize_setup_keywords(self):
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):