1 |
commit: 56bfb6c2fbb15dbc1b9bd2b618a47cc82d5f9a6c |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Oct 7 08:37:09 2015 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 7 08:37:09 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=56bfb6c2 |
7 |
|
8 |
lint: use raw strings with regexes. |
9 |
|
10 |
grs/Interpret.py | 6 +++--- |
11 |
grs/Kernel.py | 6 +++--- |
12 |
grs/Populate.py | 2 +- |
13 |
grs/Rotator.py | 4 ++-- |
14 |
grs/WorldConf.py | 8 ++++---- |
15 |
5 files changed, 13 insertions(+), 13 deletions(-) |
16 |
|
17 |
diff --git a/grs/Interpret.py b/grs/Interpret.py |
18 |
index fd36650..db5bdd4 100644 |
19 |
--- a/grs/Interpret.py |
20 |
+++ b/grs/Interpret.py |
21 |
@@ -162,14 +162,14 @@ class Interpret(Daemon): |
22 |
line_number += 1 |
23 |
|
24 |
# Skip lines with initial # as comments. |
25 |
- m = re.search('^(#).*$', l) |
26 |
+ m = re.search(r'^(#).*$', l) |
27 |
if m: |
28 |
continue |
29 |
|
30 |
# For a release run, execute every line of the build script. |
31 |
# For an update run, exexute only lines with a leading +. |
32 |
ignore_stamp = False |
33 |
- m = re.search('^(\+)(.*)$', l) |
34 |
+ m = re.search(r'^(\+)(.*)$', l) |
35 |
if m: |
36 |
# There is a leading +, so remove it and skip if doing an update run |
37 |
ignore_stamp = self.update_run |
38 |
@@ -187,7 +187,7 @@ class Interpret(Daemon): |
39 |
# single 'verb', or a 'verb obj' pair. While restrictive, |
40 |
# its good enough for now. |
41 |
try: |
42 |
- m = re.search('(\S+)\s+(\S+)', l) |
43 |
+ m = re.search(r'(\S+)\s+(\S+)', l) |
44 |
verb = m.group(1) |
45 |
obj = m.group(2) |
46 |
except AttributeError: |
47 |
|
48 |
diff --git a/grs/Kernel.py b/grs/Kernel.py |
49 |
index 559aa57..a8205ba 100644 |
50 |
--- a/grs/Kernel.py |
51 |
+++ b/grs/Kernel.py |
52 |
@@ -47,18 +47,18 @@ class Kernel(): |
53 |
# The version line looks like the following: |
54 |
# Linux/x86 4.0.6-hardened-r2 Kernel Configuration |
55 |
# The 2nd group contains the version. |
56 |
- m = re.search('^#\s+(\S+)\s+(\S+).+$', version_line) |
57 |
+ m = re.search(r'^#\s+(\S+)\s+(\S+).+$', version_line) |
58 |
gentoo_version = m.group(2) |
59 |
try: |
60 |
# Either the verison is of the form '4.0.6-hardened-r2' with two -'s |
61 |
- m = re.search('(\S+?)-(\S+?)-(\S+)', gentoo_version) |
62 |
+ m = re.search(r'(\S+?)-(\S+?)-(\S+)', gentoo_version) |
63 |
vanilla_version = m.group(1) |
64 |
flavor = m.group(2) |
65 |
revision = m.group(3) |
66 |
pkg_name = flavor + '-sources-' + vanilla_version + '-' + revision |
67 |
except AttributeError: |
68 |
# Or the verison is of the form '4.0.6-hardened' with one - |
69 |
- m = re.search('(\S+?)-(\S+)', gentoo_version) |
70 |
+ m = re.search(r'(\S+?)-(\S+)', gentoo_version) |
71 |
vanilla_version = m.group(1) |
72 |
flavor = m.group(2) |
73 |
pkg_name = flavor + '-sources-' + vanilla_version |
74 |
|
75 |
diff --git a/grs/Populate.py b/grs/Populate.py |
76 |
index a1822ee..3271cb7 100644 |
77 |
--- a/grs/Populate.py |
78 |
+++ b/grs/Populate.py |
79 |
@@ -64,7 +64,7 @@ class Populate(): |
80 |
cycled_files = {} |
81 |
for dirpath, dirnames, filenames in os.walk(self.workdir): |
82 |
for f in filenames: |
83 |
- m = re.search('^(.+)\.CYCLE\.(\d+)', f) |
84 |
+ m = re.search(r'^(.+)\.CYCLE\.(\d+)', f) |
85 |
if m: |
86 |
filename = m.group(1) |
87 |
cycle_no = int(m.group(2)) |
88 |
|
89 |
diff --git a/grs/Rotator.py b/grs/Rotator.py |
90 |
index a1282b2..9daf7d2 100644 |
91 |
--- a/grs/Rotator.py |
92 |
+++ b/grs/Rotator.py |
93 |
@@ -45,7 +45,7 @@ class Rotator(): |
94 |
objs = glob.glob('%s.*' % obj) |
95 |
indexed_obj = {} |
96 |
for o in objs: |
97 |
- m = re.search('^.+\.(\d+)$', o) |
98 |
+ m = re.search(r'^.+\.(\d+)$', o) |
99 |
indexed_obj[int(m.group(1))] = o |
100 |
count = list(indexed_obj.keys()) |
101 |
count.sort() |
102 |
@@ -58,7 +58,7 @@ class Rotator(): |
103 |
except NotADirectoryError: |
104 |
os.unlink(current_obj) |
105 |
continue |
106 |
- m = re.search('^(.+)\.\d+$', current_obj) |
107 |
+ m = re.search(r'^(.+)\.\d+$', current_obj) |
108 |
next_obj = '%s.%d' % (m.group(1), c+1) |
109 |
shutil.move(current_obj, next_obj) |
110 |
|
111 |
|
112 |
diff --git a/grs/WorldConf.py b/grs/WorldConf.py |
113 |
index c5882bf..b55110f 100644 |
114 |
--- a/grs/WorldConf.py |
115 |
+++ b/grs/WorldConf.py |
116 |
@@ -53,7 +53,7 @@ class WorldConf(): |
117 |
config.read(CONST.WORLD_CONFIG) |
118 |
for s in config.sections(): |
119 |
for (directory, value) in config[s].items(): |
120 |
- p_slot_atom = re.sub('[/:]', '_', s) |
121 |
+ p_slot_atom = re.sub(r'[/:]', '_', s) |
122 |
dpath = os.path.join(CONST.PORTAGE_CONFIGDIR, directory) |
123 |
fpath = os.path.join(dpath, p_slot_atom) |
124 |
os.makedirs(dpath, mode=0o755, exist_ok=True) |
125 |
@@ -84,18 +84,18 @@ class WorldConf(): |
126 |
cpv = portdb.cp_list(p)[0] |
127 |
slotvar = portdb.aux_get(cpv, ['SLOT'])[0] |
128 |
try: |
129 |
- m = re.search('(.+?)\/(.+)', slotvar) |
130 |
+ m = re.search(r'(.+?)\/(.+)', slotvar) |
131 |
slot = m.group(1) |
132 |
except AttributeError: |
133 |
slot = slotvar |
134 |
- slot_atoms.append(re.sub('[/:]', '_', '%s:%s' % (p, slot))) |
135 |
+ slot_atoms.append(re.sub(r'[/:]', '_', '%s:%s' % (p, slot))) |
136 |
|
137 |
# Also let's get a list of all the possible canonical file names |
138 |
config = configparser.RawConfigParser(delimiters=':', allow_no_value=True, comment_prefixes=None) |
139 |
config.read(CONST.WORLD_CONFIG) |
140 |
canon = [] |
141 |
for s in config.sections(): |
142 |
- p_slot_atom = re.sub('[/:]', '_', s) |
143 |
+ p_slot_atom = re.sub(r'[/:]', '_', s) |
144 |
canon.append(p_slot_atom) |
145 |
|
146 |
# Walk through all files in /etc/portage and remove any files for uninstalled pkgs. |