From 1a8c645fc50f6589015226c15edf1e6fe33e6f3e Mon Sep 17 00:00:00 2001 From: Elod Illes Date: Sat, 26 Mar 2022 11:13:25 +0100 Subject: [PATCH] Disable auto-discovery for setuptools With setuptools release 61.0.0 ansible-role-thales-hsm's package build command (python3 setup.py sdist bdist_wheel) started to fail: error: Multiple top-level packages discovered in a flat-layout: ['files', 'defaults', 'handlers', 'templates', 'releasenotes']. This bug is mentioned in setuptools issue 3197 [1], and the suggested workaround is to disable auto-discovery by adding 'py_modules=[]' in setup.py. ansible-lint also released a new version (6.0.0), which has new rules that blocks the gate. As a workaround, this patch caps ansible-lint version <6.0.0 to unblock the gate. [1] https://github.com/pypa/setuptools/issues/3197 Change-Id: Idb765d09f9498bc13f952c055026e29a46cab8d3 (cherry picked from commit 49970b3ceb66a87c3d3e95ac77eda9ffd6b5a0f1) (cherry picked from commit 3f88a20fe91e8e3a8f870a5f9a95951a3a91d7ef) --- setup.py | 3 ++- test-requirements.txt | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6a931a6..d2f0760 100644 --- a/setup.py +++ b/setup.py @@ -16,4 +16,5 @@ import setuptools setuptools.setup( setup_requires=['pbr'], - pbr=True) + pbr=True, + py_modules=[]) diff --git a/test-requirements.txt b/test-requirements.txt index 6dd128e..d3f9dee 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1,5 @@ -ansible-lint +# NOTE(elod.illes): ansible 6.0.0 introduced new rules that needs to be +# fixed, like fqcn-builtins, etc. Due to Yoga release happens soon +# let's just cap ansible-lint. This needs a separate fix in the future +# to be able to remove the cap. +ansible-lint<6.0.0