ยปCore Development>Code coverage>Tools/scripts/lll.py

Python code coverage for Tools/scripts/lll.py

#countcontent
1n/a#! /usr/bin/env python3
2n/a
3n/a# Find symbolic links and show where they point to.
4n/a# Arguments are directories to search; default is current directory.
5n/a# No recursion.
6n/a# (This is a totally different program from "findsymlinks.py"!)
7n/a
8n/aimport sys, os
9n/a
10n/adef lll(dirname):
11n/a for name in os.listdir(dirname):
12n/a if name not in (os.curdir, os.pardir):
13n/a full = os.path.join(dirname, name)
14n/a if os.path.islink(full):
15n/a print(name, '->', os.readlink(full))
16n/adef main():
17n/a args = sys.argv[1:]
18n/a if not args: args = [os.curdir]
19n/a first = 1
20n/a for arg in args:
21n/a if len(args) > 1:
22n/a if not first: print()
23n/a first = 0
24n/a print(arg + ':')
25n/a lll(arg)
26n/a
27n/aif __name__ == '__main__':
28n/a main()