summaryrefslogtreecommitdiffstats
path: root/bootstrap.py
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2020-11-19 18:16:16 +0200
committersfan5 <sfan5@live.de>2020-11-22 13:59:26 +0100
commit2409300d408704af347b52b5d2ec58d517cf35a3 (patch)
treef641b5f5a436438357a7f884eecc71434d942bca /bootstrap.py
parent5ae6f04d6bb3647419b02e0e0f4d8198b9e44bb2 (diff)
downloadmpv-2409300d408704af347b52b5d2ec58d517cf35a3.tar.bz2
mpv-2409300d408704af347b52b5d2ec58d517cf35a3.tar.xz
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).
Diffstat (limited to 'bootstrap.py')
-rwxr-xr-xbootstrap.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/bootstrap.py b/bootstrap.py
index a8bd67cb23..9949183002 100755
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -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)