File: 0127-pass-regular-expressions-as-raw-strings-in-Python-sc.patch

package info (click to toggle)
freedoom 0.13.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 48,712 kB
  • sloc: python: 3,513; makefile: 529; xml: 188; sh: 73
file content (51 lines) | stat: -rw-r--r-- 1,636 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 61a0917526b01b9fcf4dde816cc4dacab15db3cb Mon Sep 17 00:00:00 2001
From: Fabian Greffrath <fabian@greffrath.com>
Date: Tue, 29 Oct 2024 22:44:53 +0100
Subject: [PATCH 127/225] pass regular expressions as raw strings in Python
 scripts (#1450)

---
 graphics/text/config.py | 4 ++--
 scripts/simplecpp       | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/graphics/text/config.py b/graphics/text/config.py
index bca9fca5..4c5a164e 100644
--- a/graphics/text/config.py
+++ b/graphics/text/config.py
@@ -103,7 +103,7 @@ freedoom_bex = read_bex_lump("../../lumps/p2_deh.lmp")
 freedm_bex = read_bex_lump("../../lumps/fdm_deh.lmp")
 
 def read_bex_string(whichbex,defn):
-    return re.sub("^\w*\d:\s*", "", whichbex[defn])
+    return re.sub(r"^\w*\d:\s*", "", whichbex[defn])
 
 
 white_graphics = {
@@ -252,7 +252,7 @@ def update_level_name(lumpname, bexdata, bexname):
             "Level name %s not defined in " "DEHACKED lump!" % bexname
         )
     # Strip "MAP01: " or "E1M2: " etc. from start, if present:
-    levelname = re.sub("^\w*\d:\s*", "", bexdata[bexname])
+    levelname = re.sub(r"^\w*\d:\s*", "", bexdata[bexname])
     white_graphics[lumpname] = levelname
 
 for e in range(4):
diff --git a/scripts/simplecpp b/scripts/simplecpp
index 7ba9aeb0..a0c2fb3d 100755
--- a/scripts/simplecpp
+++ b/scripts/simplecpp
@@ -34,8 +34,8 @@ import re
 debug = False
 defines = {}
 
-command_re = re.compile("\#(\w+)(\s+(.*))?")
-include_re = re.compile('\s*"(.*)"\s*')
+command_re = re.compile(r"\#(\w+)(\s+(.*))?")
+include_re = re.compile(r'\s*"(.*)"\s*')
 
 
 def debug_msg(message):
-- 
2.47.2