add pydeps wip using modulefinder

doesn't appear to entirely work right, claims that it couldn't find
os.path for example. Need to somehow reduce the names to the top levels if that makes sense.
This commit is contained in:
Ross Burton 2024-05-08 13:07:01 +00:00
parent cc5e3503e4
commit c380234ecd
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,22 @@
inherit python3-dir
PACKAGEFUNCS += "package_generate_pydeps"
python package_generate_pydeps() {
import modulefinder
paths = (
d.expand("${RECIPE_SYSROOT}${PYTHON_SITEPACKAGES_DIR}"),
d.expand("${RECIPE_SYSROOT}${libdir}/${PYTHON_DIR}/")
)
finder = modulefinder.ModuleFinder(paths)
for pkg in d.getVar("PACKAGES").split():
for path in pkgfiles[pkg]:
if not path.endswith(".py"):
continue
bb.plain("Scanning %s" % path)
finder.load_file(path)
bb.plain("Modules found: " + " ".join(finder.modules.keys()))
bb.plain("Modules not found: " + " ".join(finder.badmodules.keys()))
}

View File

@ -49,3 +49,5 @@ RDEPENDS:${PN} += " \
RDEPENDS:${PN}-tests = "${PN}"
BBCLASSEXTEND = "native nativesdk"
inherit pydeps