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.

(From OE-Core rev: 252b69c9f2abe3258366c540f56b156ed63e5437)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2018-12-07 00:04:50 +00:00
parent 0985ac745f
commit 7843548285
5 changed files with 19 additions and 19 deletions

View File

@@ -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