From 2409300d408704af347b52b5d2ec58d517cf35a3 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Thu, 19 Nov 2020 18:16:16 +0200 Subject: [PATCH] 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). --- bootstrap.py | 6 ++++++ 1 file changed, 6 insertions(+) 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)