Commit 11d130d1 authored by Kirill Smelkov's avatar Kirill Smelkov

setup: Ensure setuptools.file_finders entry-point group is registered

If setuptools.file_finders group is not registered,
dist.get_entry_map('setuptools.file_finders') returns just {} not
connected to entry map, and further modifications of this dict go
nowhere (and thus, our git_lsfiles() is not hooked -> sdist fails to
produce correct source archive).

This is a workaround for setuptools 9.0 dropping
`setuptools.file_finders` entrypoint group registration:

    https://bitbucket.org/pypa/setuptools/commits/f191c8a1225bd58a5fb5aa9abb31b06dc710f0b9#Lsetup.pyF175
    https://bitbucket.org/pypa/setuptools/issue/313

issue reported back:

    https://bitbucket.org/pypa/setuptools/issue/313#comment-18430008
parent 0e25b01c
...@@ -145,6 +145,20 @@ class build_ext(_build_ext): ...@@ -145,6 +145,20 @@ class build_ext(_build_ext):
def register_as_entrypoint(func, entryname, groupname, distname): def register_as_entrypoint(func, entryname, groupname, distname):
from pkg_resources import working_set, EntryPoint from pkg_resources import working_set, EntryPoint
dist = working_set.by_key[distname] dist = working_set.by_key[distname]
# workaround for setuptools 9.0 dropping `setuptools.file_finders` entrypoint
# group registration:
# https://bitbucket.org/pypa/setuptools/commits/f191c8a1225bd58a5fb5aa9abb31b06dc710f0b9#Lsetup.pyF175
# https://bitbucket.org/pypa/setuptools/issue/313
# issue reported back:
# https://bitbucket.org/pypa/setuptools/issue/313#comment-18430008
#
# register group if it is not yet registered
# else dist.get_entry_map(groupname) returns just {} not connected to entry map
entry_map = dist.get_entry_map()
if groupname not in entry_map:
entry_map[groupname] = {}
entrypoint = EntryPoint(entryname, func.__module__, attrs=(func.__name__,), entrypoint = EntryPoint(entryname, func.__module__, attrs=(func.__name__,),
extras=(), dist=dist) extras=(), dist=dist)
group = dist.get_entry_map(groupname) group = dist.get_entry_map(groupname)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment