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
This commit is contained in:
Elod Illes 2022-03-26 11:13:25 +01:00
parent e82db3b3fc
commit 49970b3ceb
2 changed files with 7 additions and 2 deletions

View File

@ -16,4 +16,5 @@ import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
pbr=True,
py_modules=[])

View File

@ -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