File yodl-python25.patch of Package yodl
--- scripts/yodl2texinfo-post.py
+++ scripts/yodl2texinfo-post.py
@@ -28,8 +28,7 @@
import getopt
from string import *
-import regex
-import regsub
+import re
import time
def program_id ():
@@ -141,16 +140,28 @@
return n
def eat_tag (this):
- i = regex.search ('@TAGSTART@', this.s)
+ i = re.search('@TAGSTART@', this.s)
+ if i:
+ i = i.start()
+ else:
+ i = -1
j = 0
if i < 0:
return 0
- j = regex.search ('@TAGEND@', this.s[i:])
+ j = re.search('@TAGEND@', this.s[i:])
+ if j:
+ j = j.start()
+ else:
+ j = -1
if j < 0:
raise 'huh?'
j = i + j + len ('@TAGEND@')
tag = this.s[i + len ('@TAGSTART@'):j - len ('@TAGEND@')]
- k = regex.search (' ', tag[1:]) + 1
+ k = re.search(' ', tag[1:])
+ if k:
+ k = k.start() + 1
+ else:
+ k = 0
tag_name = tag[1:k]
tag_string = tag[k:len (tag) - 1]
while tag_string[:1] == ' ':
@@ -161,13 +172,13 @@
# various other characters in node names too
#
if urg_value:
- tag_string = regsub.gsub (not_in_node_set, '-', tag_string)
- tag_string = regsub.gsub ('--', '-', tag_string)
+ tag_string = re.sub (not_in_node_set, '-', tag_string)
+ tag_string = re.sub ('--', '-', tag_string)
# brr
- tag_string = regsub.gsub ('--', '-', tag_string)
- tag_string = regsub.gsub ('@code', '', tag_string)
- tag_string = regsub.gsub ('@emph', '', tag_string)
- tag_string = regsub.gsub ('@strong', '', tag_string)
+ tag_string = re.sub ('--', '-', tag_string)
+ tag_string = re.sub ('@code', '', tag_string)
+ tag_string = re.sub ('@emph', '', tag_string)
+ tag_string = re.sub ('@strong', '', tag_string)
if tag_name == 'menu':
this.default.top = 'Top'
n = this.new_node (i, tag_string)
@@ -214,23 +225,23 @@
def create_node (this, n):
node = '@node '
set = ''
- if not urg_value and regex.match (not_in_node, n.name) != -1:
+ if not urg_value and re.match (not_in_node, n.name) != -1:
set = set + "@set nodename " + n.name + "\n"
node = node + "@value{nodename}"
else:
node = node + n.name
if not simple_nodes:
- if not urg_value and regex.match (not_in_node, n.next) != -1:
+ if not urg_value and re.match (not_in_node, n.next) != -1:
set = set + "@set nextname " + n.next + "\n"
node = node + ", @value{nextname}"
else:
node = node + ", " + n.next
- if not urg_value and regex.match (not_in_node, n.prev) != -1:
+ if not urg_value and re.match (not_in_node, n.prev) != -1:
set = set + "@set prevname " + n.prev + "\n"
node = node + ", @value{prevname}"
else:
node = node + ", " + n.prev
- if not urg_value and regex.match (not_in_node, n.top) != -1:
+ if not urg_value and re.match (not_in_node, n.top) != -1:
set = set + "@set topname " + n.top + "\n"
node = node + ", @value{topname}"
else:
@@ -249,7 +260,7 @@
d = n.description
if not d:
d = n.name
- if not urg_value and regex.match (not_in_node, n.name) != -1:
+ if not urg_value and re.match (not_in_node, n.name) != -1:
menu = menu + "@set nodename " + n.name + "\n"
menu = menu + "* @value{nodename}::"
menu = menu + ' ' * (TAB_POS - len (n.name)) + d + "\n"
@@ -309,7 +320,7 @@
this.parse ()
this.xrefs ()
this.nodes_and_menus ()
- this.s = regsub.gsub ('^\n\n', '\n', this.s)
+ this.s = re.sub ('^\n\n', '\n', this.s)
this.s = '\n' + this.s
infotitle = ''
basename = os.path.basename (os.path.splitext (this.filename)[0])
--- stepmake/bin/packagepython.py
+++ stepmake/bin/packagepython.py
@@ -7,15 +7,14 @@
# (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
# Jan Nieuwenhuizen <janneke@gnu.org>
-import regex
-import regsub
+import re
import string
import sys
import os
import getopt
-make_assign_re = regex.compile('^\([A-Z_]*\)=\(.*\)$')
+make_assign_re = re.compile('^\([A-Z_]*\)=\(.*\)$')
def read_makefile (fn):
file = open (fn)
@@ -78,8 +77,8 @@
return tuple(t)
def split_my_patchlevel(str):
- return (regsub.sub('[0-9]*$', '', str),
- string.atoi(regsub.sub('[^0-9]*', '', str)))
+ return (re.sub('[0-9]*$', '', str),
+ string.atoi(re.sub('[^0-9]*', '', str)))
def next_version(tup):
@@ -133,10 +132,10 @@
for i in (0,1,2):
if tupl[i] - tupr[i]: return tupl[i] - tupr[i]
if tupl[3] and tupr[3]:
- lname = regsub.sub('[0-9]*$', '', tupl[3])
- lnum = string.atoi(regsub.sub('[^0-9]*', '', tupl[3]))
- rname = regsub.sub('[0-9]*$', '', tupr[3])
- rnum = string.atoi(regsub.sub('[^0-9]*', '', tupr[3]))
+ lname = re.sub('[0-9]*$', '', tupl[3])
+ lnum = string.atoi(re.sub('[^0-9]*', '', tupl[3]))
+ rname = re.sub('[0-9]*$', '', tupr[3])
+ rnum = string.atoi(re.sub('[^0-9]*', '', tupr[3]))
if lname != rname:
raise 'ambiguous'
return sign (lnum - rnum)