build: always run waf with python3

Upstream waf still ships with the default interpreter being "python",
though the script works with both Python 2 and Python 3 (they're not
changing the default choice during 2.0.x releases for compatibility
reasons apparently). Add code to bootstrap.py to change the
interpreter from "python" to "python3" when downloading the "waf"
file.

Running any mpv code under Python 2 should be considered unsupported
in the future (and any code added need not work under Python 2).
This commit is contained in:
Uoti Urpala 2020-11-19 18:16:16 +02:00 committed by sfan5
parent 5ae6f04d6b
commit 2409300d40
1 changed files with 6 additions and 0 deletions

View File

@ -41,6 +41,12 @@ if not waf:
sys.exit(1)
if SHA256HASH == hashlib.sha256(waf).hexdigest():
# Upstream waf is not changing the default interpreter during
# 2.0.x line due to compatibility reasons apparently. So manually
# convert it to use python3 (the script works with both).
expected = b"#!/usr/bin/env python\n"
assert waf.startswith(expected)
waf = b"#!/usr/bin/env python3\n" + waf[len(expected):]
with open("waf", "wb") as wf:
wf.write(waf)