summaryrefslogtreecommitdiffstats
path: root/Tools/freeze/parsesetup.py
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2001-03-18 11:27:58 (GMT)
committerEric S. Raymond <esr@thyrsus.com>2001-03-18 11:27:58 (GMT)
commit1bb515b0e548d0ff39fffe3326c5a08f46cd7d55 (patch)
tree6747cee262aa2ec73f4f062cca12346709a52b0f /Tools/freeze/parsesetup.py
parent0f33604e1783d2302006e79713d5d279093405b3 (diff)
downloadcpython-1bb515b0e548d0ff39fffe3326c5a08f46cd7d55.zip
cpython-1bb515b0e548d0ff39fffe3326c5a08f46cd7d55.tar.gz
cpython-1bb515b0e548d0ff39fffe3326c5a08f46cd7d55.tar.bz2
Teach Tools/freeze/makeconfig.py and Tools/freeze/parsesetup.py to use
the re package rather than the obsolete regex.
Diffstat (limited to 'Tools/freeze/parsesetup.py')
-rw-r--r--Tools/freeze/parsesetup.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/Tools/freeze/parsesetup.py b/Tools/freeze/parsesetup.py
index 1795671..7f90075 100644
--- a/Tools/freeze/parsesetup.py
+++ b/Tools/freeze/parsesetup.py
@@ -1,6 +1,6 @@
# Parse Makefiles and Python Setup(.in) files.
-import regex
+import re
import string
@@ -8,7 +8,7 @@ import string
# Return a dictionary mapping names to values.
# May raise IOError.
-makevardef = regex.compile('^\([a-zA-Z0-9_]+\)[ \t]*=\(.*\)')
+makevardef = re.compile('^([a-zA-Z0-9_]+)[ \t]*=(.*)')
def getmakevars(filename):
variables = {}
@@ -18,9 +18,10 @@ def getmakevars(filename):
line = fp.readline()
if not line:
break
- if makevardef.match(line) < 0:
+ matchobj = makevardef.match(line)
+ if not matchobj:
continue
- name, value = makevardef.group(1, 2)
+ (name, value) = matchobj.group(1, 2)
# Strip trailing comment
i = string.find(value, '#')
if i >= 0:
@@ -37,7 +38,7 @@ def getmakevars(filename):
# definitions, the second mapping variable names to their values.
# May raise IOError.
-setupvardef = regex.compile('^\([a-zA-Z0-9_]+\)=\(.*\)')
+setupvardef = re.compile('^([a-zA-Z0-9_]+)=(.*)')
def getsetupinfo(filename):
modules = {}
@@ -52,8 +53,9 @@ def getsetupinfo(filename):
i = string.find(line, '#')
if i >= 0:
line = line[:i]
- if setupvardef.match(line) >= 0:
- name, value = setupvardef.group(1, 2)
+ matchobj = setupvardef.match(line)
+ if matchobj:
+ (name, value) = matchobj.group(1, 2)
variables[name] = string.strip(value)
else:
words = string.split(line)