recipetool: ignore zero-length setup.py files

If a setup.py file exists it ought to have something in it before we
consider the source tree to be a Python module and treating it as such.
(A counter-example is https://www.bro.org/downloads/binpac-0.50.tar.gz -
it's not clear why this has a zero-length setup.py in it but we should
pay no attention to it.)

Fixes [YOCTO #12923].

(From OE-Core rev: 548a5c8f42c6ac1b0f7962926d05276e71505678)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2019-07-02 16:23:59 +12:00 committed by Richard Purdie
parent 9a08720b3a
commit 1dffd9c2ec

View File

@ -154,8 +154,13 @@ class PythonRecipeHandler(RecipeHandler):
if 'buildsystem' in handled:
return False
if not RecipeHandler.checkfiles(srctree, ['setup.py']):
return
# Check for non-zero size setup.py files
setupfiles = RecipeHandler.checkfiles(srctree, ['setup.py'])
for fn in setupfiles:
if os.path.getsize(fn):
break
else:
return False
# setup.py is always parsed to get at certain required information, such as
# distutils vs setuptools