python pod_strip_version() { import re def opener(filename, mode): if filename.endswith(".gz"): import gzip return gzip.open(filename, mode) elif filename.endswith(".bz2"): import bz2 return bz2.open(filename, mode) else: return open(filename, mode) bad_re = re.compile(rb"Automatically generated by Pod::Man( [0-9]+.+)") for root, dirs, files in os.walk(d.expand("${D}${mandir}")): for filename in files: filename = os.path.join(root, filename) if not os.path.isfile(filename): continue with opener(filename, "rb") as manfile: manpage = manfile.read() m = bad_re.search(manpage) if not m: continue bb.note("podfix: stripping version from %s" % filename) os.unlink(filename) with opener(filename, "wb") as manfile: manfile.write(manpage[:m.start(1)]) manfile.write(manpage[m.end(1):]) } do_install[postfuncs] += "pod_strip_version"