We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
finalize_distribution_options
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
I tried this entry point definition in my setup.py
setup.py
# ./setup.py [setuptools.finalize_distribution_options] testfin = mypackage.integration:finalize
where finalize is a function with an order attribute defined, essentially like this:
order
# ./mypackage/integration.py def finalize(dist): # do something with dist finalize.order = 99
The order stays at the default of 0.
0
The relevant code in dist.py says:
dist.py
def finalize_options(self): hook_key = 'setuptools.finalize_distribution_options' 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): ep.load()(self)
So, by_order() looks at the entry point object for the order attribute instead of the actual underlying object.
by_order()
The following change would fix the problem, but is not elegant because load() would end up being called twice.
load()
def by_order(hook): return getattr(hook.load(), 'order', 0)
I will make a PR today to try and fix that in a better way.
Note that @jaraco random shuffle rational from #1877 is still valid, as they did not explicitly use the order attribute.
The text was updated successfully, but these errors were encountered:
4835f01
Successfully merging a pull request may close this issue.
Issue
I tried this entry point definition in my
setup.py
where finalize is a function with an
order
attribute defined, essentially like this:The order stays at the default of
0
.Cause
The relevant code in
dist.py
says:So,
by_order()
looks at the entry point object for theorder
attribute instead of the actual underlying object.Mitigation
The following change would fix the problem, but is not elegant because
load()
would end up being called twice.I will make a PR today to try and fix that in a better way.
Note that @jaraco random shuffle rational from #1877 is still valid, as they did not explicitly use the
order
attribute.The text was updated successfully, but these errors were encountered: