#!/bin/sh# Modern Linux and macOS systems commonly only have a thing called `python3` and# not `python`, while Windows commonly does not have `python3`, so we cannot# directly use python in the x.py shebang and have it consistently work. Instead we# have a shell script to look for a python to run x.py.set -eu# syntax checksh -n "0ドル"realpath() {local path="1ドル"if [ -L "$path" ]; thenreadlink -f "$path"elif [ -d "$path" ]; then(cd -P "$path" && pwd)elseecho "$(realpath "$(dirname "$path")")/$(basename "$path")"fi}xpy=$(dirname "$(realpath "0ドル")")/x.py# On Windows, `py -3` sometimes works. We need to try it first because `python3`# sometimes tries to launch the app store on Windows.for SEARCH_PYTHON in py python3 python python2; doif python=$(command -v $SEARCH_PYTHON) && [ -x "$python" ]; thenif [ $SEARCH_PYTHON = py ]; thenextra_arg="-3"elseextra_arg=""fiexec "$python" $extra_arg "$xpy" "$@"fidonepython=$(bash -c "compgen -c python" | grep '^python[2-3]\.[0-9]\+$' | head -n1)if ! [ "$python" = "" ]; thenexec "$python" "$xpy" "$@"fiecho "0ドル: error: did not find python installed" >&2exit 1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。