diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-14 15:49:50 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-16 15:35:07 +0000 |
commit | cd4b8a8553f9d551af27941910cf4d3405ecb7b0 (patch) | |
tree | 4f2c58eca95fd5ea9a4538a66a4875fd9d947b0d /meta/lib/oe | |
parent | 1ee53881eea3a7ca4d4f6a5ca9c4c6e6488d2348 (diff) | |
download | poky-cd4b8a8553f9d551af27941910cf4d3405ecb7b0.tar.gz |
meta: Fix Deprecated warnings from regexs
Fix handling of escape characters in regexs and hence fix python
Deprecation warnings which will be problematic in python 3.8.
Note that some show up as:
"""
meta/classes/package.bbclass:1293: DeprecationWarning: invalid escape sequence \.
"""
where the problem isn't on 1293 in package.bbclass but in some _prepend to a
package.bbclass function in a different file like mesa.inc, often from
do_package_split() calls.
(From OE-Core rev: 4b1c0c7d5525fc4cea9e0f02ec54e92a6fbc6199)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/license.py | 8 | ||||
-rw-r--r-- | meta/lib/oe/package.py | 2 | ||||
-rw-r--r-- | meta/lib/oe/package_manager.py | 24 | ||||
-rw-r--r-- | meta/lib/oe/patch.py | 4 | ||||
-rw-r--r-- | meta/lib/oe/rootfs.py | 16 | ||||
-rw-r--r-- | meta/lib/oe/utils.py | 4 |
6 files changed, 29 insertions, 29 deletions
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py index ca385d5187..04f5b316a9 100644 --- a/meta/lib/oe/license.py +++ b/meta/lib/oe/license.py | |||
@@ -13,8 +13,8 @@ def license_ok(license, dont_want_licenses): | |||
13 | # will exclude a trailing '+' character from LICENSE in | 13 | # will exclude a trailing '+' character from LICENSE in |
14 | # case INCOMPATIBLE_LICENSE is not a 'X+' license. | 14 | # case INCOMPATIBLE_LICENSE is not a 'X+' license. |
15 | lic = license | 15 | lic = license |
16 | if not re.search('\+$', dwl): | 16 | if not re.search(r'\+$', dwl): |
17 | lic = re.sub('\+', '', license) | 17 | lic = re.sub(r'\+', '', license) |
18 | if fnmatch(lic, dwl): | 18 | if fnmatch(lic, dwl): |
19 | return False | 19 | return False |
20 | return True | 20 | return True |
@@ -40,8 +40,8 @@ class InvalidLicense(LicenseError): | |||
40 | return "invalid characters in license '%s'" % self.license | 40 | return "invalid characters in license '%s'" % self.license |
41 | 41 | ||
42 | license_operator_chars = '&|() ' | 42 | license_operator_chars = '&|() ' |
43 | license_operator = re.compile('([' + license_operator_chars + '])') | 43 | license_operator = re.compile(r'([' + license_operator_chars + '])') |
44 | license_pattern = re.compile('[a-zA-Z0-9.+_\-]+$') | 44 | license_pattern = re.compile(r'[a-zA-Z0-9.+_\-]+$') |
45 | 45 | ||
46 | class LicenseVisitor(ast.NodeVisitor): | 46 | class LicenseVisitor(ast.NodeVisitor): |
47 | """Get elements based on OpenEmbedded license strings""" | 47 | """Get elements based on OpenEmbedded license strings""" |
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index efd36b3758..6e83f01f14 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py | |||
@@ -255,7 +255,7 @@ def read_shlib_providers(d): | |||
255 | 255 | ||
256 | shlib_provider = {} | 256 | shlib_provider = {} |
257 | shlibs_dirs = d.getVar('SHLIBSDIRS').split() | 257 | shlibs_dirs = d.getVar('SHLIBSDIRS').split() |
258 | list_re = re.compile('^(.*)\.list$') | 258 | list_re = re.compile(r'^(.*)\.list$') |
259 | # Go from least to most specific since the last one found wins | 259 | # Go from least to most specific since the last one found wins |
260 | for dir in reversed(shlibs_dirs): | 260 | for dir in reversed(shlibs_dirs): |
261 | bb.debug(2, "Reading shlib providers in %s" % (dir)) | 261 | bb.debug(2, "Reading shlib providers in %s" % (dir)) |
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 7ff76c61cd..1087144d47 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
@@ -29,7 +29,7 @@ def opkg_query(cmd_output): | |||
29 | a dictionary with the information of the packages. This is used | 29 | a dictionary with the information of the packages. This is used |
30 | when the packages are in deb or ipk format. | 30 | when the packages are in deb or ipk format. |
31 | """ | 31 | """ |
32 | verregex = re.compile(' \([=<>]* [^ )]*\)') | 32 | verregex = re.compile(r' \([=<>]* [^ )]*\)') |
33 | output = dict() | 33 | output = dict() |
34 | pkg = "" | 34 | pkg = "" |
35 | arch = "" | 35 | arch = "" |
@@ -252,8 +252,8 @@ class DpkgIndexer(Indexer): | |||
252 | with open(os.path.join(self.d.expand("${STAGING_ETCDIR_NATIVE}"), | 252 | with open(os.path.join(self.d.expand("${STAGING_ETCDIR_NATIVE}"), |
253 | "apt", "apt.conf.sample")) as apt_conf_sample: | 253 | "apt", "apt.conf.sample")) as apt_conf_sample: |
254 | for line in apt_conf_sample.read().split("\n"): | 254 | for line in apt_conf_sample.read().split("\n"): |
255 | line = re.sub("#ROOTFS#", "/dev/null", line) | 255 | line = re.sub(r"#ROOTFS#", "/dev/null", line) |
256 | line = re.sub("#APTCONF#", self.apt_conf_dir, line) | 256 | line = re.sub(r"#APTCONF#", self.apt_conf_dir, line) |
257 | apt_conf.write(line + "\n") | 257 | apt_conf.write(line + "\n") |
258 | 258 | ||
259 | def write_index(self): | 259 | def write_index(self): |
@@ -408,7 +408,7 @@ class PackageManager(object, metaclass=ABCMeta): | |||
408 | with open(postinst_intercept_hook) as intercept: | 408 | with open(postinst_intercept_hook) as intercept: |
409 | registered_pkgs = None | 409 | registered_pkgs = None |
410 | for line in intercept.read().split("\n"): | 410 | for line in intercept.read().split("\n"): |
411 | m = re.match("^##PKGS:(.*)", line) | 411 | m = re.match(r"^##PKGS:(.*)", line) |
412 | if m is not None: | 412 | if m is not None: |
413 | registered_pkgs = m.group(1).strip() | 413 | registered_pkgs = m.group(1).strip() |
414 | break | 414 | break |
@@ -1217,7 +1217,7 @@ class OpkgPM(OpkgDpkgPM): | |||
1217 | priority += 5 | 1217 | priority += 5 |
1218 | 1218 | ||
1219 | for line in (self.d.getVar('IPK_FEED_URIS') or "").split(): | 1219 | for line in (self.d.getVar('IPK_FEED_URIS') or "").split(): |
1220 | feed_match = re.match("^[ \t]*(.*)##([^ \t]*)[ \t]*$", line) | 1220 | feed_match = re.match(r"^[ \t]*(.*)##([^ \t]*)[ \t]*$", line) |
1221 | 1221 | ||
1222 | if feed_match is not None: | 1222 | if feed_match is not None: |
1223 | feed_name = feed_match.group(1) | 1223 | feed_name = feed_match.group(1) |
@@ -1597,7 +1597,7 @@ class DpkgPM(OpkgDpkgPM): | |||
1597 | 1597 | ||
1598 | with open(status_file, "r") as status: | 1598 | with open(status_file, "r") as status: |
1599 | for line in status.read().split('\n'): | 1599 | for line in status.read().split('\n'): |
1600 | m = re.match("^Package: (.*)", line) | 1600 | m = re.match(r"^Package: (.*)", line) |
1601 | if m is not None: | 1601 | if m is not None: |
1602 | installed_pkgs.append(m.group(1)) | 1602 | installed_pkgs.append(m.group(1)) |
1603 | 1603 | ||
@@ -1662,13 +1662,13 @@ class DpkgPM(OpkgDpkgPM): | |||
1662 | # rename *.dpkg-new files/dirs | 1662 | # rename *.dpkg-new files/dirs |
1663 | for root, dirs, files in os.walk(self.target_rootfs): | 1663 | for root, dirs, files in os.walk(self.target_rootfs): |
1664 | for dir in dirs: | 1664 | for dir in dirs: |
1665 | new_dir = re.sub("\.dpkg-new", "", dir) | 1665 | new_dir = re.sub(r"\.dpkg-new", "", dir) |
1666 | if dir != new_dir: | 1666 | if dir != new_dir: |
1667 | os.rename(os.path.join(root, dir), | 1667 | os.rename(os.path.join(root, dir), |
1668 | os.path.join(root, new_dir)) | 1668 | os.path.join(root, new_dir)) |
1669 | 1669 | ||
1670 | for file in files: | 1670 | for file in files: |
1671 | new_file = re.sub("\.dpkg-new", "", file) | 1671 | new_file = re.sub(r"\.dpkg-new", "", file) |
1672 | if file != new_file: | 1672 | if file != new_file: |
1673 | os.rename(os.path.join(root, file), | 1673 | os.rename(os.path.join(root, file), |
1674 | os.path.join(root, new_file)) | 1674 | os.path.join(root, new_file)) |
@@ -1733,7 +1733,7 @@ class DpkgPM(OpkgDpkgPM): | |||
1733 | sources_file.write("deb %s ./\n" % uri) | 1733 | sources_file.write("deb %s ./\n" % uri) |
1734 | 1734 | ||
1735 | def _create_configs(self, archs, base_archs): | 1735 | def _create_configs(self, archs, base_archs): |
1736 | base_archs = re.sub("_", "-", base_archs) | 1736 | base_archs = re.sub(r"_", r"-", base_archs) |
1737 | 1737 | ||
1738 | if os.path.exists(self.apt_conf_dir): | 1738 | if os.path.exists(self.apt_conf_dir): |
1739 | bb.utils.remove(self.apt_conf_dir, True) | 1739 | bb.utils.remove(self.apt_conf_dir, True) |
@@ -1787,7 +1787,7 @@ class DpkgPM(OpkgDpkgPM): | |||
1787 | with open(self.apt_conf_file, "w+") as apt_conf: | 1787 | with open(self.apt_conf_file, "w+") as apt_conf: |
1788 | with open(self.d.expand("${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample")) as apt_conf_sample: | 1788 | with open(self.d.expand("${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample")) as apt_conf_sample: |
1789 | for line in apt_conf_sample.read().split("\n"): | 1789 | for line in apt_conf_sample.read().split("\n"): |
1790 | match_arch = re.match(" Architecture \".*\";$", line) | 1790 | match_arch = re.match(r" Architecture \".*\";$", line) |
1791 | architectures = "" | 1791 | architectures = "" |
1792 | if match_arch: | 1792 | if match_arch: |
1793 | for base_arch in base_arch_list: | 1793 | for base_arch in base_arch_list: |
@@ -1795,8 +1795,8 @@ class DpkgPM(OpkgDpkgPM): | |||
1795 | apt_conf.write(" Architectures {%s};\n" % architectures); | 1795 | apt_conf.write(" Architectures {%s};\n" % architectures); |
1796 | apt_conf.write(" Architecture \"%s\";\n" % base_archs) | 1796 | apt_conf.write(" Architecture \"%s\";\n" % base_archs) |
1797 | else: | 1797 | else: |
1798 | line = re.sub("#ROOTFS#", self.target_rootfs, line) | 1798 | line = re.sub(r"#ROOTFS#", self.target_rootfs, line) |
1799 | line = re.sub("#APTCONF#", self.apt_conf_dir, line) | 1799 | line = re.sub(r"#APTCONF#", self.apt_conf_dir, line) |
1800 | apt_conf.write(line + "\n") | 1800 | apt_conf.write(line + "\n") |
1801 | 1801 | ||
1802 | target_dpkg_dir = "%s/var/lib/dpkg" % self.target_rootfs | 1802 | target_dpkg_dir = "%s/var/lib/dpkg" % self.target_rootfs |
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index e0f0604251..07a40fc50e 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
@@ -334,8 +334,8 @@ class GitApplyTree(PatchTree): | |||
334 | @staticmethod | 334 | @staticmethod |
335 | def interpretPatchHeader(headerlines): | 335 | def interpretPatchHeader(headerlines): |
336 | import re | 336 | import re |
337 | author_re = re.compile('[\S ]+ <\S+@\S+\.\S+>') | 337 | author_re = re.compile(r'[\S ]+ <\S+@\S+\.\S+>') |
338 | from_commit_re = re.compile('^From [a-z0-9]{40} .*') | 338 | from_commit_re = re.compile(r'^From [a-z0-9]{40} .*') |
339 | outlines = [] | 339 | outlines = [] |
340 | author = None | 340 | author = None |
341 | date = None | 341 | date = None |
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 4273891699..551dcfc75f 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -354,9 +354,9 @@ class Rootfs(object, metaclass=ABCMeta): | |||
354 | class RpmRootfs(Rootfs): | 354 | class RpmRootfs(Rootfs): |
355 | def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None): | 355 | def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None): |
356 | super(RpmRootfs, self).__init__(d, progress_reporter, logcatcher) | 356 | super(RpmRootfs, self).__init__(d, progress_reporter, logcatcher) |
357 | self.log_check_regex = '(unpacking of archive failed|Cannot find package'\ | 357 | self.log_check_regex = r'(unpacking of archive failed|Cannot find package'\ |
358 | '|exit 1|ERROR: |Error: |Error |ERROR '\ | 358 | r'|exit 1|ERROR: |Error: |Error |ERROR '\ |
359 | '|Failed |Failed: |Failed$|Failed\(\d+\):)' | 359 | r'|Failed |Failed: |Failed$|Failed\(\d+\):)' |
360 | self.manifest = RpmManifest(d, manifest_dir) | 360 | self.manifest = RpmManifest(d, manifest_dir) |
361 | 361 | ||
362 | self.pm = RpmPM(d, | 362 | self.pm = RpmPM(d, |
@@ -499,7 +499,7 @@ class DpkgOpkgRootfs(Rootfs): | |||
499 | pkg_depends_list = [] | 499 | pkg_depends_list = [] |
500 | # filter version requirements like libc (>= 1.1) | 500 | # filter version requirements like libc (>= 1.1) |
501 | for dep in pkg_depends.split(', '): | 501 | for dep in pkg_depends.split(', '): |
502 | m_dep = re.match("^(.*) \(.*\)$", dep) | 502 | m_dep = re.match(r"^(.*) \(.*\)$", dep) |
503 | if m_dep: | 503 | if m_dep: |
504 | dep = m_dep.group(1) | 504 | dep = m_dep.group(1) |
505 | pkg_depends_list.append(dep) | 505 | pkg_depends_list.append(dep) |
@@ -515,9 +515,9 @@ class DpkgOpkgRootfs(Rootfs): | |||
515 | data = status.read() | 515 | data = status.read() |
516 | status.close() | 516 | status.close() |
517 | for line in data.split('\n'): | 517 | for line in data.split('\n'): |
518 | m_pkg = re.match("^Package: (.*)", line) | 518 | m_pkg = re.match(r"^Package: (.*)", line) |
519 | m_status = re.match("^Status:.*unpacked", line) | 519 | m_status = re.match(r"^Status:.*unpacked", line) |
520 | m_depends = re.match("^Depends: (.*)", line) | 520 | m_depends = re.match(r"^Depends: (.*)", line) |
521 | 521 | ||
522 | #Only one of m_pkg, m_status or m_depends is not None at time | 522 | #Only one of m_pkg, m_status or m_depends is not None at time |
523 | #If m_pkg is not None, we started a new package | 523 | #If m_pkg is not None, we started a new package |
@@ -771,7 +771,7 @@ class OpkgRootfs(DpkgOpkgRootfs): | |||
771 | if allow_replace is None: | 771 | if allow_replace is None: |
772 | allow_replace = "" | 772 | allow_replace = "" |
773 | 773 | ||
774 | allow_rep = re.compile(re.sub("\|$", "", allow_replace)) | 774 | allow_rep = re.compile(re.sub(r"\|$", r"", allow_replace)) |
775 | error_prompt = "Multilib check error:" | 775 | error_prompt = "Multilib check error:" |
776 | 776 | ||
777 | files = {} | 777 | files = {} |
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index ee6f0e6647..7b574ffd30 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
@@ -326,7 +326,7 @@ def multiprocess_launch(target, items, d, extraargs=None): | |||
326 | 326 | ||
327 | def squashspaces(string): | 327 | def squashspaces(string): |
328 | import re | 328 | import re |
329 | return re.sub("\s+", " ", string).strip() | 329 | return re.sub(r"\s+", " ", string).strip() |
330 | 330 | ||
331 | def format_pkg_list(pkg_dict, ret_format=None): | 331 | def format_pkg_list(pkg_dict, ret_format=None): |
332 | output = [] | 332 | output = [] |
@@ -374,7 +374,7 @@ def host_gcc_version(d, taskcontextonly=False): | |||
374 | except subprocess.CalledProcessError as e: | 374 | except subprocess.CalledProcessError as e: |
375 | bb.fatal("Error running %s --version: %s" % (compiler, e.output.decode("utf-8"))) | 375 | bb.fatal("Error running %s --version: %s" % (compiler, e.output.decode("utf-8"))) |
376 | 376 | ||
377 | match = re.match(".* (\d\.\d)\.\d.*", output.split('\n')[0]) | 377 | match = re.match(r".* (\d\.\d)\.\d.*", output.split('\n')[0]) |
378 | if not match: | 378 | if not match: |
379 | bb.fatal("Can't get compiler version from %s --version output" % compiler) | 379 | bb.fatal("Can't get compiler version from %s --version output" % compiler) |
380 | 380 | ||