Re: [OE-core] [PATCH 1/2 v2] meta: Fix Deprecated warnings from regexs

2019-01-14 Thread Richard Purdie
On Mon, 2019-01-14 at 23:04 +, Richard Purdie wrote:
> 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.

meta-oe and other layers are likely going to need this kind of cleanup
at some point.

A tip when trying to debug this is to remove the cache, tmp/cache and
all __pycache__ directories so that you force everything to get re-
parsed when debugging/fixing them.

Cheers,

Richard



-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/2 v2] meta: Fix Deprecated warnings from regexs

2019-01-14 Thread Richard Purdie
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.

Signed-off-by: Richard Purdie 
---
 meta/classes/debian.bbclass   |  6 ++---
 meta/classes/gconf.bbclass|  2 +-
 meta/classes/kernel-module-split.bbclass  |  2 +-
 meta/classes/kernel.bbclass   |  2 +-
 meta/classes/libc-package.bbclass | 26 +--
 meta/classes/package.bbclass  | 22 
 meta/lib/oe/license.py|  8 +++---
 meta/lib/oe/package.py|  2 +-
 meta/lib/oe/package_manager.py| 24 -
 meta/lib/oe/patch.py  |  4 +--
 meta/lib/oe/rootfs.py | 16 ++--
 meta/lib/oe/utils.py  |  4 +--
 meta/recipes-connectivity/connman/connman.inc |  4 +--
 meta/recipes-core/ncurses/ncurses.inc |  4 +--
 meta/recipes-core/util-linux/util-linux.inc   |  2 +-
 meta/recipes-devtools/llvm/llvm_git.bb| 20 +++---
 meta/recipes-devtools/orc/orc_0.4.28.bb   |  2 +-
 .../perl-sanity/perl-ptest.inc|  2 +-
 .../perl-sanity/perl_5.28.1.bb| 12 -
 .../iptables/iptables_1.6.2.bb|  2 +-
 .../lighttpd/lighttpd_1.4.52.bb   |  2 +-
 meta/recipes-extended/pam/libpam_1.3.0.bb |  4 +--
 .../gdk-pixbuf/gdk-pixbuf_2.36.11.bb  |  2 +-
 meta/recipes-gnome/gtk+/gtk+3.inc |  4 +--
 meta/recipes-gnome/gtk+/gtk+_2.24.32.bb   |  4 +--
 meta/recipes-graphics/mesa/mesa.inc   |  4 +--
 .../xorg-lib/libxcb_1.13.1.bb |  2 +-
 .../alsa/alsa-plugins_1.1.6.bb|  2 +-
 .../gstreamer/gst-plugins-package.inc | 10 +++
 .../pulseaudio/pulseaudio.inc |  4 +--
 30 files changed, 102 insertions(+), 102 deletions(-)

diff --git a/meta/classes/debian.bbclass b/meta/classes/debian.bbclass
index 989ea8f8d28..6f8a599ccb6 100644
--- a/meta/classes/debian.bbclass
+++ b/meta/classes/debian.bbclass
@@ -29,11 +29,11 @@ python debian_package_name_hook () {
 
 pkgdest = d.getVar("PKGDEST")
 packages = d.getVar('PACKAGES')
-so_re = re.compile("lib.*\.so")
+so_re = re.compile(r"lib.*\.so")
 
 def socrunch(s):
 s = s.lower().replace('_', '-')
-m = re.match("^(.*)(.)\.so\.(.*)$", s)
+m = re.match(r"^(.*)(.)\.so\.(.*)$", s)
 if m is None:
 return None
 if m.group(2) in '0123456789':
@@ -79,7 +79,7 @@ python debian_package_name_hook () {
 try:
 cmd = [d.expand("${TARGET_PREFIX}objdump"), "-p", f]
 output = subprocess.check_output(cmd).decode("utf-8")
-for m in re.finditer("\s+SONAME\s+([^\s]+)", output):
+for m in re.finditer(r"\s+SONAME\s+([^\s]+)", output):
 if m.group(1) not in sonames:
 sonames.append(m.group(1))
 except subprocess.CalledProcessError:
diff --git a/meta/classes/gconf.bbclass b/meta/classes/gconf.bbclass
index 4e0ee2e7d59..3e3c509d5ff 100644
--- a/meta/classes/gconf.bbclass
+++ b/meta/classes/gconf.bbclass
@@ -49,7 +49,7 @@ python populate_packages_append () {
 for pkg in packages:
 schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg)
 schemas = []
-schema_re = re.compile(".*\.schemas$")
+schema_re = re.compile(r".*\.schemas$")
 if os.path.exists(schema_dir):
 for f in os.listdir(schema_dir):
 if schema_re.match(f):
diff --git a/meta/classes/kernel-module-split.bbclass 
b/meta/classes/kernel-module-split.bbclass
index e8996cf59ba..e8d3eb51057 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -133,7 +133,7 @@ python split_kernel_module_packages () {
 kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel"
 kernel_version = d.getVar("KERNEL_VERSION")
 
-module_regex = '^(.*)\.k?o$'
+module_regex = r'^(.*)\.k?o$'
 
 module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX')
 module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 45cb4fabc18..c0889bd3ee4 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -578,7 +578,7 @@ pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
 PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
 
 python split_kernel_packages () {
-