From 78b0ba506259895916784978a939ff71474308e2 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 30 Mar 2022 08:07:35 -0700 Subject: [PATCH] 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 --- setup.cfg | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/setup.cfg b/setup.cfg index 33acc097a9..b1d3b6fb70 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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