Workaround setuptools 61.0.0 package auto discovery problems

New setuptools is auto discoverying multiple package dirs in our repo
because multiple top level dirs contain python content. While auto
discovery excludes common dirs like doc/, testinfra/, and tools/ others
are not excluded from discovery like playbooks/ and docker/. This
results in an error as auto discovery is only valid if a single possible
package dir is discovered.

It would be preferable to exclude the additional dirs instead but I
can't seem to find a way to do that. The documentation can be found at:

  https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#automatic-discovery

To workaround this we tell setuptools to not auto discovery packages by
setting an empty packages list in setup.cfg. Then we rely on PBR to do
its job and find the package content via git repo information.

Change-Id: I4d334880acb84de709dfc3090a86ec2d43e406f8
This commit is contained in:
Clark Boylan 2022-03-30 08:07:35 -07:00
parent 7a7edb11cd
commit 78b0ba5062
1 changed files with 10 additions and 0 deletions

View File

@ -14,6 +14,16 @@ classifier =
Operating System :: POSIX :: Linux
Programming Language :: Python
# This is here to workaround setuptools automatic package discovery problems.
# Setuptools finds multiple packages which is an error with autodiscovery.
# This is due to having python files in separate top level dirs that are not
# excluded from searching. All of this is documented at:
# https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#automatic-discovery
# We essentially bypass it by telling it there are no packages to discover
# then rely on PBR to find the package for us instead.
[options]
packages =
[build_sphinx]
all_files = 1
build-dir = doc/build