From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 9808013888F for ; Wed, 7 Oct 2015 08:31:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F0367E080D; Wed, 7 Oct 2015 08:31:42 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 77F79E080D for ; Wed, 7 Oct 2015 08:31:42 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 10884340976 for ; Wed, 7 Oct 2015 08:31:39 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CF405B22 for ; Wed, 7 Oct 2015 08:31:36 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1444207029.56bfb6c2fbb15dbc1b9bd2b618a47cc82d5f9a6c.blueness@gentoo> Subject: [gentoo-commits] proj/grss:master commit in: grs/ X-VCS-Repository: proj/grss X-VCS-Files: grs/Interpret.py grs/Kernel.py grs/Populate.py grs/Rotator.py grs/WorldConf.py X-VCS-Directories: grs/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: 56bfb6c2fbb15dbc1b9bd2b618a47cc82d5f9a6c X-VCS-Branch: master Date: Wed, 7 Oct 2015 08:31:36 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: dda89053-9238-4d8f-b99f-8c44f0f4392d X-Archives-Hash: ed95ca32851e23d66ffd149ba742474d commit: 56bfb6c2fbb15dbc1b9bd2b618a47cc82d5f9a6c Author: Anthony G. Basile gentoo org> AuthorDate: Wed Oct 7 08:37:09 2015 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Wed Oct 7 08:37:09 2015 +0000 URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=56bfb6c2 lint: use raw strings with regexes. grs/Interpret.py | 6 +++--- grs/Kernel.py | 6 +++--- grs/Populate.py | 2 +- grs/Rotator.py | 4 ++-- grs/WorldConf.py | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/grs/Interpret.py b/grs/Interpret.py index fd36650..db5bdd4 100644 --- a/grs/Interpret.py +++ b/grs/Interpret.py @@ -162,14 +162,14 @@ class Interpret(Daemon): line_number += 1 # Skip lines with initial # as comments. - m = re.search('^(#).*$', l) + m = re.search(r'^(#).*$', l) if m: continue # For a release run, execute every line of the build script. # For an update run, exexute only lines with a leading +. ignore_stamp = False - m = re.search('^(\+)(.*)$', l) + m = re.search(r'^(\+)(.*)$', l) if m: # There is a leading +, so remove it and skip if doing an update run ignore_stamp = self.update_run @@ -187,7 +187,7 @@ class Interpret(Daemon): # single 'verb', or a 'verb obj' pair. While restrictive, # its good enough for now. try: - m = re.search('(\S+)\s+(\S+)', l) + m = re.search(r'(\S+)\s+(\S+)', l) verb = m.group(1) obj = m.group(2) except AttributeError: diff --git a/grs/Kernel.py b/grs/Kernel.py index 559aa57..a8205ba 100644 --- a/grs/Kernel.py +++ b/grs/Kernel.py @@ -47,18 +47,18 @@ class Kernel(): # The version line looks like the following: # Linux/x86 4.0.6-hardened-r2 Kernel Configuration # The 2nd group contains the version. - m = re.search('^#\s+(\S+)\s+(\S+).+$', version_line) + m = re.search(r'^#\s+(\S+)\s+(\S+).+$', version_line) gentoo_version = m.group(2) try: # Either the verison is of the form '4.0.6-hardened-r2' with two -'s - m = re.search('(\S+?)-(\S+?)-(\S+)', gentoo_version) + m = re.search(r'(\S+?)-(\S+?)-(\S+)', gentoo_version) vanilla_version = m.group(1) flavor = m.group(2) revision = m.group(3) pkg_name = flavor + '-sources-' + vanilla_version + '-' + revision except AttributeError: # Or the verison is of the form '4.0.6-hardened' with one - - m = re.search('(\S+?)-(\S+)', gentoo_version) + m = re.search(r'(\S+?)-(\S+)', gentoo_version) vanilla_version = m.group(1) flavor = m.group(2) pkg_name = flavor + '-sources-' + vanilla_version diff --git a/grs/Populate.py b/grs/Populate.py index a1822ee..3271cb7 100644 --- a/grs/Populate.py +++ b/grs/Populate.py @@ -64,7 +64,7 @@ class Populate(): cycled_files = {} for dirpath, dirnames, filenames in os.walk(self.workdir): for f in filenames: - m = re.search('^(.+)\.CYCLE\.(\d+)', f) + m = re.search(r'^(.+)\.CYCLE\.(\d+)', f) if m: filename = m.group(1) cycle_no = int(m.group(2)) diff --git a/grs/Rotator.py b/grs/Rotator.py index a1282b2..9daf7d2 100644 --- a/grs/Rotator.py +++ b/grs/Rotator.py @@ -45,7 +45,7 @@ class Rotator(): objs = glob.glob('%s.*' % obj) indexed_obj = {} for o in objs: - m = re.search('^.+\.(\d+)$', o) + m = re.search(r'^.+\.(\d+)$', o) indexed_obj[int(m.group(1))] = o count = list(indexed_obj.keys()) count.sort() @@ -58,7 +58,7 @@ class Rotator(): except NotADirectoryError: os.unlink(current_obj) continue - m = re.search('^(.+)\.\d+$', current_obj) + m = re.search(r'^(.+)\.\d+$', current_obj) next_obj = '%s.%d' % (m.group(1), c+1) shutil.move(current_obj, next_obj) diff --git a/grs/WorldConf.py b/grs/WorldConf.py index c5882bf..b55110f 100644 --- a/grs/WorldConf.py +++ b/grs/WorldConf.py @@ -53,7 +53,7 @@ class WorldConf(): config.read(CONST.WORLD_CONFIG) for s in config.sections(): for (directory, value) in config[s].items(): - p_slot_atom = re.sub('[/:]', '_', s) + p_slot_atom = re.sub(r'[/:]', '_', s) dpath = os.path.join(CONST.PORTAGE_CONFIGDIR, directory) fpath = os.path.join(dpath, p_slot_atom) os.makedirs(dpath, mode=0o755, exist_ok=True) @@ -84,18 +84,18 @@ class WorldConf(): cpv = portdb.cp_list(p)[0] slotvar = portdb.aux_get(cpv, ['SLOT'])[0] try: - m = re.search('(.+?)\/(.+)', slotvar) + m = re.search(r'(.+?)\/(.+)', slotvar) slot = m.group(1) except AttributeError: slot = slotvar - slot_atoms.append(re.sub('[/:]', '_', '%s:%s' % (p, slot))) + slot_atoms.append(re.sub(r'[/:]', '_', '%s:%s' % (p, slot))) # Also let's get a list of all the possible canonical file names config = configparser.RawConfigParser(delimiters=':', allow_no_value=True, comment_prefixes=None) config.read(CONST.WORLD_CONFIG) canon = [] for s in config.sections(): - p_slot_atom = re.sub('[/:]', '_', s) + p_slot_atom = re.sub(r'[/:]', '_', s) canon.append(p_slot_atom) # Walk through all files in /etc/portage and remove any files for uninstalled pkgs.