From 252b69c9f2abe3258366c540f56b156ed63e5437 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 7 Dec 2018 00:04:50 +0000 Subject: classes: Correctly markup regex strings There are various escape characters in these stings which python warns about so use the correct regex markup for them. Signed-off-by: Richard Purdie --- meta/classes/license_image.bbclass | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'meta/classes/license_image.bbclass') diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass index 6515ee8278..6ac63e0192 100644 --- a/meta/classes/license_image.bbclass +++ b/meta/classes/license_image.bbclass @@ -52,8 +52,8 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): except oe.license.LicenseError as exc: bb.fatal('%s: %s' % (d.getVar('P'), exc)) else: - pkg_dic[pkg]["LICENSES"] = re.sub('[|&()*]', ' ', pkg_dic[pkg]["LICENSE"]) - pkg_dic[pkg]["LICENSES"] = re.sub(' *', ' ', pkg_dic[pkg]["LICENSES"]) + pkg_dic[pkg]["LICENSES"] = re.sub(r'[|&()*]', ' ', pkg_dic[pkg]["LICENSE"]) + pkg_dic[pkg]["LICENSES"] = re.sub(r' *', ' ', pkg_dic[pkg]["LICENSES"]) pkg_dic[pkg]["LICENSES"] = pkg_dic[pkg]["LICENSES"].split() if not "IMAGE_MANIFEST" in pkg_dic[pkg]: @@ -78,7 +78,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): for lic in pkg_dic[pkg]["LICENSES"]: lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY'), pkg_dic[pkg]["PN"], "generic_%s" % - re.sub('\+', '', lic)) + re.sub(r'\+', '', lic)) # add explicity avoid of CLOSED license because isn't generic if lic == "CLOSED": continue @@ -119,14 +119,14 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): pkg_license = os.path.join(pkg_license_dir, lic) pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic) - if re.match("^generic_.*$", lic): + if re.match(r"^generic_.*$", lic): generic_lic = canonical_license(d, - re.search("^generic_(.*)$", lic).group(1)) + re.search(r"^generic_(.*)$", lic).group(1)) # Do not copy generic license into package if isn't # declared into LICENSES of the package. - if not re.sub('\+$', '', generic_lic) in \ - [re.sub('\+', '', lic) for lic in \ + if not re.sub(r'\+$', '', generic_lic) in \ + [re.sub(r'\+', '', lic) for lic in \ pkg_manifest_licenses]: continue -- cgit 1.2.3-korg