summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/which.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-10-04 08:49:00 (GMT)
committerGitHub <noreply@github.com>2022-10-04 08:49:00 (GMT)
commit6cbbc26a73879f17df8896ea4feb40c61b085775 (patch)
tree339c4c5b9e976f00ba0a9809a71592da5a30b070 /Tools/scripts/which.py
parent49802605f8e47c5c7ddc8a6cecdf4afe44765586 (diff)
downloadcpython-6cbbc26a73879f17df8896ea4feb40c61b085775.zip
cpython-6cbbc26a73879f17df8896ea4feb40c61b085775.tar.gz
cpython-6cbbc26a73879f17df8896ea4feb40c61b085775.tar.bz2
gh-97669: Remove outdated example scripts (#97675)
Remove outdated example scripts of the Tools/scripts/ directory. A copy can be found in the old-demos project: https://github.com/gvanrossum/old-demos Removed scripts (39): * byext.py * byteyears.py * cleanfuture.py * copytime.py * crlf.py * db2pickle.py * dutree.doc * dutree.py * find-uname.py * find_recursionlimit.py * finddiv.py * findlinksto.py * findnocoding.py * fixcid.py * fixdiv.py * fixheader.py * fixnotice.py * fixps.py * get-remote-certificate.py * google.py * highlight.py * ifdef.py * import_diagnostics.py * lfcr.py * linktree.py * lll.py * mailerdaemon.py * make_ctype.py * mkreal.py * objgraph.py * pdeps.py * pickle2db.py * pindent.py * pysource.py * reindent-rst.py * rgrep.py * suff.py * texi2html.py * which.py Changes: * Remove test_fixcid, test_lll, test_pdeps and test_pindent of test.test_tools. * Remove get-remote-certificate.py changelog entry, since the script was removed. Note: there is a copy of crlf.py in Lib/test/test_lib2to3/data/.
Diffstat (limited to 'Tools/scripts/which.py')
-rwxr-xr-xTools/scripts/which.py61
1 files changed, 0 insertions, 61 deletions
diff --git a/Tools/scripts/which.py b/Tools/scripts/which.py
deleted file mode 100755
index b42e07c..0000000
--- a/Tools/scripts/which.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#! /usr/bin/env python3
-
-# Variant of "which".
-# On stderr, near and total misses are reported.
-# '-l<flags>' argument adds ls -l<flags> of each file found.
-
-import sys
-if sys.path[0] in (".", ""): del sys.path[0]
-
-import sys, os
-from stat import *
-
-def msg(str):
- sys.stderr.write(str + '\n')
-
-def main():
- pathlist = os.environ['PATH'].split(os.pathsep)
-
- sts = 0
- longlist = ''
-
- if sys.argv[1:] and sys.argv[1][:2] == '-l':
- longlist = sys.argv[1]
- del sys.argv[1]
-
- for prog in sys.argv[1:]:
- ident = ()
- for dir in pathlist:
- filename = os.path.join(dir, prog)
- try:
- st = os.stat(filename)
- except OSError:
- continue
- if not S_ISREG(st[ST_MODE]):
- msg(filename + ': not a disk file')
- else:
- mode = S_IMODE(st[ST_MODE])
- if mode & 0o111:
- if not ident:
- print(filename)
- ident = st[:3]
- else:
- if st[:3] == ident:
- s = 'same as: '
- else:
- s = 'also: '
- msg(s + filename)
- else:
- msg(filename + ': not executable')
- if longlist:
- sts = os.system('ls ' + longlist + ' ' + filename)
- sts = os.waitstatus_to_exitcode(sts)
- if sts: msg('"ls -l" exit status: ' + repr(sts))
- if not ident:
- msg(prog + ': not found')
- sts = 1
-
- sys.exit(sts)
-
-if __name__ == '__main__':
- main()