waf uses an inline tar file extracted by the tarfile module. The tarfile module may print a warning when used with default 'filter' argument[0].
When called to get the version, the first time after unpack, the output may look like: # output from lower modules (e.g: warnings from tarfile, ...) waf X.Y.Z ... This patch makes the version parsing more precise by looking at the first line matching "waf ". [0]: https://docs.python.org/3.12/library/tarfile.html#extraction-filters Signed-off-by: Yoann Congal <yoann.con...@smile.fr> --- meta/classes-recipe/waf.bbclass | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/meta/classes-recipe/waf.bbclass b/meta/classes-recipe/waf.bbclass index 70bf3be8fd..01707c8e2c 100644 --- a/meta/classes-recipe/waf.bbclass +++ b/meta/classes-recipe/waf.bbclass @@ -54,11 +54,21 @@ python waf_preconfigure() { wafbin = os.path.join(subsrcdir, 'waf') try: result = subprocess.check_output([python, wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT) - version = result.decode('utf-8').split()[1] - if not bb.utils.is_semver(version): + # Output looks like: + # # output from lower modules (e.g. warnings, ...) + # waf X.Y.Z ... + # So, look for the line starting with "waf " + version = None + for line in result.decode('utf-8').split("\n"): + if line.startswith("waf "): + version = line.split()[1] + break + + if not version or not bb.utils.is_semver(version): bb.warn("Unable to parse \"waf --version\" output. Assuming waf version without bindir/libdir support.") bb.warn("waf·--version·output = \n%s" % result.decode('utf-8')) elif bb.utils.vercmp_string_op(version, "1.8.7", ">="): + bb.note("waf version is high enough to add --bindir and --libdir") d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}") except subprocess.CalledProcessError as e: bb.warn("Unable to execute waf --version, exit code %d. Assuming waf version without bindir/libdir support." % e.returncode) -- 2.39.2
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#196425): https://lists.openembedded.org/g/openembedded-core/message/196425 Mute This Topic: https://lists.openembedded.org/mt/104640694/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-