11cb0ef41Sopenharmony_ci#!/bin/sh 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci# Locate an acceptable Python interpreter and then re-execute the script. 41cb0ef41Sopenharmony_ci# Note that the mix of single and double quotes is intentional, 51cb0ef41Sopenharmony_ci# as is the fact that the ] goes on a new line. 61cb0ef41Sopenharmony_ci_=[ 'exec' '/bin/sh' '-c' ''' 71cb0ef41Sopenharmony_cicommand -v python3.11 >/dev/null && exec python3.11 "$0" "$@" 81cb0ef41Sopenharmony_cicommand -v python3.10 >/dev/null && exec python3.10 "$0" "$@" 91cb0ef41Sopenharmony_cicommand -v python3.9 >/dev/null && exec python3.9 "$0" "$@" 101cb0ef41Sopenharmony_cicommand -v python3.8 >/dev/null && exec python3.8 "$0" "$@" 111cb0ef41Sopenharmony_cicommand -v python3.7 >/dev/null && exec python3.7 "$0" "$@" 121cb0ef41Sopenharmony_cicommand -v python3.6 >/dev/null && exec python3.6 "$0" "$@" 131cb0ef41Sopenharmony_cicommand -v python3 >/dev/null && exec python3 "$0" "$@" 141cb0ef41Sopenharmony_ciexec python "$0" "$@" 151cb0ef41Sopenharmony_ci''' "$0" "$@" 161cb0ef41Sopenharmony_ci] 171cb0ef41Sopenharmony_cidel _ 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ciimport sys 201cb0ef41Sopenharmony_citry: 211cb0ef41Sopenharmony_ci from shutil import which 221cb0ef41Sopenharmony_ciexcept ImportError: 231cb0ef41Sopenharmony_ci from distutils.spawn import find_executable as which 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ciprint('Node.js android configure: Found Python {}.{}.{}...'.format(*sys.version_info)) 261cb0ef41Sopenharmony_ciacceptable_pythons = ((3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6)) 271cb0ef41Sopenharmony_ciif sys.version_info[:2] in acceptable_pythons: 281cb0ef41Sopenharmony_ci import android_configure 291cb0ef41Sopenharmony_cielse: 301cb0ef41Sopenharmony_ci python_cmds = ['python{}.{}'.format(*vers) for vers in acceptable_pythons] 311cb0ef41Sopenharmony_ci sys.stderr.write('Please use {}.\n'.format(' or '.join(python_cmds))) 321cb0ef41Sopenharmony_ci for python_cmd in python_cmds: 331cb0ef41Sopenharmony_ci python_cmd_path = which(python_cmd) 341cb0ef41Sopenharmony_ci if python_cmd_path and 'pyenv/shims' not in python_cmd_path: 351cb0ef41Sopenharmony_ci sys.stderr.write('\t{} {}\n'.format(python_cmd_path, ' '.join(sys.argv[:1]))) 361cb0ef41Sopenharmony_ci sys.exit(1) 37