Mercurial > cpython-lru_cache-weakref
annotate Tools/scripts/lll.py @ 4566:6403c94de50d legacy-trunk
Added safeguard against failure in __del__.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 27 Nov 1996 19:39:58 +0000 |
| parents | 28948181fb2f |
| children | 73758db2f464 |
| rev | line source |
|---|---|
|
1269
28948181fb2f
*** empty log message ***
Guido van Rossum <guido@python.org>
parents:
755
diff
changeset
|
1 #! /usr/local/bin/python |
| 687 | 2 |
| 3 # Find symbolic links and show where they point to. | |
| 4 # Arguments are directories to search; default is current directory. | |
| 5 # No recursion. | |
| 6 # (This is a totally different program from "findsymlinks.py"!) | |
| 7 | |
| 755 | 8 import sys, os |
| 687 | 9 |
| 10 def lll(dirname): | |
| 755 | 11 for name in os.listdir(dirname): |
| 12 if name not in (os.curdir, os.pardir): | |
| 13 full = os.path.join(dirname, name) | |
| 14 if os.path.islink(full): | |
| 15 print name, '->', os.readlink(full) | |
| 687 | 16 |
| 17 args = sys.argv[1:] | |
| 755 | 18 if not args: args = [os.curdir] |
| 687 | 19 first = 1 |
| 20 for arg in args: | |
| 21 if len(args) > 1: | |
| 22 if not first: print | |
| 23 first = 0 | |
| 24 print arg + ':' | |
| 25 lll(arg) |
