Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- parrot/bin/2to3-3.10 +5 -0
- parrot/bin/__pycache__/vba_extract.cpython-310.pyc +0 -0
- parrot/bin/accelerate +8 -0
- parrot/bin/accelerate-config +8 -0
- parrot/bin/accelerate-launch +8 -0
- parrot/bin/accelerate-merge-weights +8 -0
- parrot/bin/bzcmp +76 -0
- parrot/bin/bzdiff +76 -0
- parrot/bin/bzegrep +85 -0
- parrot/bin/bzfgrep +85 -0
- parrot/bin/bzgrep +85 -0
- parrot/bin/bzip2recover +0 -0
- parrot/bin/bzmore +61 -0
- parrot/bin/c_rehash +252 -0
- parrot/bin/clear +0 -0
- parrot/bin/convert-onnx-to-caffe2 +8 -0
- parrot/bin/deepspeed +6 -0
- parrot/bin/dotenv +8 -0
- parrot/bin/dsr +6 -0
- parrot/bin/f2py +8 -0
- parrot/bin/fonttools +8 -0
- parrot/bin/get_gprof +75 -0
- parrot/bin/get_objgraph +54 -0
- parrot/bin/hjson +8 -0
- parrot/bin/huggingface-cli +8 -0
- parrot/bin/idle3 +5 -0
- parrot/bin/idle3.10 +5 -0
- parrot/bin/imageio_download_bin +8 -0
- parrot/bin/isympy +8 -0
- parrot/bin/jsonschema +8 -0
- parrot/bin/latex2mathml +8 -0
- parrot/bin/lzegrep +300 -0
- parrot/bin/lzfgrep +300 -0
- parrot/bin/lzgrep +300 -0
- parrot/bin/lzless +74 -0
- parrot/bin/markdown-it +8 -0
- parrot/bin/mistral-demo +8 -0
- parrot/bin/ninja +8 -0
- parrot/bin/numpy-config +8 -0
- parrot/bin/pip3 +8 -0
- parrot/bin/proton +8 -0
- parrot/bin/pydoc +5 -0
- parrot/bin/pydoc3 +5 -0
- parrot/bin/pyftmerge +8 -0
- parrot/bin/pyftsubset +8 -0
- parrot/bin/pygrun +164 -0
- parrot/bin/python3-config +116 -0
- parrot/bin/python3.10-config +116 -0
- parrot/bin/reset +0 -0
- parrot/bin/shortuuid +8 -0
parrot/bin/2to3-3.10
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python3.10
|
| 2 |
+
import sys
|
| 3 |
+
from lib2to3.main import main
|
| 4 |
+
|
| 5 |
+
sys.exit(main("lib2to3.fixes"))
|
parrot/bin/__pycache__/vba_extract.cpython-310.pyc
ADDED
|
Binary file (1.55 kB). View file
|
|
|
parrot/bin/accelerate
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from accelerate.commands.accelerate_cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/accelerate-config
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from accelerate.commands.config import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/accelerate-launch
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from accelerate.commands.launch import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/accelerate-merge-weights
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from accelerate.commands.merge import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/bzcmp
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
|
| 3 |
+
|
| 4 |
+
# Bzcmp/diff wrapped for bzip2,
|
| 5 |
+
# adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
| 6 |
+
|
| 7 |
+
# Bzcmp and bzdiff are used to invoke the cmp or the diff pro-
|
| 8 |
+
# gram on compressed files. All options specified are passed
|
| 9 |
+
# directly to cmp or diff. If only 1 file is specified, then
|
| 10 |
+
# the files compared are file1 and an uncompressed file1.gz.
|
| 11 |
+
# If two files are specified, then they are uncompressed (if
|
| 12 |
+
# necessary) and fed to cmp or diff. The exit status from cmp
|
| 13 |
+
# or diff is preserved.
|
| 14 |
+
|
| 15 |
+
PATH="/usr/bin:/bin:$PATH"; export PATH
|
| 16 |
+
prog=`echo $0 | sed 's|.*/||'`
|
| 17 |
+
case "$prog" in
|
| 18 |
+
*cmp) comp=${CMP-cmp} ;;
|
| 19 |
+
*) comp=${DIFF-diff} ;;
|
| 20 |
+
esac
|
| 21 |
+
|
| 22 |
+
OPTIONS=
|
| 23 |
+
FILES=
|
| 24 |
+
for ARG
|
| 25 |
+
do
|
| 26 |
+
case "$ARG" in
|
| 27 |
+
-*) OPTIONS="$OPTIONS $ARG";;
|
| 28 |
+
*) if test -f "$ARG"; then
|
| 29 |
+
FILES="$FILES $ARG"
|
| 30 |
+
else
|
| 31 |
+
echo "${prog}: $ARG not found or not a regular file"
|
| 32 |
+
exit 1
|
| 33 |
+
fi ;;
|
| 34 |
+
esac
|
| 35 |
+
done
|
| 36 |
+
if test -z "$FILES"; then
|
| 37 |
+
echo "Usage: $prog [${comp}_options] file [file]"
|
| 38 |
+
exit 1
|
| 39 |
+
fi
|
| 40 |
+
set $FILES
|
| 41 |
+
if test $# -eq 1; then
|
| 42 |
+
FILE=`echo "$1" | sed 's/.bz2$//'`
|
| 43 |
+
bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"
|
| 44 |
+
STAT="$?"
|
| 45 |
+
|
| 46 |
+
elif test $# -eq 2; then
|
| 47 |
+
case "$1" in
|
| 48 |
+
*.bz2)
|
| 49 |
+
case "$2" in
|
| 50 |
+
*.bz2)
|
| 51 |
+
F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
|
| 52 |
+
tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || {
|
| 53 |
+
echo 'cannot create a temporary file' >&2
|
| 54 |
+
exit 1
|
| 55 |
+
}
|
| 56 |
+
bzip2 -cdfq "$2" > "$tmp"
|
| 57 |
+
bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp"
|
| 58 |
+
STAT="$?"
|
| 59 |
+
/bin/rm -f "$tmp";;
|
| 60 |
+
|
| 61 |
+
*) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
|
| 62 |
+
STAT="$?";;
|
| 63 |
+
esac;;
|
| 64 |
+
*) case "$2" in
|
| 65 |
+
*.bz2)
|
| 66 |
+
bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
|
| 67 |
+
STAT="$?";;
|
| 68 |
+
*) $comp $OPTIONS "$1" "$2"
|
| 69 |
+
STAT="$?";;
|
| 70 |
+
esac;;
|
| 71 |
+
esac
|
| 72 |
+
else
|
| 73 |
+
echo "Usage: $prog [${comp}_options] file [file]"
|
| 74 |
+
exit 1
|
| 75 |
+
fi
|
| 76 |
+
exit "$STAT"
|
parrot/bin/bzdiff
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
|
| 3 |
+
|
| 4 |
+
# Bzcmp/diff wrapped for bzip2,
|
| 5 |
+
# adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
| 6 |
+
|
| 7 |
+
# Bzcmp and bzdiff are used to invoke the cmp or the diff pro-
|
| 8 |
+
# gram on compressed files. All options specified are passed
|
| 9 |
+
# directly to cmp or diff. If only 1 file is specified, then
|
| 10 |
+
# the files compared are file1 and an uncompressed file1.gz.
|
| 11 |
+
# If two files are specified, then they are uncompressed (if
|
| 12 |
+
# necessary) and fed to cmp or diff. The exit status from cmp
|
| 13 |
+
# or diff is preserved.
|
| 14 |
+
|
| 15 |
+
PATH="/usr/bin:/bin:$PATH"; export PATH
|
| 16 |
+
prog=`echo $0 | sed 's|.*/||'`
|
| 17 |
+
case "$prog" in
|
| 18 |
+
*cmp) comp=${CMP-cmp} ;;
|
| 19 |
+
*) comp=${DIFF-diff} ;;
|
| 20 |
+
esac
|
| 21 |
+
|
| 22 |
+
OPTIONS=
|
| 23 |
+
FILES=
|
| 24 |
+
for ARG
|
| 25 |
+
do
|
| 26 |
+
case "$ARG" in
|
| 27 |
+
-*) OPTIONS="$OPTIONS $ARG";;
|
| 28 |
+
*) if test -f "$ARG"; then
|
| 29 |
+
FILES="$FILES $ARG"
|
| 30 |
+
else
|
| 31 |
+
echo "${prog}: $ARG not found or not a regular file"
|
| 32 |
+
exit 1
|
| 33 |
+
fi ;;
|
| 34 |
+
esac
|
| 35 |
+
done
|
| 36 |
+
if test -z "$FILES"; then
|
| 37 |
+
echo "Usage: $prog [${comp}_options] file [file]"
|
| 38 |
+
exit 1
|
| 39 |
+
fi
|
| 40 |
+
set $FILES
|
| 41 |
+
if test $# -eq 1; then
|
| 42 |
+
FILE=`echo "$1" | sed 's/.bz2$//'`
|
| 43 |
+
bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"
|
| 44 |
+
STAT="$?"
|
| 45 |
+
|
| 46 |
+
elif test $# -eq 2; then
|
| 47 |
+
case "$1" in
|
| 48 |
+
*.bz2)
|
| 49 |
+
case "$2" in
|
| 50 |
+
*.bz2)
|
| 51 |
+
F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
|
| 52 |
+
tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || {
|
| 53 |
+
echo 'cannot create a temporary file' >&2
|
| 54 |
+
exit 1
|
| 55 |
+
}
|
| 56 |
+
bzip2 -cdfq "$2" > "$tmp"
|
| 57 |
+
bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp"
|
| 58 |
+
STAT="$?"
|
| 59 |
+
/bin/rm -f "$tmp";;
|
| 60 |
+
|
| 61 |
+
*) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
|
| 62 |
+
STAT="$?";;
|
| 63 |
+
esac;;
|
| 64 |
+
*) case "$2" in
|
| 65 |
+
*.bz2)
|
| 66 |
+
bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
|
| 67 |
+
STAT="$?";;
|
| 68 |
+
*) $comp $OPTIONS "$1" "$2"
|
| 69 |
+
STAT="$?";;
|
| 70 |
+
esac;;
|
| 71 |
+
esac
|
| 72 |
+
else
|
| 73 |
+
echo "Usage: $prog [${comp}_options] file [file]"
|
| 74 |
+
exit 1
|
| 75 |
+
fi
|
| 76 |
+
exit "$STAT"
|
parrot/bin/bzegrep
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# Bzgrep wrapped for bzip2,
|
| 4 |
+
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
| 5 |
+
## zgrep notice:
|
| 6 |
+
## zgrep -- a wrapper around a grep program that decompresses files as needed
|
| 7 |
+
## Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
| 8 |
+
|
| 9 |
+
PATH="/usr/bin:$PATH"; export PATH
|
| 10 |
+
|
| 11 |
+
prog=`echo $0 | sed 's|.*/||'`
|
| 12 |
+
case "$prog" in
|
| 13 |
+
*egrep) grep=${EGREP-egrep} ;;
|
| 14 |
+
*fgrep) grep=${FGREP-fgrep} ;;
|
| 15 |
+
*) grep=${GREP-grep} ;;
|
| 16 |
+
esac
|
| 17 |
+
pat=""
|
| 18 |
+
while test $# -ne 0; do
|
| 19 |
+
case "$1" in
|
| 20 |
+
-e | -f) opt="$opt $1"; shift; pat="$1"
|
| 21 |
+
if test "$grep" = grep; then # grep is buggy with -e on SVR4
|
| 22 |
+
grep=egrep
|
| 23 |
+
fi;;
|
| 24 |
+
-A | -B) opt="$opt $1 $2"; shift;;
|
| 25 |
+
-*) opt="$opt $1";;
|
| 26 |
+
*) if test -z "$pat"; then
|
| 27 |
+
pat="$1"
|
| 28 |
+
else
|
| 29 |
+
break;
|
| 30 |
+
fi;;
|
| 31 |
+
esac
|
| 32 |
+
shift
|
| 33 |
+
done
|
| 34 |
+
|
| 35 |
+
if test -z "$pat"; then
|
| 36 |
+
echo "grep through bzip2 files"
|
| 37 |
+
echo "usage: $prog [grep_options] pattern [files]"
|
| 38 |
+
exit 1
|
| 39 |
+
fi
|
| 40 |
+
|
| 41 |
+
list=0
|
| 42 |
+
silent=0
|
| 43 |
+
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
|
| 44 |
+
case "$op" in
|
| 45 |
+
*l*) list=1
|
| 46 |
+
esac
|
| 47 |
+
case "$op" in
|
| 48 |
+
*h*) silent=1
|
| 49 |
+
esac
|
| 50 |
+
|
| 51 |
+
if test $# -eq 0; then
|
| 52 |
+
bzip2 -cdfq | $grep $opt "$pat"
|
| 53 |
+
exit $?
|
| 54 |
+
fi
|
| 55 |
+
|
| 56 |
+
res=0
|
| 57 |
+
for i do
|
| 58 |
+
if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
|
| 59 |
+
if test $list -eq 1; then
|
| 60 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
|
| 61 |
+
r=$?
|
| 62 |
+
elif test $# -eq 1 -o $silent -eq 1; then
|
| 63 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
| 64 |
+
r=$?
|
| 65 |
+
else
|
| 66 |
+
j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
|
| 67 |
+
j=`printf "%s" "$j" | tr '\n' ' '`
|
| 68 |
+
# A trick adapted from
|
| 69 |
+
# https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J
|
| 70 |
+
# that has the same effect as the following bash code:
|
| 71 |
+
# bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
| 72 |
+
# r=${PIPESTATUS[1]}
|
| 73 |
+
exec 3>&1
|
| 74 |
+
eval `
|
| 75 |
+
exec 4>&1 >&3 3>&-
|
| 76 |
+
{
|
| 77 |
+
bzip2 -cdfq "$i" 4>&-
|
| 78 |
+
} | {
|
| 79 |
+
$grep $opt "$pat" 4>&-; echo "r=$?;" >&4
|
| 80 |
+
} | sed "s|^|${j}:|"
|
| 81 |
+
`
|
| 82 |
+
fi
|
| 83 |
+
test "$r" -ne 0 && res="$r"
|
| 84 |
+
done
|
| 85 |
+
exit $res
|
parrot/bin/bzfgrep
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# Bzgrep wrapped for bzip2,
|
| 4 |
+
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
| 5 |
+
## zgrep notice:
|
| 6 |
+
## zgrep -- a wrapper around a grep program that decompresses files as needed
|
| 7 |
+
## Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
| 8 |
+
|
| 9 |
+
PATH="/usr/bin:$PATH"; export PATH
|
| 10 |
+
|
| 11 |
+
prog=`echo $0 | sed 's|.*/||'`
|
| 12 |
+
case "$prog" in
|
| 13 |
+
*egrep) grep=${EGREP-egrep} ;;
|
| 14 |
+
*fgrep) grep=${FGREP-fgrep} ;;
|
| 15 |
+
*) grep=${GREP-grep} ;;
|
| 16 |
+
esac
|
| 17 |
+
pat=""
|
| 18 |
+
while test $# -ne 0; do
|
| 19 |
+
case "$1" in
|
| 20 |
+
-e | -f) opt="$opt $1"; shift; pat="$1"
|
| 21 |
+
if test "$grep" = grep; then # grep is buggy with -e on SVR4
|
| 22 |
+
grep=egrep
|
| 23 |
+
fi;;
|
| 24 |
+
-A | -B) opt="$opt $1 $2"; shift;;
|
| 25 |
+
-*) opt="$opt $1";;
|
| 26 |
+
*) if test -z "$pat"; then
|
| 27 |
+
pat="$1"
|
| 28 |
+
else
|
| 29 |
+
break;
|
| 30 |
+
fi;;
|
| 31 |
+
esac
|
| 32 |
+
shift
|
| 33 |
+
done
|
| 34 |
+
|
| 35 |
+
if test -z "$pat"; then
|
| 36 |
+
echo "grep through bzip2 files"
|
| 37 |
+
echo "usage: $prog [grep_options] pattern [files]"
|
| 38 |
+
exit 1
|
| 39 |
+
fi
|
| 40 |
+
|
| 41 |
+
list=0
|
| 42 |
+
silent=0
|
| 43 |
+
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
|
| 44 |
+
case "$op" in
|
| 45 |
+
*l*) list=1
|
| 46 |
+
esac
|
| 47 |
+
case "$op" in
|
| 48 |
+
*h*) silent=1
|
| 49 |
+
esac
|
| 50 |
+
|
| 51 |
+
if test $# -eq 0; then
|
| 52 |
+
bzip2 -cdfq | $grep $opt "$pat"
|
| 53 |
+
exit $?
|
| 54 |
+
fi
|
| 55 |
+
|
| 56 |
+
res=0
|
| 57 |
+
for i do
|
| 58 |
+
if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
|
| 59 |
+
if test $list -eq 1; then
|
| 60 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
|
| 61 |
+
r=$?
|
| 62 |
+
elif test $# -eq 1 -o $silent -eq 1; then
|
| 63 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
| 64 |
+
r=$?
|
| 65 |
+
else
|
| 66 |
+
j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
|
| 67 |
+
j=`printf "%s" "$j" | tr '\n' ' '`
|
| 68 |
+
# A trick adapted from
|
| 69 |
+
# https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J
|
| 70 |
+
# that has the same effect as the following bash code:
|
| 71 |
+
# bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
| 72 |
+
# r=${PIPESTATUS[1]}
|
| 73 |
+
exec 3>&1
|
| 74 |
+
eval `
|
| 75 |
+
exec 4>&1 >&3 3>&-
|
| 76 |
+
{
|
| 77 |
+
bzip2 -cdfq "$i" 4>&-
|
| 78 |
+
} | {
|
| 79 |
+
$grep $opt "$pat" 4>&-; echo "r=$?;" >&4
|
| 80 |
+
} | sed "s|^|${j}:|"
|
| 81 |
+
`
|
| 82 |
+
fi
|
| 83 |
+
test "$r" -ne 0 && res="$r"
|
| 84 |
+
done
|
| 85 |
+
exit $res
|
parrot/bin/bzgrep
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# Bzgrep wrapped for bzip2,
|
| 4 |
+
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
| 5 |
+
## zgrep notice:
|
| 6 |
+
## zgrep -- a wrapper around a grep program that decompresses files as needed
|
| 7 |
+
## Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
| 8 |
+
|
| 9 |
+
PATH="/usr/bin:$PATH"; export PATH
|
| 10 |
+
|
| 11 |
+
prog=`echo $0 | sed 's|.*/||'`
|
| 12 |
+
case "$prog" in
|
| 13 |
+
*egrep) grep=${EGREP-egrep} ;;
|
| 14 |
+
*fgrep) grep=${FGREP-fgrep} ;;
|
| 15 |
+
*) grep=${GREP-grep} ;;
|
| 16 |
+
esac
|
| 17 |
+
pat=""
|
| 18 |
+
while test $# -ne 0; do
|
| 19 |
+
case "$1" in
|
| 20 |
+
-e | -f) opt="$opt $1"; shift; pat="$1"
|
| 21 |
+
if test "$grep" = grep; then # grep is buggy with -e on SVR4
|
| 22 |
+
grep=egrep
|
| 23 |
+
fi;;
|
| 24 |
+
-A | -B) opt="$opt $1 $2"; shift;;
|
| 25 |
+
-*) opt="$opt $1";;
|
| 26 |
+
*) if test -z "$pat"; then
|
| 27 |
+
pat="$1"
|
| 28 |
+
else
|
| 29 |
+
break;
|
| 30 |
+
fi;;
|
| 31 |
+
esac
|
| 32 |
+
shift
|
| 33 |
+
done
|
| 34 |
+
|
| 35 |
+
if test -z "$pat"; then
|
| 36 |
+
echo "grep through bzip2 files"
|
| 37 |
+
echo "usage: $prog [grep_options] pattern [files]"
|
| 38 |
+
exit 1
|
| 39 |
+
fi
|
| 40 |
+
|
| 41 |
+
list=0
|
| 42 |
+
silent=0
|
| 43 |
+
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
|
| 44 |
+
case "$op" in
|
| 45 |
+
*l*) list=1
|
| 46 |
+
esac
|
| 47 |
+
case "$op" in
|
| 48 |
+
*h*) silent=1
|
| 49 |
+
esac
|
| 50 |
+
|
| 51 |
+
if test $# -eq 0; then
|
| 52 |
+
bzip2 -cdfq | $grep $opt "$pat"
|
| 53 |
+
exit $?
|
| 54 |
+
fi
|
| 55 |
+
|
| 56 |
+
res=0
|
| 57 |
+
for i do
|
| 58 |
+
if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
|
| 59 |
+
if test $list -eq 1; then
|
| 60 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
|
| 61 |
+
r=$?
|
| 62 |
+
elif test $# -eq 1 -o $silent -eq 1; then
|
| 63 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
| 64 |
+
r=$?
|
| 65 |
+
else
|
| 66 |
+
j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
|
| 67 |
+
j=`printf "%s" "$j" | tr '\n' ' '`
|
| 68 |
+
# A trick adapted from
|
| 69 |
+
# https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J
|
| 70 |
+
# that has the same effect as the following bash code:
|
| 71 |
+
# bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
| 72 |
+
# r=${PIPESTATUS[1]}
|
| 73 |
+
exec 3>&1
|
| 74 |
+
eval `
|
| 75 |
+
exec 4>&1 >&3 3>&-
|
| 76 |
+
{
|
| 77 |
+
bzip2 -cdfq "$i" 4>&-
|
| 78 |
+
} | {
|
| 79 |
+
$grep $opt "$pat" 4>&-; echo "r=$?;" >&4
|
| 80 |
+
} | sed "s|^|${j}:|"
|
| 81 |
+
`
|
| 82 |
+
fi
|
| 83 |
+
test "$r" -ne 0 && res="$r"
|
| 84 |
+
done
|
| 85 |
+
exit $res
|
parrot/bin/bzip2recover
ADDED
|
Binary file (30.9 kB). View file
|
|
|
parrot/bin/bzmore
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# Bzmore wrapped for bzip2,
|
| 4 |
+
# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
| 5 |
+
|
| 6 |
+
PATH="/usr/bin:$PATH"; export PATH
|
| 7 |
+
|
| 8 |
+
prog=`echo $0 | sed 's|.*/||'`
|
| 9 |
+
case "$prog" in
|
| 10 |
+
*less) more=less ;;
|
| 11 |
+
*) more=more ;;
|
| 12 |
+
esac
|
| 13 |
+
|
| 14 |
+
if test "`echo -n a`" = "-n a"; then
|
| 15 |
+
# looks like a SysV system:
|
| 16 |
+
n1=''; n2='\c'
|
| 17 |
+
else
|
| 18 |
+
n1='-n'; n2=''
|
| 19 |
+
fi
|
| 20 |
+
oldtty=`stty -g 2>/dev/null`
|
| 21 |
+
if stty -cbreak 2>/dev/null; then
|
| 22 |
+
cb='cbreak'; ncb='-cbreak'
|
| 23 |
+
else
|
| 24 |
+
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
| 25 |
+
cb='min 1 -icanon'; ncb='icanon eof ^d'
|
| 26 |
+
fi
|
| 27 |
+
if test $? -eq 0 -a -n "$oldtty"; then
|
| 28 |
+
trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
|
| 29 |
+
else
|
| 30 |
+
trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
|
| 31 |
+
fi
|
| 32 |
+
|
| 33 |
+
if test $# = 0; then
|
| 34 |
+
if test -t 0; then
|
| 35 |
+
echo usage: $prog files...
|
| 36 |
+
else
|
| 37 |
+
bzip2 -cdfq | eval $more
|
| 38 |
+
fi
|
| 39 |
+
else
|
| 40 |
+
FIRST=1
|
| 41 |
+
for FILE
|
| 42 |
+
do
|
| 43 |
+
if test $FIRST -eq 0; then
|
| 44 |
+
echo $n1 "--More--(Next file: $FILE)$n2"
|
| 45 |
+
stty $cb -echo 2>/dev/null
|
| 46 |
+
ANS=`dd bs=1 count=1 2>/dev/null`
|
| 47 |
+
stty $ncb echo 2>/dev/null
|
| 48 |
+
echo " "
|
| 49 |
+
if test "$ANS" = 'e' -o "$ANS" = 'q'; then
|
| 50 |
+
exit
|
| 51 |
+
fi
|
| 52 |
+
fi
|
| 53 |
+
if test "$ANS" != 's'; then
|
| 54 |
+
echo "------> $FILE <------"
|
| 55 |
+
bzip2 -cdfq "$FILE" | eval $more
|
| 56 |
+
fi
|
| 57 |
+
if test -t; then
|
| 58 |
+
FIRST=0
|
| 59 |
+
fi
|
| 60 |
+
done
|
| 61 |
+
fi
|
parrot/bin/c_rehash
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/croot/openssl_1740989479866/_build_env/bin/perl
|
| 2 |
+
|
| 3 |
+
# WARNING: do not edit!
|
| 4 |
+
# Generated by Makefile from tools/c_rehash.in
|
| 5 |
+
# Copyright 1999-2022 The OpenSSL Project Authors. All Rights Reserved.
|
| 6 |
+
#
|
| 7 |
+
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
| 8 |
+
# this file except in compliance with the License. You can obtain a copy
|
| 9 |
+
# in the file LICENSE in the source distribution or at
|
| 10 |
+
# https://www.openssl.org/source/license.html
|
| 11 |
+
|
| 12 |
+
# Perl c_rehash script, scan all files in a directory
|
| 13 |
+
# and add symbolic links to their hash values.
|
| 14 |
+
|
| 15 |
+
my $dir = "";
|
| 16 |
+
my $prefix = "/root/envs/parrot";
|
| 17 |
+
|
| 18 |
+
my $errorcount = 0;
|
| 19 |
+
my $openssl = $ENV{OPENSSL} || "openssl";
|
| 20 |
+
my $pwd;
|
| 21 |
+
my $x509hash = "-subject_hash";
|
| 22 |
+
my $crlhash = "-hash";
|
| 23 |
+
my $verbose = 0;
|
| 24 |
+
my $symlink_exists=eval {symlink("",""); 1};
|
| 25 |
+
my $removelinks = 1;
|
| 26 |
+
|
| 27 |
+
## Parse flags.
|
| 28 |
+
while ( $ARGV[0] =~ /^-/ ) {
|
| 29 |
+
my $flag = shift @ARGV;
|
| 30 |
+
last if ( $flag eq '--');
|
| 31 |
+
if ( $flag eq '-old') {
|
| 32 |
+
$x509hash = "-subject_hash_old";
|
| 33 |
+
$crlhash = "-hash_old";
|
| 34 |
+
} elsif ( $flag eq '-h' || $flag eq '-help' ) {
|
| 35 |
+
help();
|
| 36 |
+
} elsif ( $flag eq '-n' ) {
|
| 37 |
+
$removelinks = 0;
|
| 38 |
+
} elsif ( $flag eq '-v' ) {
|
| 39 |
+
$verbose++;
|
| 40 |
+
}
|
| 41 |
+
else {
|
| 42 |
+
print STDERR "Usage error; try -h.\n";
|
| 43 |
+
exit 1;
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
sub help {
|
| 48 |
+
print "Usage: c_rehash [-old] [-h] [-help] [-v] [dirs...]\n";
|
| 49 |
+
print " -old use old-style digest\n";
|
| 50 |
+
print " -h or -help print this help text\n";
|
| 51 |
+
print " -v print files removed and linked\n";
|
| 52 |
+
exit 0;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
eval "require Cwd";
|
| 56 |
+
if (defined(&Cwd::getcwd)) {
|
| 57 |
+
$pwd=Cwd::getcwd();
|
| 58 |
+
} else {
|
| 59 |
+
$pwd=`pwd`;
|
| 60 |
+
chomp($pwd);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
# DOS/Win32 or Unix delimiter? Prefix our installdir, then search.
|
| 64 |
+
my $path_delim = ($pwd =~ /^[a-z]\:/i) ? ';' : ':';
|
| 65 |
+
$ENV{PATH} = "$prefix/bin" . ($ENV{PATH} ? $path_delim . $ENV{PATH} : "");
|
| 66 |
+
|
| 67 |
+
if (! -x $openssl) {
|
| 68 |
+
my $found = 0;
|
| 69 |
+
foreach (split /$path_delim/, $ENV{PATH}) {
|
| 70 |
+
if (-x "$_/$openssl") {
|
| 71 |
+
$found = 1;
|
| 72 |
+
$openssl = "$_/$openssl";
|
| 73 |
+
last;
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
if ($found == 0) {
|
| 77 |
+
print STDERR "c_rehash: rehashing skipped ('openssl' program not available)\n";
|
| 78 |
+
exit 0;
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
if (@ARGV) {
|
| 83 |
+
@dirlist = @ARGV;
|
| 84 |
+
} elsif ($ENV{SSL_CERT_DIR}) {
|
| 85 |
+
@dirlist = split /$path_delim/, $ENV{SSL_CERT_DIR};
|
| 86 |
+
} else {
|
| 87 |
+
$dirlist[0] = "$dir/certs";
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
if (-d $dirlist[0]) {
|
| 91 |
+
chdir $dirlist[0];
|
| 92 |
+
$openssl="$pwd/$openssl" if (!-x $openssl);
|
| 93 |
+
chdir $pwd;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
foreach (@dirlist) {
|
| 97 |
+
if (-d $_ ) {
|
| 98 |
+
if ( -w $_) {
|
| 99 |
+
hash_dir($_);
|
| 100 |
+
} else {
|
| 101 |
+
print "Skipping $_, can't write\n";
|
| 102 |
+
$errorcount++;
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
exit($errorcount);
|
| 107 |
+
|
| 108 |
+
sub copy_file {
|
| 109 |
+
my ($src_fname, $dst_fname) = @_;
|
| 110 |
+
|
| 111 |
+
if (open(my $in, "<", $src_fname)) {
|
| 112 |
+
if (open(my $out, ">", $dst_fname)) {
|
| 113 |
+
print $out $_ while (<$in>);
|
| 114 |
+
close $out;
|
| 115 |
+
} else {
|
| 116 |
+
warn "Cannot open $dst_fname for write, $!";
|
| 117 |
+
}
|
| 118 |
+
close $in;
|
| 119 |
+
} else {
|
| 120 |
+
warn "Cannot open $src_fname for read, $!";
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
sub hash_dir {
|
| 125 |
+
my $dir = shift;
|
| 126 |
+
my %hashlist;
|
| 127 |
+
|
| 128 |
+
print "Doing $dir\n";
|
| 129 |
+
|
| 130 |
+
if (!chdir $dir) {
|
| 131 |
+
print STDERR "WARNING: Cannot chdir to '$dir', $!\n";
|
| 132 |
+
return;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
opendir(DIR, ".") || print STDERR "WARNING: Cannot opendir '.', $!\n";
|
| 136 |
+
my @flist = sort readdir(DIR);
|
| 137 |
+
closedir DIR;
|
| 138 |
+
if ( $removelinks ) {
|
| 139 |
+
# Delete any existing symbolic links
|
| 140 |
+
foreach (grep {/^[\da-f]+\.r{0,1}\d+$/} @flist) {
|
| 141 |
+
if (-l $_) {
|
| 142 |
+
print "unlink $_\n" if $verbose;
|
| 143 |
+
unlink $_ || warn "Can't unlink $_, $!\n";
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
FILE: foreach $fname (grep {/\.(pem)|(crt)|(cer)|(crl)$/} @flist) {
|
| 148 |
+
# Check to see if certificates and/or CRLs present.
|
| 149 |
+
my ($cert, $crl) = check_file($fname);
|
| 150 |
+
if (!$cert && !$crl) {
|
| 151 |
+
print STDERR "WARNING: $fname does not contain a certificate or CRL: skipping\n";
|
| 152 |
+
next;
|
| 153 |
+
}
|
| 154 |
+
link_hash_cert($fname) if ($cert);
|
| 155 |
+
link_hash_crl($fname) if ($crl);
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
chdir $pwd;
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
sub check_file {
|
| 162 |
+
my ($is_cert, $is_crl) = (0,0);
|
| 163 |
+
my $fname = $_[0];
|
| 164 |
+
|
| 165 |
+
open(my $in, "<", $fname);
|
| 166 |
+
while(<$in>) {
|
| 167 |
+
if (/^-----BEGIN (.*)-----/) {
|
| 168 |
+
my $hdr = $1;
|
| 169 |
+
if ($hdr =~ /^(X509 |TRUSTED |)CERTIFICATE$/) {
|
| 170 |
+
$is_cert = 1;
|
| 171 |
+
last if ($is_crl);
|
| 172 |
+
} elsif ($hdr eq "X509 CRL") {
|
| 173 |
+
$is_crl = 1;
|
| 174 |
+
last if ($is_cert);
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
close $in;
|
| 179 |
+
return ($is_cert, $is_crl);
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
sub compute_hash {
|
| 183 |
+
my $fh;
|
| 184 |
+
if ( $^O eq "VMS" ) {
|
| 185 |
+
# VMS uses the open through shell
|
| 186 |
+
# The file names are safe there and list form is unsupported
|
| 187 |
+
if (!open($fh, "-|", join(' ', @_))) {
|
| 188 |
+
print STDERR "Cannot compute hash on '$fname'\n";
|
| 189 |
+
return;
|
| 190 |
+
}
|
| 191 |
+
} else {
|
| 192 |
+
if (!open($fh, "-|", @_)) {
|
| 193 |
+
print STDERR "Cannot compute hash on '$fname'\n";
|
| 194 |
+
return;
|
| 195 |
+
}
|
| 196 |
+
}
|
| 197 |
+
return (<$fh>, <$fh>);
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
# Link a certificate to its subject name hash value, each hash is of
|
| 201 |
+
# the form <hash>.<n> where n is an integer. If the hash value already exists
|
| 202 |
+
# then we need to up the value of n, unless its a duplicate in which
|
| 203 |
+
# case we skip the link. We check for duplicates by comparing the
|
| 204 |
+
# certificate fingerprints
|
| 205 |
+
|
| 206 |
+
sub link_hash_cert {
|
| 207 |
+
link_hash($_[0], 'cert');
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
# Same as above except for a CRL. CRL links are of the form <hash>.r<n>
|
| 211 |
+
|
| 212 |
+
sub link_hash_crl {
|
| 213 |
+
link_hash($_[0], 'crl');
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
sub link_hash {
|
| 217 |
+
my ($fname, $type) = @_;
|
| 218 |
+
my $is_cert = $type eq 'cert';
|
| 219 |
+
|
| 220 |
+
my ($hash, $fprint) = compute_hash($openssl,
|
| 221 |
+
$is_cert ? "x509" : "crl",
|
| 222 |
+
$is_cert ? $x509hash : $crlhash,
|
| 223 |
+
"-fingerprint", "-noout",
|
| 224 |
+
"-in", $fname);
|
| 225 |
+
chomp $hash;
|
| 226 |
+
$hash =~ s/^.*=// if !$is_cert;
|
| 227 |
+
chomp $fprint;
|
| 228 |
+
return if !$hash;
|
| 229 |
+
$fprint =~ s/^.*=//;
|
| 230 |
+
$fprint =~ tr/://d;
|
| 231 |
+
my $suffix = 0;
|
| 232 |
+
# Search for an unused hash filename
|
| 233 |
+
my $crlmark = $is_cert ? "" : "r";
|
| 234 |
+
while(exists $hashlist{"$hash.$crlmark$suffix"}) {
|
| 235 |
+
# Hash matches: if fingerprint matches its a duplicate cert
|
| 236 |
+
if ($hashlist{"$hash.$crlmark$suffix"} eq $fprint) {
|
| 237 |
+
my $what = $is_cert ? 'certificate' : 'CRL';
|
| 238 |
+
print STDERR "WARNING: Skipping duplicate $what $fname\n";
|
| 239 |
+
return;
|
| 240 |
+
}
|
| 241 |
+
$suffix++;
|
| 242 |
+
}
|
| 243 |
+
$hash .= ".$crlmark$suffix";
|
| 244 |
+
if ($symlink_exists) {
|
| 245 |
+
print "link $fname -> $hash\n" if $verbose;
|
| 246 |
+
symlink $fname, $hash || warn "Can't symlink, $!";
|
| 247 |
+
} else {
|
| 248 |
+
print "copy $fname -> $hash\n" if $verbose;
|
| 249 |
+
copy_file($fname, $hash);
|
| 250 |
+
}
|
| 251 |
+
$hashlist{$hash} = $fprint;
|
| 252 |
+
}
|
parrot/bin/clear
ADDED
|
Binary file (14.3 kB). View file
|
|
|
parrot/bin/convert-onnx-to-caffe2
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from caffe2.python.onnx.bin.conversion import onnx_to_caffe2
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(onnx_to_caffe2())
|
parrot/bin/deepspeed
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
|
| 3 |
+
from deepspeed.launcher.runner import main
|
| 4 |
+
|
| 5 |
+
if __name__ == '__main__':
|
| 6 |
+
main()
|
parrot/bin/dotenv
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from dotenv.__main__ import cli
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(cli())
|
parrot/bin/dsr
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
|
| 3 |
+
from deepspeed.env_report import cli_main
|
| 4 |
+
|
| 5 |
+
if __name__ == '__main__':
|
| 6 |
+
cli_main()
|
parrot/bin/f2py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from numpy.f2py.f2py2e import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/fonttools
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from fontTools.__main__ import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/get_gprof
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
#
|
| 3 |
+
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
|
| 4 |
+
# Copyright (c) 2008-2016 California Institute of Technology.
|
| 5 |
+
# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation.
|
| 6 |
+
# License: 3-clause BSD. The full license text is available at:
|
| 7 |
+
# - https://github.com/uqfoundation/dill/blob/master/LICENSE
|
| 8 |
+
'''
|
| 9 |
+
build profile graph for the given instance
|
| 10 |
+
|
| 11 |
+
running:
|
| 12 |
+
$ get_gprof <args> <instance>
|
| 13 |
+
|
| 14 |
+
executes:
|
| 15 |
+
gprof2dot -f pstats <args> <type>.prof | dot -Tpng -o <type>.call.png
|
| 16 |
+
|
| 17 |
+
where:
|
| 18 |
+
<args> are arguments for gprof2dot, such as "-n 5 -e 5"
|
| 19 |
+
<instance> is code to create the instance to profile
|
| 20 |
+
<type> is the class of the instance (i.e. type(instance))
|
| 21 |
+
|
| 22 |
+
For example:
|
| 23 |
+
$ get_gprof -n 5 -e 1 "import numpy; numpy.array([1,2])"
|
| 24 |
+
|
| 25 |
+
will create 'ndarray.call.png' with the profile graph for numpy.array([1,2]),
|
| 26 |
+
where '-n 5' eliminates nodes below 5% threshold, similarly '-e 1' eliminates
|
| 27 |
+
edges below 1% threshold
|
| 28 |
+
'''
|
| 29 |
+
|
| 30 |
+
if __name__ == "__main__":
|
| 31 |
+
import sys
|
| 32 |
+
if len(sys.argv) < 2:
|
| 33 |
+
print ("Please provide an object instance (e.g. 'import math; math.pi')")
|
| 34 |
+
sys.exit()
|
| 35 |
+
# grab args for gprof2dot
|
| 36 |
+
args = sys.argv[1:-1]
|
| 37 |
+
args = ' '.join(args)
|
| 38 |
+
# last arg builds the object
|
| 39 |
+
obj = sys.argv[-1]
|
| 40 |
+
obj = obj.split(';')
|
| 41 |
+
# multi-line prep for generating an instance
|
| 42 |
+
for line in obj[:-1]:
|
| 43 |
+
exec(line)
|
| 44 |
+
# one-line generation of an instance
|
| 45 |
+
try:
|
| 46 |
+
obj = eval(obj[-1])
|
| 47 |
+
except Exception:
|
| 48 |
+
print ("Error processing object instance")
|
| 49 |
+
sys.exit()
|
| 50 |
+
|
| 51 |
+
# get object 'name'
|
| 52 |
+
objtype = type(obj)
|
| 53 |
+
name = getattr(objtype, '__name__', getattr(objtype, '__class__', objtype))
|
| 54 |
+
|
| 55 |
+
# profile dumping an object
|
| 56 |
+
import dill
|
| 57 |
+
import os
|
| 58 |
+
import cProfile
|
| 59 |
+
#name = os.path.splitext(os.path.basename(__file__))[0]
|
| 60 |
+
cProfile.run("dill.dumps(obj)", filename="%s.prof" % name)
|
| 61 |
+
msg = "gprof2dot -f pstats %s %s.prof | dot -Tpng -o %s.call.png" % (args, name, name)
|
| 62 |
+
try:
|
| 63 |
+
res = os.system(msg)
|
| 64 |
+
except Exception:
|
| 65 |
+
print ("Please verify install of 'gprof2dot' to view profile graphs")
|
| 66 |
+
if res:
|
| 67 |
+
print ("Please verify install of 'gprof2dot' to view profile graphs")
|
| 68 |
+
|
| 69 |
+
# get stats
|
| 70 |
+
f_prof = "%s.prof" % name
|
| 71 |
+
import pstats
|
| 72 |
+
stats = pstats.Stats(f_prof, stream=sys.stdout)
|
| 73 |
+
stats.strip_dirs().sort_stats('cumtime')
|
| 74 |
+
stats.print_stats(20) #XXX: save to file instead of print top 20?
|
| 75 |
+
os.remove(f_prof)
|
parrot/bin/get_objgraph
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
#
|
| 3 |
+
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
|
| 4 |
+
# Copyright (c) 2008-2016 California Institute of Technology.
|
| 5 |
+
# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation.
|
| 6 |
+
# License: 3-clause BSD. The full license text is available at:
|
| 7 |
+
# - https://github.com/uqfoundation/dill/blob/master/LICENSE
|
| 8 |
+
"""
|
| 9 |
+
display the reference paths for objects in ``dill.types`` or a .pkl file
|
| 10 |
+
|
| 11 |
+
Notes:
|
| 12 |
+
the generated image is useful in showing the pointer references in
|
| 13 |
+
objects that are or can be pickled. Any object in ``dill.objects``
|
| 14 |
+
listed in ``dill.load_types(picklable=True, unpicklable=True)`` works.
|
| 15 |
+
|
| 16 |
+
Examples::
|
| 17 |
+
|
| 18 |
+
$ get_objgraph ArrayType
|
| 19 |
+
Image generated as ArrayType.png
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
import dill as pickle
|
| 23 |
+
#pickle.debug.trace(True)
|
| 24 |
+
#import pickle
|
| 25 |
+
|
| 26 |
+
# get all objects for testing
|
| 27 |
+
from dill import load_types
|
| 28 |
+
load_types(pickleable=True,unpickleable=True)
|
| 29 |
+
from dill import objects
|
| 30 |
+
|
| 31 |
+
if __name__ == "__main__":
|
| 32 |
+
import sys
|
| 33 |
+
if len(sys.argv) != 2:
|
| 34 |
+
print ("Please provide exactly one file or type name (e.g. 'IntType')")
|
| 35 |
+
msg = "\n"
|
| 36 |
+
for objtype in list(objects.keys())[:40]:
|
| 37 |
+
msg += objtype + ', '
|
| 38 |
+
print (msg + "...")
|
| 39 |
+
else:
|
| 40 |
+
objtype = str(sys.argv[-1])
|
| 41 |
+
try:
|
| 42 |
+
obj = objects[objtype]
|
| 43 |
+
except KeyError:
|
| 44 |
+
obj = pickle.load(open(objtype,'rb'))
|
| 45 |
+
import os
|
| 46 |
+
objtype = os.path.splitext(objtype)[0]
|
| 47 |
+
try:
|
| 48 |
+
import objgraph
|
| 49 |
+
objgraph.show_refs(obj, filename=objtype+'.png')
|
| 50 |
+
except ImportError:
|
| 51 |
+
print ("Please install 'objgraph' to view object graphs")
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
# EOF
|
parrot/bin/hjson
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from hjson.tool import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/huggingface-cli
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from huggingface_hub.commands.huggingface_cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/idle3
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python3.10
|
| 2 |
+
|
| 3 |
+
from idlelib.pyshell import main
|
| 4 |
+
if __name__ == '__main__':
|
| 5 |
+
main()
|
parrot/bin/idle3.10
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python3.10
|
| 2 |
+
|
| 3 |
+
from idlelib.pyshell import main
|
| 4 |
+
if __name__ == '__main__':
|
| 5 |
+
main()
|
parrot/bin/imageio_download_bin
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from imageio.__main__ import download_bin_main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(download_bin_main())
|
parrot/bin/isympy
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from isympy import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/jsonschema
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from jsonschema.cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/latex2mathml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from latex2mathml.converter import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/lzegrep
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# xzgrep -- a wrapper around a grep program that decompresses files as needed
|
| 5 |
+
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
| 6 |
+
|
| 7 |
+
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
|
| 8 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 9 |
+
|
| 10 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 11 |
+
|
| 12 |
+
# This program is free software; you can redistribute it and/or modify
|
| 13 |
+
# it under the terms of the GNU General Public License as published by
|
| 14 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 15 |
+
# (at your option) any later version.
|
| 16 |
+
|
| 17 |
+
# This program is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 20 |
+
# GNU General Public License for more details.
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 24 |
+
|
| 25 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 26 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 27 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 28 |
+
# environment variables.
|
| 29 |
+
xz='xz --format=auto'
|
| 30 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 31 |
+
|
| 32 |
+
case ${0##*/} in
|
| 33 |
+
*egrep*) prog=xzegrep; grep=${GREP:-grep -E};;
|
| 34 |
+
*fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};;
|
| 35 |
+
*) prog=xzgrep; grep=${GREP:-grep};;
|
| 36 |
+
esac
|
| 37 |
+
|
| 38 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 39 |
+
|
| 40 |
+
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
| 41 |
+
Look for instances of PATTERN in the input FILEs, using their
|
| 42 |
+
uncompressed contents if they are compressed.
|
| 43 |
+
|
| 44 |
+
OPTIONs are the same as for '$grep'.
|
| 45 |
+
|
| 46 |
+
Report bugs to <xz@tukaani.org>."
|
| 47 |
+
|
| 48 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 49 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 50 |
+
escape='
|
| 51 |
+
s/'\''/'\''\\'\'''\''/g
|
| 52 |
+
$s/X$/'\''/
|
| 53 |
+
'
|
| 54 |
+
operands=
|
| 55 |
+
have_pat=0
|
| 56 |
+
files_with_matches=0
|
| 57 |
+
files_without_matches=0
|
| 58 |
+
no_filename=0
|
| 59 |
+
with_filename=0
|
| 60 |
+
|
| 61 |
+
# See if -H and --label options are supported (GNU and *BSDs).
|
| 62 |
+
if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then
|
| 63 |
+
grep_supports_label=1
|
| 64 |
+
else
|
| 65 |
+
grep_supports_label=0
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
while test $# -ne 0; do
|
| 69 |
+
option=$1
|
| 70 |
+
shift
|
| 71 |
+
optarg=
|
| 72 |
+
|
| 73 |
+
case $option in
|
| 74 |
+
(-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*)
|
| 75 |
+
# Something like -Fiv was specified, that is, $option contains more
|
| 76 |
+
# than one option of which the first option (in this example -F)
|
| 77 |
+
# doesn't take an argument. Split the first option into a standalone
|
| 78 |
+
# argument and continue parsing the rest of the options (in this example,
|
| 79 |
+
# replace -Fiv with -iv in the argument list and set option=-F).
|
| 80 |
+
#
|
| 81 |
+
# If there are digits [0-9] they are treated as if they were a single
|
| 82 |
+
# option character because this syntax is an alias for -C for GNU grep.
|
| 83 |
+
# For example, "grep -25F" is equivalent to "grep -C25 -F". If only
|
| 84 |
+
# digits are specified like "grep -25" we don't get here because the
|
| 85 |
+
# above pattern in the case-statement doesn't match such strings.
|
| 86 |
+
arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' |
|
| 87 |
+
LC_ALL=C sed "$escape")
|
| 88 |
+
eval "set -- $arg2 "'${1+"$@"}'
|
| 89 |
+
option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');;
|
| 90 |
+
(--binary-*=* | --[lm]a*=* | --reg*=*)
|
| 91 |
+
# These options require an argument and an argument has been provided
|
| 92 |
+
# with the --foo=argument syntax. All is good.
|
| 93 |
+
;;
|
| 94 |
+
(-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*)
|
| 95 |
+
# These options require an argument which should now be in $1.
|
| 96 |
+
# If it isn't, display an error and exit.
|
| 97 |
+
case ${1?"$option option requires an argument"} in
|
| 98 |
+
(*\'*)
|
| 99 |
+
optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 100 |
+
(*)
|
| 101 |
+
optarg=" '$1'";;
|
| 102 |
+
esac
|
| 103 |
+
shift;;
|
| 104 |
+
(--)
|
| 105 |
+
break;;
|
| 106 |
+
(-?*)
|
| 107 |
+
;;
|
| 108 |
+
(*)
|
| 109 |
+
case $option in
|
| 110 |
+
(*\'*)
|
| 111 |
+
operands="$operands '"$(printf '%sX\n' "$option" |
|
| 112 |
+
LC_ALL=C sed "$escape");;
|
| 113 |
+
(*)
|
| 114 |
+
operands="$operands '$option'";;
|
| 115 |
+
esac
|
| 116 |
+
${POSIXLY_CORRECT+break}
|
| 117 |
+
continue;;
|
| 118 |
+
esac
|
| 119 |
+
|
| 120 |
+
case $option in
|
| 121 |
+
(-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
|
| 122 |
+
printf >&2 '%s: %s: Option not supported\n' "$0" "$option"
|
| 123 |
+
exit 2;;
|
| 124 |
+
(-[ef]* | --file | --file=* | --reg*)
|
| 125 |
+
have_pat=1;;
|
| 126 |
+
(--h | --he | --hel | --help)
|
| 127 |
+
printf '%s\n' "$usage" || exit 2
|
| 128 |
+
exit;;
|
| 129 |
+
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
| 130 |
+
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
| 131 |
+
| --with-filename)
|
| 132 |
+
with_filename=1
|
| 133 |
+
continue;;
|
| 134 |
+
(-l | --files-with-*)
|
| 135 |
+
files_with_matches=1
|
| 136 |
+
continue;;
|
| 137 |
+
(-L | --files-witho*)
|
| 138 |
+
files_without_matches=1
|
| 139 |
+
continue;;
|
| 140 |
+
(-h | --no-f*)
|
| 141 |
+
no_filename=1;;
|
| 142 |
+
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
| 143 |
+
printf '%s\n' "$version" || exit 2
|
| 144 |
+
exit;;
|
| 145 |
+
esac
|
| 146 |
+
|
| 147 |
+
case $option in
|
| 148 |
+
(*\'?*)
|
| 149 |
+
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
|
| 150 |
+
(*)
|
| 151 |
+
option="'$option'";;
|
| 152 |
+
esac
|
| 153 |
+
|
| 154 |
+
grep="$grep $option$optarg"
|
| 155 |
+
done
|
| 156 |
+
|
| 157 |
+
eval "set -- $operands "'${1+"$@"}'
|
| 158 |
+
|
| 159 |
+
if test $have_pat -eq 0; then
|
| 160 |
+
case ${1?"Missing pattern; try '${0##*/} --help' for help"} in
|
| 161 |
+
(*\'*)
|
| 162 |
+
grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 163 |
+
(*)
|
| 164 |
+
grep="$grep -e '$1'";;
|
| 165 |
+
esac
|
| 166 |
+
shift
|
| 167 |
+
fi
|
| 168 |
+
|
| 169 |
+
if test $# -eq 0; then
|
| 170 |
+
set -- -
|
| 171 |
+
fi
|
| 172 |
+
|
| 173 |
+
exec 3>&1
|
| 174 |
+
|
| 175 |
+
# res=1 means that no file matched yet
|
| 176 |
+
res=1
|
| 177 |
+
|
| 178 |
+
for i; do
|
| 179 |
+
case $i in
|
| 180 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
|
| 181 |
+
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
|
| 182 |
+
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
|
| 183 |
+
*[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
|
| 184 |
+
*[-.]lz4) uncompress="lz4 -cdf";;
|
| 185 |
+
*) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
|
| 186 |
+
esac
|
| 187 |
+
# xz_status will hold the decompressor's exit status.
|
| 188 |
+
# Exit status of grep (and in rare cases, printf or sed) is
|
| 189 |
+
# available as the exit status of this assignment command.
|
| 190 |
+
xz_status=$(
|
| 191 |
+
exec 5>&1
|
| 192 |
+
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
| 193 |
+
if test $files_with_matches -eq 1; then
|
| 194 |
+
eval "$grep -q" && { printf '%s\n' "$i" || exit 2; }
|
| 195 |
+
elif test $files_without_matches -eq 1; then
|
| 196 |
+
eval "$grep -q" || {
|
| 197 |
+
r=$?
|
| 198 |
+
if test $r -eq 1; then
|
| 199 |
+
printf '%s\n' "$i" || r=2
|
| 200 |
+
fi
|
| 201 |
+
exit $r
|
| 202 |
+
}
|
| 203 |
+
elif test $with_filename -eq 0 &&
|
| 204 |
+
{ test $# -eq 1 || test $no_filename -eq 1; }; then
|
| 205 |
+
eval "$grep"
|
| 206 |
+
elif test $grep_supports_label -eq 1; then
|
| 207 |
+
# The grep implementation in use allows us to specify the filename
|
| 208 |
+
# that grep will prefix to the output lines. This is faster and
|
| 209 |
+
# less prone to security bugs than the fallback method that uses sed.
|
| 210 |
+
# This also avoids confusing output with GNU grep >= 3.5 (2020-09-27)
|
| 211 |
+
# which prints "binary file matches" to stderr instead of stdout.
|
| 212 |
+
#
|
| 213 |
+
# If reading from stdin, let grep use whatever name it prefers for
|
| 214 |
+
# stdin. With GNU grep it is a locale-specific translated string.
|
| 215 |
+
if test "x$i" = "x-"; then
|
| 216 |
+
eval "$grep -H"
|
| 217 |
+
else
|
| 218 |
+
eval "$grep -H --label \"\$i\""
|
| 219 |
+
fi
|
| 220 |
+
else
|
| 221 |
+
# Append a colon so that the last character will never be a newline
|
| 222 |
+
# which would otherwise get lost in shell command substitution.
|
| 223 |
+
i="$i:"
|
| 224 |
+
|
| 225 |
+
# Escape & \ | and newlines only if such characters are present
|
| 226 |
+
# (speed optimization).
|
| 227 |
+
case $i in
|
| 228 |
+
(*'
|
| 229 |
+
'* | *'&'* | *'\'* | *'|'*)
|
| 230 |
+
# If sed fails, set i to a known safe string to ensure that
|
| 231 |
+
# failing sed did not create a half-escaped dangerous string.
|
| 232 |
+
i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') ||
|
| 233 |
+
i='(unknown filename):';;
|
| 234 |
+
esac
|
| 235 |
+
|
| 236 |
+
# $i already ends with a colon so do not add it here.
|
| 237 |
+
sed_script="s|^|$i|"
|
| 238 |
+
|
| 239 |
+
# If grep or sed fails, pick the larger value of the two exit statuses.
|
| 240 |
+
# If sed fails, use at least 2 since we use >= 2 to indicate errors.
|
| 241 |
+
r=$(
|
| 242 |
+
exec 4>&1
|
| 243 |
+
(eval "$grep" 4>&-; echo $? >&4) 3>&- |
|
| 244 |
+
LC_ALL=C sed "$sed_script" >&3 4>&-
|
| 245 |
+
) || {
|
| 246 |
+
sed_status=$?
|
| 247 |
+
test "$sed_status" -lt 2 && sed_status=2
|
| 248 |
+
test "$r" -lt "$sed_status" && r=$sed_status
|
| 249 |
+
}
|
| 250 |
+
exit $r
|
| 251 |
+
fi >&3 5>&-
|
| 252 |
+
)
|
| 253 |
+
r=$?
|
| 254 |
+
|
| 255 |
+
# If grep or sed or other non-decompression command failed with a signal,
|
| 256 |
+
# exit immediately and ignore the possible remaining files.
|
| 257 |
+
#
|
| 258 |
+
# NOTE: Instead of 128 + signal_number, some shells use
|
| 259 |
+
# 256 + signal_number (ksh) or 384 + signal_number (yash).
|
| 260 |
+
# This is fine for us since their "exit" and "kill -l" commands take
|
| 261 |
+
# this into account. (At least the versions I tried do but there is
|
| 262 |
+
# a report of an old ksh variant whose "exit" truncates the exit status
|
| 263 |
+
# to 8 bits without any special handling for values indicating a signal.)
|
| 264 |
+
test "$r" -ge 128 && exit "$r"
|
| 265 |
+
|
| 266 |
+
if test -z "$xz_status"; then
|
| 267 |
+
# Something unusual happened, for example, we got a signal and
|
| 268 |
+
# the exit status of the decompressor was never echoed and thus
|
| 269 |
+
# $xz_status is empty. Exit immediately and ignore the possible
|
| 270 |
+
# remaining files.
|
| 271 |
+
exit 2
|
| 272 |
+
elif test "$xz_status" -ge 128; then
|
| 273 |
+
# The decompressor died due to a signal. SIGPIPE is ignored since it can
|
| 274 |
+
# occur if grep exits before the whole file has been decompressed (grep -q
|
| 275 |
+
# can do that). If the decompressor died with some other signal, exit
|
| 276 |
+
# immediately and ignore the possible remaining files.
|
| 277 |
+
test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status"
|
| 278 |
+
elif test "$xz_status" -gt 0; then
|
| 279 |
+
# Decompression failed but we will continue with the remaining
|
| 280 |
+
# files anyway. Set exit status to at least 2 to indicate an error.
|
| 281 |
+
test "$r" -lt 2 && r=2
|
| 282 |
+
fi
|
| 283 |
+
|
| 284 |
+
# Since res=1 is the initial value, we only need to care about
|
| 285 |
+
# matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored.
|
| 286 |
+
if test "$r" -ge 2; then
|
| 287 |
+
# An error occurred in decompressor, grep, or some other command. Update
|
| 288 |
+
# res unless a larger error code has been seen with an earlier file.
|
| 289 |
+
test "$res" -lt "$r" && res=$r
|
| 290 |
+
elif test "$r" -eq 0; then
|
| 291 |
+
# grep found a match and no errors occurred. Update res if no errors have
|
| 292 |
+
# occurred with earlier files.
|
| 293 |
+
test "$res" -eq 1 && res=0
|
| 294 |
+
fi
|
| 295 |
+
done
|
| 296 |
+
|
| 297 |
+
# 0: At least one file matched and no errors occurred.
|
| 298 |
+
# 1: No matches were found and no errors occurred.
|
| 299 |
+
# >=2: Error. It's unknown if matches were found.
|
| 300 |
+
exit "$res"
|
parrot/bin/lzfgrep
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# xzgrep -- a wrapper around a grep program that decompresses files as needed
|
| 5 |
+
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
| 6 |
+
|
| 7 |
+
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
|
| 8 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 9 |
+
|
| 10 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 11 |
+
|
| 12 |
+
# This program is free software; you can redistribute it and/or modify
|
| 13 |
+
# it under the terms of the GNU General Public License as published by
|
| 14 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 15 |
+
# (at your option) any later version.
|
| 16 |
+
|
| 17 |
+
# This program is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 20 |
+
# GNU General Public License for more details.
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 24 |
+
|
| 25 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 26 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 27 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 28 |
+
# environment variables.
|
| 29 |
+
xz='xz --format=auto'
|
| 30 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 31 |
+
|
| 32 |
+
case ${0##*/} in
|
| 33 |
+
*egrep*) prog=xzegrep; grep=${GREP:-grep -E};;
|
| 34 |
+
*fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};;
|
| 35 |
+
*) prog=xzgrep; grep=${GREP:-grep};;
|
| 36 |
+
esac
|
| 37 |
+
|
| 38 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 39 |
+
|
| 40 |
+
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
| 41 |
+
Look for instances of PATTERN in the input FILEs, using their
|
| 42 |
+
uncompressed contents if they are compressed.
|
| 43 |
+
|
| 44 |
+
OPTIONs are the same as for '$grep'.
|
| 45 |
+
|
| 46 |
+
Report bugs to <xz@tukaani.org>."
|
| 47 |
+
|
| 48 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 49 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 50 |
+
escape='
|
| 51 |
+
s/'\''/'\''\\'\'''\''/g
|
| 52 |
+
$s/X$/'\''/
|
| 53 |
+
'
|
| 54 |
+
operands=
|
| 55 |
+
have_pat=0
|
| 56 |
+
files_with_matches=0
|
| 57 |
+
files_without_matches=0
|
| 58 |
+
no_filename=0
|
| 59 |
+
with_filename=0
|
| 60 |
+
|
| 61 |
+
# See if -H and --label options are supported (GNU and *BSDs).
|
| 62 |
+
if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then
|
| 63 |
+
grep_supports_label=1
|
| 64 |
+
else
|
| 65 |
+
grep_supports_label=0
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
while test $# -ne 0; do
|
| 69 |
+
option=$1
|
| 70 |
+
shift
|
| 71 |
+
optarg=
|
| 72 |
+
|
| 73 |
+
case $option in
|
| 74 |
+
(-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*)
|
| 75 |
+
# Something like -Fiv was specified, that is, $option contains more
|
| 76 |
+
# than one option of which the first option (in this example -F)
|
| 77 |
+
# doesn't take an argument. Split the first option into a standalone
|
| 78 |
+
# argument and continue parsing the rest of the options (in this example,
|
| 79 |
+
# replace -Fiv with -iv in the argument list and set option=-F).
|
| 80 |
+
#
|
| 81 |
+
# If there are digits [0-9] they are treated as if they were a single
|
| 82 |
+
# option character because this syntax is an alias for -C for GNU grep.
|
| 83 |
+
# For example, "grep -25F" is equivalent to "grep -C25 -F". If only
|
| 84 |
+
# digits are specified like "grep -25" we don't get here because the
|
| 85 |
+
# above pattern in the case-statement doesn't match such strings.
|
| 86 |
+
arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' |
|
| 87 |
+
LC_ALL=C sed "$escape")
|
| 88 |
+
eval "set -- $arg2 "'${1+"$@"}'
|
| 89 |
+
option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');;
|
| 90 |
+
(--binary-*=* | --[lm]a*=* | --reg*=*)
|
| 91 |
+
# These options require an argument and an argument has been provided
|
| 92 |
+
# with the --foo=argument syntax. All is good.
|
| 93 |
+
;;
|
| 94 |
+
(-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*)
|
| 95 |
+
# These options require an argument which should now be in $1.
|
| 96 |
+
# If it isn't, display an error and exit.
|
| 97 |
+
case ${1?"$option option requires an argument"} in
|
| 98 |
+
(*\'*)
|
| 99 |
+
optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 100 |
+
(*)
|
| 101 |
+
optarg=" '$1'";;
|
| 102 |
+
esac
|
| 103 |
+
shift;;
|
| 104 |
+
(--)
|
| 105 |
+
break;;
|
| 106 |
+
(-?*)
|
| 107 |
+
;;
|
| 108 |
+
(*)
|
| 109 |
+
case $option in
|
| 110 |
+
(*\'*)
|
| 111 |
+
operands="$operands '"$(printf '%sX\n' "$option" |
|
| 112 |
+
LC_ALL=C sed "$escape");;
|
| 113 |
+
(*)
|
| 114 |
+
operands="$operands '$option'";;
|
| 115 |
+
esac
|
| 116 |
+
${POSIXLY_CORRECT+break}
|
| 117 |
+
continue;;
|
| 118 |
+
esac
|
| 119 |
+
|
| 120 |
+
case $option in
|
| 121 |
+
(-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
|
| 122 |
+
printf >&2 '%s: %s: Option not supported\n' "$0" "$option"
|
| 123 |
+
exit 2;;
|
| 124 |
+
(-[ef]* | --file | --file=* | --reg*)
|
| 125 |
+
have_pat=1;;
|
| 126 |
+
(--h | --he | --hel | --help)
|
| 127 |
+
printf '%s\n' "$usage" || exit 2
|
| 128 |
+
exit;;
|
| 129 |
+
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
| 130 |
+
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
| 131 |
+
| --with-filename)
|
| 132 |
+
with_filename=1
|
| 133 |
+
continue;;
|
| 134 |
+
(-l | --files-with-*)
|
| 135 |
+
files_with_matches=1
|
| 136 |
+
continue;;
|
| 137 |
+
(-L | --files-witho*)
|
| 138 |
+
files_without_matches=1
|
| 139 |
+
continue;;
|
| 140 |
+
(-h | --no-f*)
|
| 141 |
+
no_filename=1;;
|
| 142 |
+
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
| 143 |
+
printf '%s\n' "$version" || exit 2
|
| 144 |
+
exit;;
|
| 145 |
+
esac
|
| 146 |
+
|
| 147 |
+
case $option in
|
| 148 |
+
(*\'?*)
|
| 149 |
+
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
|
| 150 |
+
(*)
|
| 151 |
+
option="'$option'";;
|
| 152 |
+
esac
|
| 153 |
+
|
| 154 |
+
grep="$grep $option$optarg"
|
| 155 |
+
done
|
| 156 |
+
|
| 157 |
+
eval "set -- $operands "'${1+"$@"}'
|
| 158 |
+
|
| 159 |
+
if test $have_pat -eq 0; then
|
| 160 |
+
case ${1?"Missing pattern; try '${0##*/} --help' for help"} in
|
| 161 |
+
(*\'*)
|
| 162 |
+
grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 163 |
+
(*)
|
| 164 |
+
grep="$grep -e '$1'";;
|
| 165 |
+
esac
|
| 166 |
+
shift
|
| 167 |
+
fi
|
| 168 |
+
|
| 169 |
+
if test $# -eq 0; then
|
| 170 |
+
set -- -
|
| 171 |
+
fi
|
| 172 |
+
|
| 173 |
+
exec 3>&1
|
| 174 |
+
|
| 175 |
+
# res=1 means that no file matched yet
|
| 176 |
+
res=1
|
| 177 |
+
|
| 178 |
+
for i; do
|
| 179 |
+
case $i in
|
| 180 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
|
| 181 |
+
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
|
| 182 |
+
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
|
| 183 |
+
*[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
|
| 184 |
+
*[-.]lz4) uncompress="lz4 -cdf";;
|
| 185 |
+
*) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
|
| 186 |
+
esac
|
| 187 |
+
# xz_status will hold the decompressor's exit status.
|
| 188 |
+
# Exit status of grep (and in rare cases, printf or sed) is
|
| 189 |
+
# available as the exit status of this assignment command.
|
| 190 |
+
xz_status=$(
|
| 191 |
+
exec 5>&1
|
| 192 |
+
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
| 193 |
+
if test $files_with_matches -eq 1; then
|
| 194 |
+
eval "$grep -q" && { printf '%s\n' "$i" || exit 2; }
|
| 195 |
+
elif test $files_without_matches -eq 1; then
|
| 196 |
+
eval "$grep -q" || {
|
| 197 |
+
r=$?
|
| 198 |
+
if test $r -eq 1; then
|
| 199 |
+
printf '%s\n' "$i" || r=2
|
| 200 |
+
fi
|
| 201 |
+
exit $r
|
| 202 |
+
}
|
| 203 |
+
elif test $with_filename -eq 0 &&
|
| 204 |
+
{ test $# -eq 1 || test $no_filename -eq 1; }; then
|
| 205 |
+
eval "$grep"
|
| 206 |
+
elif test $grep_supports_label -eq 1; then
|
| 207 |
+
# The grep implementation in use allows us to specify the filename
|
| 208 |
+
# that grep will prefix to the output lines. This is faster and
|
| 209 |
+
# less prone to security bugs than the fallback method that uses sed.
|
| 210 |
+
# This also avoids confusing output with GNU grep >= 3.5 (2020-09-27)
|
| 211 |
+
# which prints "binary file matches" to stderr instead of stdout.
|
| 212 |
+
#
|
| 213 |
+
# If reading from stdin, let grep use whatever name it prefers for
|
| 214 |
+
# stdin. With GNU grep it is a locale-specific translated string.
|
| 215 |
+
if test "x$i" = "x-"; then
|
| 216 |
+
eval "$grep -H"
|
| 217 |
+
else
|
| 218 |
+
eval "$grep -H --label \"\$i\""
|
| 219 |
+
fi
|
| 220 |
+
else
|
| 221 |
+
# Append a colon so that the last character will never be a newline
|
| 222 |
+
# which would otherwise get lost in shell command substitution.
|
| 223 |
+
i="$i:"
|
| 224 |
+
|
| 225 |
+
# Escape & \ | and newlines only if such characters are present
|
| 226 |
+
# (speed optimization).
|
| 227 |
+
case $i in
|
| 228 |
+
(*'
|
| 229 |
+
'* | *'&'* | *'\'* | *'|'*)
|
| 230 |
+
# If sed fails, set i to a known safe string to ensure that
|
| 231 |
+
# failing sed did not create a half-escaped dangerous string.
|
| 232 |
+
i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') ||
|
| 233 |
+
i='(unknown filename):';;
|
| 234 |
+
esac
|
| 235 |
+
|
| 236 |
+
# $i already ends with a colon so do not add it here.
|
| 237 |
+
sed_script="s|^|$i|"
|
| 238 |
+
|
| 239 |
+
# If grep or sed fails, pick the larger value of the two exit statuses.
|
| 240 |
+
# If sed fails, use at least 2 since we use >= 2 to indicate errors.
|
| 241 |
+
r=$(
|
| 242 |
+
exec 4>&1
|
| 243 |
+
(eval "$grep" 4>&-; echo $? >&4) 3>&- |
|
| 244 |
+
LC_ALL=C sed "$sed_script" >&3 4>&-
|
| 245 |
+
) || {
|
| 246 |
+
sed_status=$?
|
| 247 |
+
test "$sed_status" -lt 2 && sed_status=2
|
| 248 |
+
test "$r" -lt "$sed_status" && r=$sed_status
|
| 249 |
+
}
|
| 250 |
+
exit $r
|
| 251 |
+
fi >&3 5>&-
|
| 252 |
+
)
|
| 253 |
+
r=$?
|
| 254 |
+
|
| 255 |
+
# If grep or sed or other non-decompression command failed with a signal,
|
| 256 |
+
# exit immediately and ignore the possible remaining files.
|
| 257 |
+
#
|
| 258 |
+
# NOTE: Instead of 128 + signal_number, some shells use
|
| 259 |
+
# 256 + signal_number (ksh) or 384 + signal_number (yash).
|
| 260 |
+
# This is fine for us since their "exit" and "kill -l" commands take
|
| 261 |
+
# this into account. (At least the versions I tried do but there is
|
| 262 |
+
# a report of an old ksh variant whose "exit" truncates the exit status
|
| 263 |
+
# to 8 bits without any special handling for values indicating a signal.)
|
| 264 |
+
test "$r" -ge 128 && exit "$r"
|
| 265 |
+
|
| 266 |
+
if test -z "$xz_status"; then
|
| 267 |
+
# Something unusual happened, for example, we got a signal and
|
| 268 |
+
# the exit status of the decompressor was never echoed and thus
|
| 269 |
+
# $xz_status is empty. Exit immediately and ignore the possible
|
| 270 |
+
# remaining files.
|
| 271 |
+
exit 2
|
| 272 |
+
elif test "$xz_status" -ge 128; then
|
| 273 |
+
# The decompressor died due to a signal. SIGPIPE is ignored since it can
|
| 274 |
+
# occur if grep exits before the whole file has been decompressed (grep -q
|
| 275 |
+
# can do that). If the decompressor died with some other signal, exit
|
| 276 |
+
# immediately and ignore the possible remaining files.
|
| 277 |
+
test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status"
|
| 278 |
+
elif test "$xz_status" -gt 0; then
|
| 279 |
+
# Decompression failed but we will continue with the remaining
|
| 280 |
+
# files anyway. Set exit status to at least 2 to indicate an error.
|
| 281 |
+
test "$r" -lt 2 && r=2
|
| 282 |
+
fi
|
| 283 |
+
|
| 284 |
+
# Since res=1 is the initial value, we only need to care about
|
| 285 |
+
# matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored.
|
| 286 |
+
if test "$r" -ge 2; then
|
| 287 |
+
# An error occurred in decompressor, grep, or some other command. Update
|
| 288 |
+
# res unless a larger error code has been seen with an earlier file.
|
| 289 |
+
test "$res" -lt "$r" && res=$r
|
| 290 |
+
elif test "$r" -eq 0; then
|
| 291 |
+
# grep found a match and no errors occurred. Update res if no errors have
|
| 292 |
+
# occurred with earlier files.
|
| 293 |
+
test "$res" -eq 1 && res=0
|
| 294 |
+
fi
|
| 295 |
+
done
|
| 296 |
+
|
| 297 |
+
# 0: At least one file matched and no errors occurred.
|
| 298 |
+
# 1: No matches were found and no errors occurred.
|
| 299 |
+
# >=2: Error. It's unknown if matches were found.
|
| 300 |
+
exit "$res"
|
parrot/bin/lzgrep
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# xzgrep -- a wrapper around a grep program that decompresses files as needed
|
| 5 |
+
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
| 6 |
+
|
| 7 |
+
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
|
| 8 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 9 |
+
|
| 10 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 11 |
+
|
| 12 |
+
# This program is free software; you can redistribute it and/or modify
|
| 13 |
+
# it under the terms of the GNU General Public License as published by
|
| 14 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 15 |
+
# (at your option) any later version.
|
| 16 |
+
|
| 17 |
+
# This program is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 20 |
+
# GNU General Public License for more details.
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 24 |
+
|
| 25 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 26 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 27 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 28 |
+
# environment variables.
|
| 29 |
+
xz='xz --format=auto'
|
| 30 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 31 |
+
|
| 32 |
+
case ${0##*/} in
|
| 33 |
+
*egrep*) prog=xzegrep; grep=${GREP:-grep -E};;
|
| 34 |
+
*fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};;
|
| 35 |
+
*) prog=xzgrep; grep=${GREP:-grep};;
|
| 36 |
+
esac
|
| 37 |
+
|
| 38 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 39 |
+
|
| 40 |
+
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
| 41 |
+
Look for instances of PATTERN in the input FILEs, using their
|
| 42 |
+
uncompressed contents if they are compressed.
|
| 43 |
+
|
| 44 |
+
OPTIONs are the same as for '$grep'.
|
| 45 |
+
|
| 46 |
+
Report bugs to <xz@tukaani.org>."
|
| 47 |
+
|
| 48 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 49 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 50 |
+
escape='
|
| 51 |
+
s/'\''/'\''\\'\'''\''/g
|
| 52 |
+
$s/X$/'\''/
|
| 53 |
+
'
|
| 54 |
+
operands=
|
| 55 |
+
have_pat=0
|
| 56 |
+
files_with_matches=0
|
| 57 |
+
files_without_matches=0
|
| 58 |
+
no_filename=0
|
| 59 |
+
with_filename=0
|
| 60 |
+
|
| 61 |
+
# See if -H and --label options are supported (GNU and *BSDs).
|
| 62 |
+
if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then
|
| 63 |
+
grep_supports_label=1
|
| 64 |
+
else
|
| 65 |
+
grep_supports_label=0
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
while test $# -ne 0; do
|
| 69 |
+
option=$1
|
| 70 |
+
shift
|
| 71 |
+
optarg=
|
| 72 |
+
|
| 73 |
+
case $option in
|
| 74 |
+
(-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*)
|
| 75 |
+
# Something like -Fiv was specified, that is, $option contains more
|
| 76 |
+
# than one option of which the first option (in this example -F)
|
| 77 |
+
# doesn't take an argument. Split the first option into a standalone
|
| 78 |
+
# argument and continue parsing the rest of the options (in this example,
|
| 79 |
+
# replace -Fiv with -iv in the argument list and set option=-F).
|
| 80 |
+
#
|
| 81 |
+
# If there are digits [0-9] they are treated as if they were a single
|
| 82 |
+
# option character because this syntax is an alias for -C for GNU grep.
|
| 83 |
+
# For example, "grep -25F" is equivalent to "grep -C25 -F". If only
|
| 84 |
+
# digits are specified like "grep -25" we don't get here because the
|
| 85 |
+
# above pattern in the case-statement doesn't match such strings.
|
| 86 |
+
arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' |
|
| 87 |
+
LC_ALL=C sed "$escape")
|
| 88 |
+
eval "set -- $arg2 "'${1+"$@"}'
|
| 89 |
+
option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');;
|
| 90 |
+
(--binary-*=* | --[lm]a*=* | --reg*=*)
|
| 91 |
+
# These options require an argument and an argument has been provided
|
| 92 |
+
# with the --foo=argument syntax. All is good.
|
| 93 |
+
;;
|
| 94 |
+
(-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*)
|
| 95 |
+
# These options require an argument which should now be in $1.
|
| 96 |
+
# If it isn't, display an error and exit.
|
| 97 |
+
case ${1?"$option option requires an argument"} in
|
| 98 |
+
(*\'*)
|
| 99 |
+
optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 100 |
+
(*)
|
| 101 |
+
optarg=" '$1'";;
|
| 102 |
+
esac
|
| 103 |
+
shift;;
|
| 104 |
+
(--)
|
| 105 |
+
break;;
|
| 106 |
+
(-?*)
|
| 107 |
+
;;
|
| 108 |
+
(*)
|
| 109 |
+
case $option in
|
| 110 |
+
(*\'*)
|
| 111 |
+
operands="$operands '"$(printf '%sX\n' "$option" |
|
| 112 |
+
LC_ALL=C sed "$escape");;
|
| 113 |
+
(*)
|
| 114 |
+
operands="$operands '$option'";;
|
| 115 |
+
esac
|
| 116 |
+
${POSIXLY_CORRECT+break}
|
| 117 |
+
continue;;
|
| 118 |
+
esac
|
| 119 |
+
|
| 120 |
+
case $option in
|
| 121 |
+
(-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
|
| 122 |
+
printf >&2 '%s: %s: Option not supported\n' "$0" "$option"
|
| 123 |
+
exit 2;;
|
| 124 |
+
(-[ef]* | --file | --file=* | --reg*)
|
| 125 |
+
have_pat=1;;
|
| 126 |
+
(--h | --he | --hel | --help)
|
| 127 |
+
printf '%s\n' "$usage" || exit 2
|
| 128 |
+
exit;;
|
| 129 |
+
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
| 130 |
+
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
| 131 |
+
| --with-filename)
|
| 132 |
+
with_filename=1
|
| 133 |
+
continue;;
|
| 134 |
+
(-l | --files-with-*)
|
| 135 |
+
files_with_matches=1
|
| 136 |
+
continue;;
|
| 137 |
+
(-L | --files-witho*)
|
| 138 |
+
files_without_matches=1
|
| 139 |
+
continue;;
|
| 140 |
+
(-h | --no-f*)
|
| 141 |
+
no_filename=1;;
|
| 142 |
+
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
| 143 |
+
printf '%s\n' "$version" || exit 2
|
| 144 |
+
exit;;
|
| 145 |
+
esac
|
| 146 |
+
|
| 147 |
+
case $option in
|
| 148 |
+
(*\'?*)
|
| 149 |
+
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
|
| 150 |
+
(*)
|
| 151 |
+
option="'$option'";;
|
| 152 |
+
esac
|
| 153 |
+
|
| 154 |
+
grep="$grep $option$optarg"
|
| 155 |
+
done
|
| 156 |
+
|
| 157 |
+
eval "set -- $operands "'${1+"$@"}'
|
| 158 |
+
|
| 159 |
+
if test $have_pat -eq 0; then
|
| 160 |
+
case ${1?"Missing pattern; try '${0##*/} --help' for help"} in
|
| 161 |
+
(*\'*)
|
| 162 |
+
grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 163 |
+
(*)
|
| 164 |
+
grep="$grep -e '$1'";;
|
| 165 |
+
esac
|
| 166 |
+
shift
|
| 167 |
+
fi
|
| 168 |
+
|
| 169 |
+
if test $# -eq 0; then
|
| 170 |
+
set -- -
|
| 171 |
+
fi
|
| 172 |
+
|
| 173 |
+
exec 3>&1
|
| 174 |
+
|
| 175 |
+
# res=1 means that no file matched yet
|
| 176 |
+
res=1
|
| 177 |
+
|
| 178 |
+
for i; do
|
| 179 |
+
case $i in
|
| 180 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
|
| 181 |
+
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
|
| 182 |
+
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
|
| 183 |
+
*[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
|
| 184 |
+
*[-.]lz4) uncompress="lz4 -cdf";;
|
| 185 |
+
*) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
|
| 186 |
+
esac
|
| 187 |
+
# xz_status will hold the decompressor's exit status.
|
| 188 |
+
# Exit status of grep (and in rare cases, printf or sed) is
|
| 189 |
+
# available as the exit status of this assignment command.
|
| 190 |
+
xz_status=$(
|
| 191 |
+
exec 5>&1
|
| 192 |
+
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
| 193 |
+
if test $files_with_matches -eq 1; then
|
| 194 |
+
eval "$grep -q" && { printf '%s\n' "$i" || exit 2; }
|
| 195 |
+
elif test $files_without_matches -eq 1; then
|
| 196 |
+
eval "$grep -q" || {
|
| 197 |
+
r=$?
|
| 198 |
+
if test $r -eq 1; then
|
| 199 |
+
printf '%s\n' "$i" || r=2
|
| 200 |
+
fi
|
| 201 |
+
exit $r
|
| 202 |
+
}
|
| 203 |
+
elif test $with_filename -eq 0 &&
|
| 204 |
+
{ test $# -eq 1 || test $no_filename -eq 1; }; then
|
| 205 |
+
eval "$grep"
|
| 206 |
+
elif test $grep_supports_label -eq 1; then
|
| 207 |
+
# The grep implementation in use allows us to specify the filename
|
| 208 |
+
# that grep will prefix to the output lines. This is faster and
|
| 209 |
+
# less prone to security bugs than the fallback method that uses sed.
|
| 210 |
+
# This also avoids confusing output with GNU grep >= 3.5 (2020-09-27)
|
| 211 |
+
# which prints "binary file matches" to stderr instead of stdout.
|
| 212 |
+
#
|
| 213 |
+
# If reading from stdin, let grep use whatever name it prefers for
|
| 214 |
+
# stdin. With GNU grep it is a locale-specific translated string.
|
| 215 |
+
if test "x$i" = "x-"; then
|
| 216 |
+
eval "$grep -H"
|
| 217 |
+
else
|
| 218 |
+
eval "$grep -H --label \"\$i\""
|
| 219 |
+
fi
|
| 220 |
+
else
|
| 221 |
+
# Append a colon so that the last character will never be a newline
|
| 222 |
+
# which would otherwise get lost in shell command substitution.
|
| 223 |
+
i="$i:"
|
| 224 |
+
|
| 225 |
+
# Escape & \ | and newlines only if such characters are present
|
| 226 |
+
# (speed optimization).
|
| 227 |
+
case $i in
|
| 228 |
+
(*'
|
| 229 |
+
'* | *'&'* | *'\'* | *'|'*)
|
| 230 |
+
# If sed fails, set i to a known safe string to ensure that
|
| 231 |
+
# failing sed did not create a half-escaped dangerous string.
|
| 232 |
+
i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') ||
|
| 233 |
+
i='(unknown filename):';;
|
| 234 |
+
esac
|
| 235 |
+
|
| 236 |
+
# $i already ends with a colon so do not add it here.
|
| 237 |
+
sed_script="s|^|$i|"
|
| 238 |
+
|
| 239 |
+
# If grep or sed fails, pick the larger value of the two exit statuses.
|
| 240 |
+
# If sed fails, use at least 2 since we use >= 2 to indicate errors.
|
| 241 |
+
r=$(
|
| 242 |
+
exec 4>&1
|
| 243 |
+
(eval "$grep" 4>&-; echo $? >&4) 3>&- |
|
| 244 |
+
LC_ALL=C sed "$sed_script" >&3 4>&-
|
| 245 |
+
) || {
|
| 246 |
+
sed_status=$?
|
| 247 |
+
test "$sed_status" -lt 2 && sed_status=2
|
| 248 |
+
test "$r" -lt "$sed_status" && r=$sed_status
|
| 249 |
+
}
|
| 250 |
+
exit $r
|
| 251 |
+
fi >&3 5>&-
|
| 252 |
+
)
|
| 253 |
+
r=$?
|
| 254 |
+
|
| 255 |
+
# If grep or sed or other non-decompression command failed with a signal,
|
| 256 |
+
# exit immediately and ignore the possible remaining files.
|
| 257 |
+
#
|
| 258 |
+
# NOTE: Instead of 128 + signal_number, some shells use
|
| 259 |
+
# 256 + signal_number (ksh) or 384 + signal_number (yash).
|
| 260 |
+
# This is fine for us since their "exit" and "kill -l" commands take
|
| 261 |
+
# this into account. (At least the versions I tried do but there is
|
| 262 |
+
# a report of an old ksh variant whose "exit" truncates the exit status
|
| 263 |
+
# to 8 bits without any special handling for values indicating a signal.)
|
| 264 |
+
test "$r" -ge 128 && exit "$r"
|
| 265 |
+
|
| 266 |
+
if test -z "$xz_status"; then
|
| 267 |
+
# Something unusual happened, for example, we got a signal and
|
| 268 |
+
# the exit status of the decompressor was never echoed and thus
|
| 269 |
+
# $xz_status is empty. Exit immediately and ignore the possible
|
| 270 |
+
# remaining files.
|
| 271 |
+
exit 2
|
| 272 |
+
elif test "$xz_status" -ge 128; then
|
| 273 |
+
# The decompressor died due to a signal. SIGPIPE is ignored since it can
|
| 274 |
+
# occur if grep exits before the whole file has been decompressed (grep -q
|
| 275 |
+
# can do that). If the decompressor died with some other signal, exit
|
| 276 |
+
# immediately and ignore the possible remaining files.
|
| 277 |
+
test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status"
|
| 278 |
+
elif test "$xz_status" -gt 0; then
|
| 279 |
+
# Decompression failed but we will continue with the remaining
|
| 280 |
+
# files anyway. Set exit status to at least 2 to indicate an error.
|
| 281 |
+
test "$r" -lt 2 && r=2
|
| 282 |
+
fi
|
| 283 |
+
|
| 284 |
+
# Since res=1 is the initial value, we only need to care about
|
| 285 |
+
# matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored.
|
| 286 |
+
if test "$r" -ge 2; then
|
| 287 |
+
# An error occurred in decompressor, grep, or some other command. Update
|
| 288 |
+
# res unless a larger error code has been seen with an earlier file.
|
| 289 |
+
test "$res" -lt "$r" && res=$r
|
| 290 |
+
elif test "$r" -eq 0; then
|
| 291 |
+
# grep found a match and no errors occurred. Update res if no errors have
|
| 292 |
+
# occurred with earlier files.
|
| 293 |
+
test "$res" -eq 1 && res=0
|
| 294 |
+
fi
|
| 295 |
+
done
|
| 296 |
+
|
| 297 |
+
# 0: At least one file matched and no errors occurred.
|
| 298 |
+
# 1: No matches were found and no errors occurred.
|
| 299 |
+
# >=2: Error. It's unknown if matches were found.
|
| 300 |
+
exit "$res"
|
parrot/bin/lzless
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
|
| 5 |
+
|
| 6 |
+
# The original version for gzip was written by Paul Eggert.
|
| 7 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 8 |
+
|
| 9 |
+
# This program is free software; you can redistribute it and/or modify
|
| 10 |
+
# it under the terms of the GNU General Public License as published by
|
| 11 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 12 |
+
# (at your option) any later version.
|
| 13 |
+
|
| 14 |
+
# This program is distributed in the hope that it will be useful,
|
| 15 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 |
+
# GNU General Public License for more details.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 21 |
+
|
| 22 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 23 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 24 |
+
# specified via XZ_OPT.
|
| 25 |
+
xz='xz --format=auto'
|
| 26 |
+
|
| 27 |
+
version='xzless (XZ Utils) 5.6.4'
|
| 28 |
+
|
| 29 |
+
usage="Usage: ${0##*/} [OPTION]... [FILE]...
|
| 30 |
+
Like 'less', but operate on the uncompressed contents of xz compressed FILEs.
|
| 31 |
+
|
| 32 |
+
Options are the same as for 'less'.
|
| 33 |
+
|
| 34 |
+
Report bugs to <xz@tukaani.org>."
|
| 35 |
+
|
| 36 |
+
case $1 in
|
| 37 |
+
--help) printf '%s\n' "$usage" || exit 2; exit;;
|
| 38 |
+
--version) printf '%s\n' "$version" || exit 2; exit;;
|
| 39 |
+
esac
|
| 40 |
+
|
| 41 |
+
if test "${LESSMETACHARS+set}" != set; then
|
| 42 |
+
# Work around a bug in less 394 and earlier;
|
| 43 |
+
# it mishandles the metacharacters '$%=~'.
|
| 44 |
+
space=' '
|
| 45 |
+
tab=' '
|
| 46 |
+
nl='
|
| 47 |
+
'
|
| 48 |
+
LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~'
|
| 49 |
+
fi
|
| 50 |
+
|
| 51 |
+
VER=$(less -V | { read _ ver _ && echo ${ver%%.*}; })
|
| 52 |
+
if test "$VER" -ge 451; then
|
| 53 |
+
# less 451 or later: If the compressed file is valid but has
|
| 54 |
+
# zero bytes of uncompressed data, using two vertical bars ||- makes
|
| 55 |
+
# "less" check the exit status of xz and if it is zero then display
|
| 56 |
+
# an empty file. With a single vertical bar |- and no output from xz,
|
| 57 |
+
# "less" would attempt to display the raw input file instead.
|
| 58 |
+
LESSOPEN="||-$xz -cdfqQ -- %s"
|
| 59 |
+
elif test "$VER" -ge 429; then
|
| 60 |
+
# less 429 or later: LESSOPEN pipe will be used on
|
| 61 |
+
# standard input if $LESSOPEN begins with |-.
|
| 62 |
+
LESSOPEN="|-$xz -cdfqQ -- %s"
|
| 63 |
+
else
|
| 64 |
+
LESSOPEN="|$xz -cdfqQ -- %s"
|
| 65 |
+
fi
|
| 66 |
+
|
| 67 |
+
SHOW_PREPROC_ERRORS=
|
| 68 |
+
if test "$VER" -ge 632; then
|
| 69 |
+
SHOW_PREPROC_ERRORS=--show-preproc-errors
|
| 70 |
+
fi
|
| 71 |
+
|
| 72 |
+
export LESSMETACHARS LESSOPEN
|
| 73 |
+
|
| 74 |
+
exec less $SHOW_PREPROC_ERRORS "$@"
|
parrot/bin/markdown-it
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from markdown_it.cli.parse import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/mistral-demo
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from mistral_inference.main import mistral_demo
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(mistral_demo())
|
parrot/bin/ninja
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from ninja import ninja
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(ninja())
|
parrot/bin/numpy-config
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from numpy._configtool import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/pip3
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pip._internal.cli.main import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/proton
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from triton.profiler.proton import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/pydoc
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python3.10
|
| 2 |
+
|
| 3 |
+
import pydoc
|
| 4 |
+
if __name__ == '__main__':
|
| 5 |
+
pydoc.cli()
|
parrot/bin/pydoc3
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python3.10
|
| 2 |
+
|
| 3 |
+
import pydoc
|
| 4 |
+
if __name__ == '__main__':
|
| 5 |
+
pydoc.cli()
|
parrot/bin/pyftmerge
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from fontTools.merge import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/pyftsubset
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from fontTools.subset import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/pygrun
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
__author__ = 'jszheng'
|
| 3 |
+
import optparse
|
| 4 |
+
import sys
|
| 5 |
+
import os
|
| 6 |
+
import importlib
|
| 7 |
+
from antlr4 import *
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# this is a python version of TestRig
|
| 11 |
+
def beautify_lisp_string(in_string):
|
| 12 |
+
indent_size = 3
|
| 13 |
+
add_indent = ' '*indent_size
|
| 14 |
+
out_string = in_string[0] # no indent for 1st (
|
| 15 |
+
indent = ''
|
| 16 |
+
for i in range(1, len(in_string)):
|
| 17 |
+
if in_string[i] == '(' and in_string[i+1] != ' ':
|
| 18 |
+
indent += add_indent
|
| 19 |
+
out_string += "\n" + indent + '('
|
| 20 |
+
elif in_string[i] == ')':
|
| 21 |
+
out_string += ')'
|
| 22 |
+
if len(indent) > 0:
|
| 23 |
+
indent = indent.replace(add_indent, '', 1)
|
| 24 |
+
else:
|
| 25 |
+
out_string += in_string[i]
|
| 26 |
+
return out_string
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
if __name__ == '__main__':
|
| 30 |
+
|
| 31 |
+
#############################################################
|
| 32 |
+
# parse options
|
| 33 |
+
# not support -gui -encoding -ps
|
| 34 |
+
#############################################################
|
| 35 |
+
usage = "Usage: %prog [options] Grammar_Name Start_Rule"
|
| 36 |
+
parser = optparse.OptionParser(usage=usage)
|
| 37 |
+
# parser.add_option('-t', '--tree',
|
| 38 |
+
# dest="out_file",
|
| 39 |
+
# default="default.out",
|
| 40 |
+
# help='set output file name',
|
| 41 |
+
# )
|
| 42 |
+
parser.add_option('-t', '--tree',
|
| 43 |
+
default=False,
|
| 44 |
+
action='store_true',
|
| 45 |
+
help='Print AST tree'
|
| 46 |
+
)
|
| 47 |
+
parser.add_option('-k', '--tokens',
|
| 48 |
+
dest="token",
|
| 49 |
+
default=False,
|
| 50 |
+
action='store_true',
|
| 51 |
+
help='Show Tokens'
|
| 52 |
+
)
|
| 53 |
+
parser.add_option('-s', '--sll',
|
| 54 |
+
dest="sll",
|
| 55 |
+
default=False,
|
| 56 |
+
action='store_true',
|
| 57 |
+
help='Show SLL'
|
| 58 |
+
)
|
| 59 |
+
parser.add_option('-d', '--diagnostics',
|
| 60 |
+
dest="diagnostics",
|
| 61 |
+
default=False,
|
| 62 |
+
action='store_true',
|
| 63 |
+
help='Enable diagnostics error listener'
|
| 64 |
+
)
|
| 65 |
+
parser.add_option('-a', '--trace',
|
| 66 |
+
dest="trace",
|
| 67 |
+
default=False,
|
| 68 |
+
action='store_true',
|
| 69 |
+
help='Enable Trace'
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
options, remainder = parser.parse_args()
|
| 73 |
+
if len(remainder) < 2:
|
| 74 |
+
print('ERROR: You have to provide at least 2 arguments!')
|
| 75 |
+
parser.print_help()
|
| 76 |
+
exit(1)
|
| 77 |
+
else:
|
| 78 |
+
grammar = remainder.pop(0)
|
| 79 |
+
start_rule = remainder.pop(0)
|
| 80 |
+
file_list = remainder
|
| 81 |
+
|
| 82 |
+
#############################################################
|
| 83 |
+
# check and load antlr generated files
|
| 84 |
+
#############################################################
|
| 85 |
+
# dynamic load the module and class
|
| 86 |
+
lexerName = grammar + 'Lexer'
|
| 87 |
+
parserName = grammar + 'Parser'
|
| 88 |
+
# check if the generate file exist
|
| 89 |
+
lexer_file = lexerName + '.py'
|
| 90 |
+
parser_file = parserName + '.py'
|
| 91 |
+
if not os.path.exists(lexer_file):
|
| 92 |
+
print("[ERROR] Can't find lexer file {}!".format(lexer_file))
|
| 93 |
+
print(os.path.realpath('.'))
|
| 94 |
+
exit(1)
|
| 95 |
+
if not os.path.exists(parser_file):
|
| 96 |
+
print("[ERROR] Can't find parser file {}!".format(lexer_file))
|
| 97 |
+
print(os.path.realpath('.'))
|
| 98 |
+
exit(1)
|
| 99 |
+
|
| 100 |
+
# current directory is where the generated file loaded
|
| 101 |
+
# the script might be in different place.
|
| 102 |
+
sys.path.append('.')
|
| 103 |
+
# print(sys.path)
|
| 104 |
+
|
| 105 |
+
# print("Load Lexer {}".format(lexerName))
|
| 106 |
+
module_lexer = __import__(lexerName, globals(), locals(), lexerName)
|
| 107 |
+
class_lexer = getattr(module_lexer, lexerName)
|
| 108 |
+
# print(class_lexer)
|
| 109 |
+
|
| 110 |
+
# print("Load Parser {}".format(parserName))
|
| 111 |
+
module_parser = __import__(parserName, globals(), locals(), parserName)
|
| 112 |
+
class_parser = getattr(module_parser, parserName)
|
| 113 |
+
# print(class_parser)
|
| 114 |
+
|
| 115 |
+
#############################################################
|
| 116 |
+
# main process steps.
|
| 117 |
+
#############################################################
|
| 118 |
+
def process(input_stream, class_lexer, class_parser):
|
| 119 |
+
lexer = class_lexer(input_stream)
|
| 120 |
+
token_stream = CommonTokenStream(lexer)
|
| 121 |
+
token_stream.fill()
|
| 122 |
+
if options.token: # need to show token
|
| 123 |
+
for tok in token_stream.tokens:
|
| 124 |
+
print(tok)
|
| 125 |
+
if start_rule == 'tokens':
|
| 126 |
+
return
|
| 127 |
+
|
| 128 |
+
parser = class_parser(token_stream)
|
| 129 |
+
|
| 130 |
+
if options.diagnostics:
|
| 131 |
+
parser.addErrorListener(DiagnosticErrorListener())
|
| 132 |
+
parser._interp.predictionMode = PredictionMode.LL_EXACT_AMBIG_DETECTION
|
| 133 |
+
if options.tree:
|
| 134 |
+
parser.buildParseTrees = True
|
| 135 |
+
if options.sll:
|
| 136 |
+
parser._interp.predictionMode = PredictionMode.SLL
|
| 137 |
+
#parser.setTokenStream(token_stream)
|
| 138 |
+
parser.setTrace(options.trace)
|
| 139 |
+
if hasattr(parser, start_rule):
|
| 140 |
+
func_start_rule = getattr(parser, start_rule)
|
| 141 |
+
parser_ret = func_start_rule()
|
| 142 |
+
if options.tree:
|
| 143 |
+
lisp_tree_str = parser_ret.toStringTree(recog=parser)
|
| 144 |
+
print(beautify_lisp_string(lisp_tree_str))
|
| 145 |
+
else:
|
| 146 |
+
print("[ERROR] Can't find start rule '{}' in parser '{}'".format(start_rule, parserName))
|
| 147 |
+
|
| 148 |
+
#############################################################
|
| 149 |
+
# use stdin if not provide file as input stream
|
| 150 |
+
#############################################################
|
| 151 |
+
if len(file_list) == 0:
|
| 152 |
+
input_stream = InputStream(sys.stdin.read())
|
| 153 |
+
process(input_stream, class_lexer, class_parser)
|
| 154 |
+
exit(0)
|
| 155 |
+
|
| 156 |
+
#############################################################
|
| 157 |
+
# iterate all input file
|
| 158 |
+
#############################################################
|
| 159 |
+
for file_name in file_list:
|
| 160 |
+
if os.path.exists(file_name) and os.path.isfile(file_name):
|
| 161 |
+
input_stream = FileStream(file_name)
|
| 162 |
+
process(input_stream, class_lexer, class_parser)
|
| 163 |
+
else:
|
| 164 |
+
print("[ERROR] file {} not exist".format(os.path.normpath(file_name)))
|
parrot/bin/python3-config
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# Keep this script in sync with python-config.in
|
| 4 |
+
|
| 5 |
+
exit_with_usage ()
|
| 6 |
+
{
|
| 7 |
+
echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed"
|
| 8 |
+
exit $1
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
if [ "$1" = "" ] ; then
|
| 12 |
+
exit_with_usage 1
|
| 13 |
+
fi
|
| 14 |
+
|
| 15 |
+
# Returns the actual prefix where this script was installed to.
|
| 16 |
+
installed_prefix ()
|
| 17 |
+
{
|
| 18 |
+
RESULT=$(dirname $(cd $(dirname "$1") && pwd -P))
|
| 19 |
+
if which readlink >/dev/null 2>&1 ; then
|
| 20 |
+
if readlink -f "$RESULT" >/dev/null 2>&1; then
|
| 21 |
+
RESULT=$(readlink -f "$RESULT")
|
| 22 |
+
fi
|
| 23 |
+
fi
|
| 24 |
+
echo $RESULT
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
prefix_real=$(installed_prefix "$0")
|
| 28 |
+
|
| 29 |
+
# Use sed to fix paths from their built-to locations to their installed-to
|
| 30 |
+
# locations. Keep prefix & exec_prefix using their original values in case
|
| 31 |
+
# they are referenced in other configure variables, to prevent double
|
| 32 |
+
# substitution, issue #22140.
|
| 33 |
+
prefix="/root/envs/parrot"
|
| 34 |
+
exec_prefix="${prefix}"
|
| 35 |
+
exec_prefix_real=${prefix_real}
|
| 36 |
+
includedir=$(echo "${prefix}/include" | sed "s#$prefix#$prefix_real#")
|
| 37 |
+
libdir=$(echo "${exec_prefix}/lib" | sed "s#$prefix#$prefix_real#")
|
| 38 |
+
CFLAGS=$(echo "-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -ffunction-sections -pipe -isystem /root/envs/parrot/include -fdebug-prefix-map=/croot/python-split_1733933809325/work=/usr/local/src/conda/python-3.10.16 -fdebug-prefix-map=/root/envs/parrot=/usr/local/src/conda-prefix -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -flto" | sed "s#$prefix#$prefix_real#")
|
| 39 |
+
VERSION="3.10"
|
| 40 |
+
LIBM="-lm"
|
| 41 |
+
LIBC=""
|
| 42 |
+
SYSLIBS="$LIBM $LIBC"
|
| 43 |
+
ABIFLAGS=""
|
| 44 |
+
LIBS=" -lcrypt -lpthread -ldl -lutil -lm $SYSLIBS"
|
| 45 |
+
LIBS_EMBED="-lpython${VERSION}${ABIFLAGS} -lcrypt -lpthread -ldl -lutil -lm $SYSLIBS"
|
| 46 |
+
BASECFLAGS=" -Wno-unused-result -Wsign-compare"
|
| 47 |
+
LDLIBRARY="libpython${VERSION}${ABIFLAGS}.a"
|
| 48 |
+
OPT="-DNDEBUG -fwrapv -O3 -Wall"
|
| 49 |
+
PY_ENABLE_SHARED="0"
|
| 50 |
+
LDVERSION="${VERSION}${ABIFLAGS}"
|
| 51 |
+
LIBDEST=${prefix_real}/lib/python${VERSION}
|
| 52 |
+
LIBPL=$(echo "${prefix}/lib/python3.10/config-${VERSION}${ABIFLAGS}-x86_64-linux-gnu" | sed "s#$prefix#$prefix_real#")
|
| 53 |
+
SO=".cpython-310-x86_64-linux-gnu.so"
|
| 54 |
+
PYTHONFRAMEWORK=""
|
| 55 |
+
INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
|
| 56 |
+
PLATINCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
|
| 57 |
+
PY_EMBED=0
|
| 58 |
+
|
| 59 |
+
# Scan for --help or unknown argument.
|
| 60 |
+
for ARG in $*
|
| 61 |
+
do
|
| 62 |
+
case $ARG in
|
| 63 |
+
--help)
|
| 64 |
+
exit_with_usage 0
|
| 65 |
+
;;
|
| 66 |
+
--embed)
|
| 67 |
+
PY_EMBED=1
|
| 68 |
+
;;
|
| 69 |
+
--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--configdir)
|
| 70 |
+
;;
|
| 71 |
+
*)
|
| 72 |
+
exit_with_usage 1
|
| 73 |
+
;;
|
| 74 |
+
esac
|
| 75 |
+
done
|
| 76 |
+
|
| 77 |
+
if [ $PY_EMBED = 1 ] ; then
|
| 78 |
+
LIBS="$LIBS_EMBED"
|
| 79 |
+
fi
|
| 80 |
+
|
| 81 |
+
for ARG in "$@"
|
| 82 |
+
do
|
| 83 |
+
case "$ARG" in
|
| 84 |
+
--prefix)
|
| 85 |
+
echo "$prefix_real"
|
| 86 |
+
;;
|
| 87 |
+
--exec-prefix)
|
| 88 |
+
echo "$exec_prefix_real"
|
| 89 |
+
;;
|
| 90 |
+
--includes)
|
| 91 |
+
echo "$INCDIR $PLATINCDIR"
|
| 92 |
+
;;
|
| 93 |
+
--cflags)
|
| 94 |
+
echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT"
|
| 95 |
+
;;
|
| 96 |
+
--libs)
|
| 97 |
+
echo "$LIBS"
|
| 98 |
+
;;
|
| 99 |
+
--ldflags)
|
| 100 |
+
LIBPLUSED=
|
| 101 |
+
if [ "$PY_ENABLE_SHARED" = "0" ] ; then
|
| 102 |
+
LIBPLUSED="-L$LIBPL"
|
| 103 |
+
fi
|
| 104 |
+
echo "$LIBPLUSED -L$libdir $LIBS"
|
| 105 |
+
;;
|
| 106 |
+
--extension-suffix)
|
| 107 |
+
echo "$SO"
|
| 108 |
+
;;
|
| 109 |
+
--abiflags)
|
| 110 |
+
echo "$ABIFLAGS"
|
| 111 |
+
;;
|
| 112 |
+
--configdir)
|
| 113 |
+
echo "$LIBPL"
|
| 114 |
+
;;
|
| 115 |
+
esac
|
| 116 |
+
done
|
parrot/bin/python3.10-config
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# Keep this script in sync with python-config.in
|
| 4 |
+
|
| 5 |
+
exit_with_usage ()
|
| 6 |
+
{
|
| 7 |
+
echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed"
|
| 8 |
+
exit $1
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
if [ "$1" = "" ] ; then
|
| 12 |
+
exit_with_usage 1
|
| 13 |
+
fi
|
| 14 |
+
|
| 15 |
+
# Returns the actual prefix where this script was installed to.
|
| 16 |
+
installed_prefix ()
|
| 17 |
+
{
|
| 18 |
+
RESULT=$(dirname $(cd $(dirname "$1") && pwd -P))
|
| 19 |
+
if which readlink >/dev/null 2>&1 ; then
|
| 20 |
+
if readlink -f "$RESULT" >/dev/null 2>&1; then
|
| 21 |
+
RESULT=$(readlink -f "$RESULT")
|
| 22 |
+
fi
|
| 23 |
+
fi
|
| 24 |
+
echo $RESULT
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
prefix_real=$(installed_prefix "$0")
|
| 28 |
+
|
| 29 |
+
# Use sed to fix paths from their built-to locations to their installed-to
|
| 30 |
+
# locations. Keep prefix & exec_prefix using their original values in case
|
| 31 |
+
# they are referenced in other configure variables, to prevent double
|
| 32 |
+
# substitution, issue #22140.
|
| 33 |
+
prefix="/root/envs/parrot"
|
| 34 |
+
exec_prefix="${prefix}"
|
| 35 |
+
exec_prefix_real=${prefix_real}
|
| 36 |
+
includedir=$(echo "${prefix}/include" | sed "s#$prefix#$prefix_real#")
|
| 37 |
+
libdir=$(echo "${exec_prefix}/lib" | sed "s#$prefix#$prefix_real#")
|
| 38 |
+
CFLAGS=$(echo "-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -ffunction-sections -pipe -isystem /root/envs/parrot/include -fdebug-prefix-map=/croot/python-split_1733933809325/work=/usr/local/src/conda/python-3.10.16 -fdebug-prefix-map=/root/envs/parrot=/usr/local/src/conda-prefix -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -flto" | sed "s#$prefix#$prefix_real#")
|
| 39 |
+
VERSION="3.10"
|
| 40 |
+
LIBM="-lm"
|
| 41 |
+
LIBC=""
|
| 42 |
+
SYSLIBS="$LIBM $LIBC"
|
| 43 |
+
ABIFLAGS=""
|
| 44 |
+
LIBS=" -lcrypt -lpthread -ldl -lutil -lm $SYSLIBS"
|
| 45 |
+
LIBS_EMBED="-lpython${VERSION}${ABIFLAGS} -lcrypt -lpthread -ldl -lutil -lm $SYSLIBS"
|
| 46 |
+
BASECFLAGS=" -Wno-unused-result -Wsign-compare"
|
| 47 |
+
LDLIBRARY="libpython${VERSION}${ABIFLAGS}.a"
|
| 48 |
+
OPT="-DNDEBUG -fwrapv -O3 -Wall"
|
| 49 |
+
PY_ENABLE_SHARED="0"
|
| 50 |
+
LDVERSION="${VERSION}${ABIFLAGS}"
|
| 51 |
+
LIBDEST=${prefix_real}/lib/python${VERSION}
|
| 52 |
+
LIBPL=$(echo "${prefix}/lib/python3.10/config-${VERSION}${ABIFLAGS}-x86_64-linux-gnu" | sed "s#$prefix#$prefix_real#")
|
| 53 |
+
SO=".cpython-310-x86_64-linux-gnu.so"
|
| 54 |
+
PYTHONFRAMEWORK=""
|
| 55 |
+
INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
|
| 56 |
+
PLATINCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
|
| 57 |
+
PY_EMBED=0
|
| 58 |
+
|
| 59 |
+
# Scan for --help or unknown argument.
|
| 60 |
+
for ARG in $*
|
| 61 |
+
do
|
| 62 |
+
case $ARG in
|
| 63 |
+
--help)
|
| 64 |
+
exit_with_usage 0
|
| 65 |
+
;;
|
| 66 |
+
--embed)
|
| 67 |
+
PY_EMBED=1
|
| 68 |
+
;;
|
| 69 |
+
--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--configdir)
|
| 70 |
+
;;
|
| 71 |
+
*)
|
| 72 |
+
exit_with_usage 1
|
| 73 |
+
;;
|
| 74 |
+
esac
|
| 75 |
+
done
|
| 76 |
+
|
| 77 |
+
if [ $PY_EMBED = 1 ] ; then
|
| 78 |
+
LIBS="$LIBS_EMBED"
|
| 79 |
+
fi
|
| 80 |
+
|
| 81 |
+
for ARG in "$@"
|
| 82 |
+
do
|
| 83 |
+
case "$ARG" in
|
| 84 |
+
--prefix)
|
| 85 |
+
echo "$prefix_real"
|
| 86 |
+
;;
|
| 87 |
+
--exec-prefix)
|
| 88 |
+
echo "$exec_prefix_real"
|
| 89 |
+
;;
|
| 90 |
+
--includes)
|
| 91 |
+
echo "$INCDIR $PLATINCDIR"
|
| 92 |
+
;;
|
| 93 |
+
--cflags)
|
| 94 |
+
echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT"
|
| 95 |
+
;;
|
| 96 |
+
--libs)
|
| 97 |
+
echo "$LIBS"
|
| 98 |
+
;;
|
| 99 |
+
--ldflags)
|
| 100 |
+
LIBPLUSED=
|
| 101 |
+
if [ "$PY_ENABLE_SHARED" = "0" ] ; then
|
| 102 |
+
LIBPLUSED="-L$LIBPL"
|
| 103 |
+
fi
|
| 104 |
+
echo "$LIBPLUSED -L$libdir $LIBS"
|
| 105 |
+
;;
|
| 106 |
+
--extension-suffix)
|
| 107 |
+
echo "$SO"
|
| 108 |
+
;;
|
| 109 |
+
--abiflags)
|
| 110 |
+
echo "$ABIFLAGS"
|
| 111 |
+
;;
|
| 112 |
+
--configdir)
|
| 113 |
+
echo "$LIBPL"
|
| 114 |
+
;;
|
| 115 |
+
esac
|
| 116 |
+
done
|
parrot/bin/reset
ADDED
|
Binary file (30.7 kB). View file
|
|
|
parrot/bin/shortuuid
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from shortuuid.cli import cli
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(cli())
|