[Python-checkins] CVS: python/dist/src/Tools/freeze makeconfig.py,1.3,1.4 parsesetup.py,1.1,1.2
Eric S. Raymond
esr@users.sourceforge.net
Sun, 18 Mar 2001 03:28:01 -0800
Update of /cvsroot/python/python/dist/src/Tools/freeze
In directory usw-pr-cvs1:/tmp/cvs-serv956/Tools/freeze
Modified Files:
makeconfig.py parsesetup.py
Log Message:
Teach Tools/freeze/makeconfig.py and Tools/freeze/parsesetup.py to use
the re package rather than the obsolete regex.
Index: makeconfig.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/makeconfig.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** makeconfig.py 2000/07/28 10:34:48 1.3
--- makeconfig.py 2001/03/18 11:27:58 1.4
***************
*** 1,3 ****
! import regex
--- 1,3 ----
! import re
***************
*** 7,12 ****
def makeconfig(infp, outfp, modules, with_ifdef=0):
! m1 = regex.compile('-- ADDMODULE MARKER 1 --')
! m2 = regex.compile('-- ADDMODULE MARKER 2 --')
while 1:
line = infp.readline()
--- 7,12 ----
def makeconfig(infp, outfp, modules, with_ifdef=0):
! m1 = re.compile('-- ADDMODULE MARKER 1 --')
! m2 = re.compile('-- ADDMODULE MARKER 2 --')
while 1:
line = infp.readline()
Index: parsesetup.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/parsesetup.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** parsesetup.py 1994/10/03 16:33:08 1.1
--- parsesetup.py 2001/03/18 11:27:58 1.2
***************
*** 1,5 ****
# Parse Makefiles and Python Setup(.in) files.
! import regex
import string
--- 1,5 ----
# Parse Makefiles and Python Setup(.in) files.
! import re
import string
***************
*** 9,13 ****
# May raise IOError.
! makevardef = regex.compile('^\([a-zA-Z0-9_]+\)[ \t]*=\(.*\)')
def getmakevars(filename):
--- 9,13 ----
# May raise IOError.
! makevardef = re.compile('^([a-zA-Z0-9_]+)[ \t]*=(.*)')
def getmakevars(filename):
***************
*** 19,25 ****
if not line:
break
! if makevardef.match(line) < 0:
continue
! name, value = makevardef.group(1, 2)
# Strip trailing comment
i = string.find(value, '#')
--- 19,26 ----
if not line:
break
! matchobj = makevardef.match(line)
! if not matchobj:
continue
! (name, value) = matchobj.group(1, 2)
# Strip trailing comment
i = string.find(value, '#')
***************
*** 38,42 ****
# May raise IOError.
! setupvardef = regex.compile('^\([a-zA-Z0-9_]+\)=\(.*\)')
def getsetupinfo(filename):
--- 39,43 ----
# May raise IOError.
! setupvardef = re.compile('^([a-zA-Z0-9_]+)=(.*)')
def getsetupinfo(filename):
***************
*** 53,58 ****
if i >= 0:
line = line[:i]
! if setupvardef.match(line) >= 0:
! name, value = setupvardef.group(1, 2)
variables[name] = string.strip(value)
else:
--- 54,60 ----
if i >= 0:
line = line[:i]
! matchobj = setupvardef.match(line)
! if matchobj:
! (name, value) = matchobj.group(1, 2)
variables[name] = string.strip(value)
else: