commit: 55ad426b76e66fbef88dca3274172f5a30903ae6 Author: Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com> AuthorDate: Tue Jan 31 17:15:19 2017 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Tue Jan 31 18:11:24 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=55ad426b
Fix Python 3.6 "DeprecationWarning: invalid escape sequence" warnings (bug 607418) X-Gentoo-Bug: 607418 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=607418 bin/check-implicit-pointer-usage.py | 22 +++++++++++----------- bin/dispatch-conf | 4 ++-- pym/_emerge/main.py | 4 ++-- pym/portage/cvstree.py | 6 +++--- pym/portage/glsa.py | 4 ++-- pym/portage/news.py | 4 ++-- pym/portage/package/ebuild/fetch.py | 4 ++-- pym/portage/tests/util/test_getconfig.py | 4 ++-- pym/portage/tests/util/test_varExpand.py | 4 ++-- pym/portage/util/__init__.py | 4 ++-- pym/portage/util/lafilefixer.py | 8 ++++---- pym/portage/xml/metadata.py | 4 ++-- repoman/pym/repoman/modules/vcs/cvs/changes.py | 2 +- repoman/pym/repoman/modules/vcs/cvs/status.py | 6 +++--- repoman/pym/repoman/modules/vcs/svn/changes.py | 2 +- 15 files changed, 41 insertions(+), 41 deletions(-) diff --git a/bin/check-implicit-pointer-usage.py b/bin/check-implicit-pointer-usage.py index 242436c..a49db81 100755 --- a/bin/check-implicit-pointer-usage.py +++ b/bin/check-implicit-pointer-usage.py @@ -19,19 +19,19 @@ from __future__ import print_function import re import sys -implicit_pattern = re.compile("([^:]*):(\d+): warning: implicit declaration " +implicit_pattern = re.compile(r"([^:]*):(\d+): warning: implicit declaration " + "of function [`']([^']*)'") pointer_pattern = ( - "([^:]*):(\d+): warning: " - + "(" - + "(assignment" - + "|initialization" - + "|return" - + "|passing arg \d+ of `[^']*'" - + "|passing arg \d+ of pointer to function" - + ") makes pointer from integer without a cast" - + "|" - + "cast to pointer from integer of different size)") + r"([^:]*):(\d+): warning: " + + r"(" + + r"(assignment" + + r"|initialization" + + r"|return" + + r"|passing arg \d+ of `[^']*'" + + r"|passing arg \d+ of pointer to function" + + r") makes pointer from integer without a cast" + + r"|" + + r"cast to pointer from integer of different size)") if sys.hexversion < 0x3000000: # Use encoded byte strings in python-2.x, since the python ebuilds are diff --git a/bin/dispatch-conf b/bin/dispatch-conf index fdf564e..099c37f 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -1,5 +1,5 @@ #!/usr/bin/python -bO -# Copyright 1999-2016 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # @@ -222,7 +222,7 @@ class dispatch: # Filter out comments and whitespace-only changes. # Note: be nice to also ignore lines that only differ in whitespace... wsc_lines = [] - for x in ['^[-+]\s*#', '^[-+]\s*$']: + for x in [r'^[-+]\s*#', r'^[-+]\s*$']: wsc_lines += list(filter(re.compile(x).match, mylines)) same_wsc = len(mylines) == len(wsc_lines) diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index eae1954..a83b328 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -1,4 +1,4 @@ -# Copyright 1999-2016 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function @@ -73,7 +73,7 @@ shortmapping={ "V":"--version" } -COWSAY_MOO = """ +COWSAY_MOO = r""" Larry loves Gentoo (%s) diff --git a/pym/portage/cvstree.py b/pym/portage/cvstree.py index 4a3afae..87bbed8 100644 --- a/pym/portage/cvstree.py +++ b/pym/portage/cvstree.py @@ -1,5 +1,5 @@ # cvstree.py -- cvs tree utilities -# Copyright 1998-2014 Gentoo Foundation +# Copyright 1998-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function @@ -61,7 +61,7 @@ def isadded(entries, path): mylines = myfile.readlines() myfile.close() - rep = re.compile("^\/%s\/" % re.escape(filename)) + rep = re.compile(r"^\/%s\/" % re.escape(filename)) for x in mylines: if rep.search(x): return 1 @@ -201,7 +201,7 @@ def findall(entries, recursive=0, basedir=""): myremoved = findremoved(entries, recursive, basedir) return [mynew, mychanged, mymissing, myunadded, myremoved] -ignore_list = re.compile("(^|/)(RCS(|LOG)|SCCS|CVS(|\.adm)|cvslog\..*|tags|TAGS|\.(make\.state|nse_depinfo)|.*~|(\.|)#.*|,.*|_$.*|.*\$|\.del-.*|.*\.(old|BAK|bak|orig|rej|a|olb|o|obj|so|exe|Z|elc|ln)|core)$") +ignore_list = re.compile(r"(^|/)(RCS(|LOG)|SCCS|CVS(|\.adm)|cvslog\..*|tags|TAGS|\.(make\.state|nse_depinfo)|.*~|(\.|)#.*|,.*|_$.*|.*\$|\.del-.*|.*\.(old|BAK|bak|orig|rej|a|olb|o|obj|so|exe|Z|elc|ln)|core)$") def apply_cvsignore_filter(list): x = 0 while x < len(list): diff --git a/pym/portage/glsa.py b/pym/portage/glsa.py index ea3819b..ccf9343 100644 --- a/pym/portage/glsa.py +++ b/pym/portage/glsa.py @@ -1,4 +1,4 @@ -# Copyright 2003-2014 Gentoo Foundation +# Copyright 2003-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import absolute_import, unicode_literals @@ -210,7 +210,7 @@ def getText(node, format, textfd = None): rValue = textfd.getvalue() if format == "strip": rValue = rValue.strip(" \n\t") - rValue = re.sub("[\s]{2,}", " ", rValue) + rValue = re.sub(r"[\s]{2,}", " ", rValue) return rValue def getMultiTagsText(rootnode, tagname, format): diff --git a/pym/portage/news.py b/pym/portage/news.py index 6020074..d4f1429 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -1,5 +1,5 @@ # portage: news management code -# Copyright 2006-2014 Gentoo Foundation +# Copyright 2006-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function, unicode_literals @@ -193,7 +193,7 @@ class NewsManager(object): if unread_lock: unlockfile(unread_lock) -_formatRE = re.compile("News-Item-Format:\s*([^\s]*)\s*$") +_formatRE = re.compile(r"News-Item-Format:\s*([^\s]*)\s*$") _installedRE = re.compile("Display-If-Installed:(.*)\n") _profileRE = re.compile("Display-If-Profile:(.*)\n") _keywordRE = re.compile("Display-If-Keyword:(.*)\n") diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py index 1be2800..8755b75 100644 --- a/pym/portage/package/ebuild/fetch.py +++ b/pym/portage/package/ebuild/fetch.py @@ -1,4 +1,4 @@ -# Copyright 2010-2015 Gentoo Foundation +# Copyright 2010-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function @@ -231,7 +231,7 @@ def _check_distfile(filename, digests, eout, show_errors=1, hash_filter=None): return (False, st) return (True, st) -_fetch_resume_size_re = re.compile('(^[\d]+)([KMGTPEZY]?$)') +_fetch_resume_size_re = re.compile(r'(^[\d]+)([KMGTPEZY]?$)') _size_suffix_map = { '' : 0, diff --git a/pym/portage/tests/util/test_getconfig.py b/pym/portage/tests/util/test_getconfig.py index 05e3147..e79fca4 100644 --- a/pym/portage/tests/util/test_getconfig.py +++ b/pym/portage/tests/util/test_getconfig.py @@ -1,4 +1,4 @@ -# Copyright 2010-2014 Gentoo Foundation +# Copyright 2010-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import tempfile @@ -58,7 +58,7 @@ class GetConfigTestCase(TestCase): # Test the mode which is used to parse /etc/env.d and /etc/profile.env. cases = { - 'LESS_TERMCAP_mb': "$\E[01;31m", # bug #410625 + 'LESS_TERMCAP_mb': r"$\E[01;31m", # bug #410625 } with tempfile.NamedTemporaryFile(mode='wb') as f: diff --git a/pym/portage/tests/util/test_varExpand.py b/pym/portage/tests/util/test_varExpand.py index 498b50e..d8addf2 100644 --- a/pym/portage/tests/util/test_varExpand.py +++ b/pym/portage/tests/util/test_varExpand.py @@ -1,5 +1,5 @@ # test_varExpand.py -- Portage Unit Testing Functionality -# Copyright 2006-2010 Gentoo Foundation +# Copyright 2006-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -22,7 +22,7 @@ class VarExpandTestCase(TestCase): (result, varDict[key], "${%s}" % key, varDict)) def testVarExpandBackslashes(self): - """ + r""" We want to behave like bash does when expanding a variable assignment in a sourced file, in which case it performs backslash removal for \\ and \$ but nothing more. It also diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index 2309d04..c2c871f 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2004-2014 Gentoo Foundation +# Copyright 2004-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import unicode_literals @@ -709,7 +709,7 @@ def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True, lex = _getconfig_shlex(instream=content, infile=mycfg, posix=True, portage_tolerant=tolerant) lex.wordchars = portage._native_string(string.digits + - string.ascii_letters + "~!@#$%*_\:;?,./-+{}") + string.ascii_letters + r"~!@#$%*_\:;?,./-+{}") lex.quotes = portage._native_string("\"'") if allow_sourcing: lex.allow_sourcing(expand_map) diff --git a/pym/portage/util/lafilefixer.py b/pym/portage/util/lafilefixer.py index 2562d9a..1100103 100644 --- a/pym/portage/util/lafilefixer.py +++ b/pym/portage/util/lafilefixer.py @@ -1,4 +1,4 @@ -# Copyright 2010 Gentoo Foundation +# Copyright 2010-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import os as _os @@ -40,8 +40,8 @@ inh_link_flags_re = re.compile(b"inherited_linker_flags='(?P<value>[^']*)'$") #replace 'X11R6/lib' and 'local/lib' with 'lib', no idea what's this about. X11_local_sub = re.compile(b"X11R6/lib|local/lib") #get rid of the '..' -pkgconfig_sub1 = re.compile(b"usr/lib[^/]*/pkgconfig/\.\./\.\.") -pkgconfig_sub2 = re.compile(b"(?P<usrlib>usr/lib[^/]*)/pkgconfig/\.\.") +pkgconfig_sub1 = re.compile(br"usr/lib[^/]*/pkgconfig/\.\./\.\.") +pkgconfig_sub2 = re.compile(br"(?P<usrlib>usr/lib[^/]*)/pkgconfig/\.\.") #detect flags that should go into inherited_linker_flags instead of dependency_libs flag_re = re.compile(b"-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads") @@ -132,7 +132,7 @@ def rewrite_lafile(contents): ladir = X11_local_sub.sub(b"lib", ladir) ladir = pkgconfig_sub1.sub(b"usr", ladir) - ladir = pkgconfig_sub2.sub(b"\g<usrlib>", ladir) + ladir = pkgconfig_sub2.sub(br"\g<usrlib>", ladir) if ladir not in libladir: libladir.append(ladir) diff --git a/pym/portage/xml/metadata.py b/pym/portage/xml/metadata.py index 39aa738..9e48ddd 100644 --- a/pym/portage/xml/metadata.py +++ b/pym/portage/xml/metadata.py @@ -1,4 +1,4 @@ -# Copyright 2010-2013 Gentoo Foundation +# Copyright 2010-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 """Provides an easy-to-use python interface to Gentoo's metadata.xml file. @@ -133,7 +133,7 @@ class _Useflag(object): _desc += child.text if child.text else '' _desc += child.tail if child.tail else '' # This takes care of tabs and newlines left from the file - self.description = re.sub('\s+', ' ', _desc) + self.description = re.sub(r'\s+', ' ', _desc) def __repr__(self): return "<%s %r>" % (self.__class__.__name__, self.name) diff --git a/repoman/pym/repoman/modules/vcs/cvs/changes.py b/repoman/pym/repoman/modules/vcs/cvs/changes.py index c3d880b..583a96f 100644 --- a/repoman/pym/repoman/modules/vcs/cvs/changes.py +++ b/repoman/pym/repoman/modules/vcs/cvs/changes.py @@ -82,7 +82,7 @@ class Changes(ChangesBase): @param no_expansion: @param expansion: ''' - headerstring = "'\$(Header|Id).*\$'" + headerstring = r"'\$(Header|Id).*\$'" for _file in updates: diff --git a/repoman/pym/repoman/modules/vcs/cvs/status.py b/repoman/pym/repoman/modules/vcs/cvs/status.py index b936aa7..3ec88f1 100644 --- a/repoman/pym/repoman/modules/vcs/cvs/status.py +++ b/repoman/pym/repoman/modules/vcs/cvs/status.py @@ -63,9 +63,9 @@ class Status(object): None (calls sys.exit on fatal problems) """ - cmd = ("cvs -n up 2>/dev/null | " - "egrep '^[^\?] .*' | " - "egrep -v '^. .*/digest-[^/]+|^cvs server: .* -- ignored$'") + cmd = (r"cvs -n up 2>/dev/null | " + r"egrep '^[^\?] .*' | " + r"egrep -v '^. .*/digest-[^/]+|^cvs server: .* -- ignored$'") msg = ("Performing a %s with a little magic grep to check for updates." % green("cvs -n up")) diff --git a/repoman/pym/repoman/modules/vcs/svn/changes.py b/repoman/pym/repoman/modules/vcs/svn/changes.py index 0bb10d8..dfed165 100644 --- a/repoman/pym/repoman/modules/vcs/svn/changes.py +++ b/repoman/pym/repoman/modules/vcs/svn/changes.py @@ -110,7 +110,7 @@ class Changes(ChangesBase): if keyword is not None: enabled_keywords.append(keyword) - headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords) + headerstring = r"'\$(%s).*\$'" % "|".join(enabled_keywords) _out = repoman_getstatusoutput( "egrep -q %s %s" % (headerstring, portage._shell_quote(_file)))
