mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2025-12-10 00:28:42 -06:00
Gives a comprehensible error message in case we start using 3.8-only features in the main `wscript`. Keep the check in `wscript` in the somewhat unlikely case that another Python is discovered by waf.
40 lines
1.2 KiB
Python
Executable File
40 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import subprocess
|
|
import os.path as p
|
|
import sys
|
|
|
|
# also update `cfg.check_python_version` in `./wscript`
|
|
MIN_VER = (3, 8, 0)
|
|
|
|
# check before we start loading code and e.g. encounter SyntaxErrors. this means
|
|
# this file should remain compatible with any Python 3 (at least syntax-wise).
|
|
if sys.version_info[:3] < MIN_VER:
|
|
min_txt = ".".join(str(v) for v in MIN_VER)
|
|
current_txt = ".".join(str(v) for v in sys.version_info[:3])
|
|
print("ERROR: Python minimum supported version is",
|
|
min_txt, "but you have", current_txt, file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
d = p.dirname(p.realpath(__file__))
|
|
waf_light = p.join(d, 'modules', 'waf', 'waf-light')
|
|
|
|
python = sys.executable
|
|
|
|
try:
|
|
subprocess.check_call([python, waf_light] + sys.argv[1:])
|
|
except subprocess.CalledProcessError as e:
|
|
if e.returncode != 2 or p.isfile(waf_light):
|
|
sys.exit(1)
|
|
|
|
print('Missing waf submodule. Trying to get it')
|
|
|
|
try:
|
|
subprocess.check_call(['git', 'submodule', 'update', '--init',
|
|
'modules/waf'])
|
|
except subprocess.CalledProcessError:
|
|
print('Could not update submodule', file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
print('Submodules OK, try running again')
|