summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/findlinksto.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-01-17 08:48:39 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-01-17 08:48:39 (GMT)
commit70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7 (patch)
treecf47b67db3753288cfd9fa2adc45e7c5cd2f8741 /Tools/scripts/findlinksto.py
parenta88854059309667092000da55d4d5a5804267e9f (diff)
downloadcpython-70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7.zip
cpython-70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7.tar.gz
cpython-70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7.tar.bz2
Whitespace normalization.
Diffstat (limited to 'Tools/scripts/findlinksto.py')
-rwxr-xr-xTools/scripts/findlinksto.py52
1 files changed, 26 insertions, 26 deletions
diff --git a/Tools/scripts/findlinksto.py b/Tools/scripts/findlinksto.py
index 06821cd..e4731a5 100755
--- a/Tools/scripts/findlinksto.py
+++ b/Tools/scripts/findlinksto.py
@@ -10,33 +10,33 @@ import regex
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:
- sys.stdout = sys.stderr
- print msg
- print 'usage: findlinksto pattern directory ...'
- sys.exit(2)
- pat, dirs = args[0], args[1:]
- prog = regex.compile(pat)
- for dirname in dirs:
- os.path.walk(dirname, visit, prog)
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], '')
+ if len(args) < 2:
+ raise getopt.error, 'not enough arguments'
+ except getopt.error, 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)
+ for dirname in dirs:
+ os.path.walk(dirname, visit, prog)
def visit(prog, dirname, names):
- if os.path.islink(dirname):
- names[:] = []
- return
- if os.path.ismount(dirname):
- print 'descend into', dirname
- for name in names:
- name = os.path.join(dirname, name)
- try:
- linkto = os.readlink(name)
- if prog.search(linkto) >= 0:
- print name, '->', linkto
- except os.error:
- pass
+ if os.path.islink(dirname):
+ names[:] = []
+ return
+ if os.path.ismount(dirname):
+ print 'descend into', dirname
+ for name in names:
+ name = os.path.join(dirname, name)
+ try:
+ linkto = os.readlink(name)
+ if prog.search(linkto) >= 0:
+ print name, '->', linkto
+ except os.error:
+ pass
main()