-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new hook 'setuptools.finalize_distribution_options' #1877
Conversation
…ike 'setuptools_scm' to alter distribution options.
@jaraco thanks for beginning this, is there anything i can/should do to help bring this along |
Now that setuptools dogfoods this feature, it's covered by the existing tests. |
At this point, I'm prepared to accept this feature at least experimentally for setuptools_scm to leverage. I still have one lingering concern:
To that end, I've added this patch locally: diff --git a/setuptools/dist.py b/setuptools/dist.py
index 44990431..b2bdc409 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -7,6 +7,7 @@ import re
import os
import warnings
import numbers
+import random
import distutils.log
import distutils.core
import distutils.cmd
@@ -734,8 +735,9 @@ class Distribution(_Distribution):
def by_order(hook):
return getattr(hook, 'order', 0)
- eps = pkg_resources.iter_entry_points(hook_key)
- for ep in sorted(eps, key=by_order):
+ eps = list(pkg_resources.iter_entry_points(hook_key))
+ random.shuffle(eps)
+ for ep in eps:
ep.load()(self)
def _finalize_setup_keywords(self): And then run the tests several times, which gives me strong confidence that there's no order dependency on the built-in finalizers, so I'm comfortable leaving the default finalizers at the default order index of 0. Paul, since you were looking at the reported ticket, would you review this change? |
@jaraco awesome, this is great, cant wait to pull in the setuptools_scm follow-up and apply it to pytest/others |
Thanks, I started work on a similar patch but didn't make much headway. I'm relieved to see this is getting done. |
Summary of changes
Allows plugins like 'setuptools_scm' to alter distribution options (such as in pypa/setuptools_scm#364).
Closes #1055
Pull Request Checklist