1#!/bin/sh 2 3# Locate an acceptable Python interpreter and then re-execute the script. 4# Note that the mix of single and double quotes is intentional, 5# as is the fact that the ] goes on a new line. 6_=[ 'exec' '/bin/sh' '-c' ''' 7command -v python3.11 >/dev/null && exec python3.11 "$0" "$@" 8command -v python3.10 >/dev/null && exec python3.10 "$0" "$@" 9command -v python3.9 >/dev/null && exec python3.9 "$0" "$@" 10command -v python3.8 >/dev/null && exec python3.8 "$0" "$@" 11command -v python3.7 >/dev/null && exec python3.7 "$0" "$@" 12command -v python3.6 >/dev/null && exec python3.6 "$0" "$@" 13command -v python3 >/dev/null && exec python3 "$0" "$@" 14exec python "$0" "$@" 15''' "$0" "$@" 16] 17del _ 18 19import sys 20try: 21 from shutil import which 22except ImportError: 23 from distutils.spawn import find_executable as which 24 25print('Node.js android configure: Found Python {}.{}.{}...'.format(*sys.version_info)) 26acceptable_pythons = ((3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6)) 27if sys.version_info[:2] in acceptable_pythons: 28 import android_configure 29else: 30 python_cmds = ['python{}.{}'.format(*vers) for vers in acceptable_pythons] 31 sys.stderr.write('Please use {}.\n'.format(' or '.join(python_cmds))) 32 for python_cmd in python_cmds: 33 python_cmd_path = which(python_cmd) 34 if python_cmd_path and 'pyenv/shims' not in python_cmd_path: 35 sys.stderr.write('\t{} {}\n'.format(python_cmd_path, ' '.join(sys.argv[:1]))) 36 sys.exit(1) 37