From d683504b85206334aba32e8706ca6cb15b3efbf7 Mon Sep 17 00:00:00 2001
From: "Andrew M. Kuchling" <amk@amk.ca>
Date: Thu, 6 Feb 2003 19:55:35 +0000
Subject: Use new name for GetoptError, and pass it two arguments Use re module
 instead of regex

---
 Tools/scripts/findlinksto.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Tools/scripts/findlinksto.py b/Tools/scripts/findlinksto.py
index e4731a5..00d4a18 100755
--- a/Tools/scripts/findlinksto.py
+++ b/Tools/scripts/findlinksto.py
@@ -6,21 +6,21 @@
 
 import os
 import sys
-import regex
+import re
 import getopt
 
 def main():
     try:
         opts, args = getopt.getopt(sys.argv[1:], '')
         if len(args) < 2:
-            raise getopt.error, 'not enough arguments'
-    except getopt.error, msg:
+            raise getopt.GetoptError('not enough arguments', None)
+    except getopt.GetoptError, msg:
         sys.stdout = sys.stderr
         print msg
         print 'usage: findlinksto pattern directory ...'
         sys.exit(2)
     pat, dirs = args[0], args[1:]
-    prog = regex.compile(pat)
+    prog = re.compile(pat)
     for dirname in dirs:
         os.path.walk(dirname, visit, prog)
 
@@ -34,7 +34,7 @@ def visit(prog, dirname, names):
         name = os.path.join(dirname, name)
         try:
             linkto = os.readlink(name)
-            if prog.search(linkto) >= 0:
+            if prog.search(linkto) is not None:
                 print name, '->', linkto
         except os.error:
             pass
-- 
cgit v0.12

