diff --git a/buildroot/share/PlatformIO/scripts/configuration.py b/buildroot/share/PlatformIO/scripts/configuration.py index 71d4e3777c..6677cd566d 100755 --- a/buildroot/share/PlatformIO/scripts/configuration.py +++ b/buildroot/share/PlatformIO/scripts/configuration.py @@ -3,7 +3,7 @@ # configuration.py # Apply options from config.ini to the existing Configuration headers # -import re, os, shutil, configparser, datetime +import re, os, shutil, subprocess, configparser, datetime from pathlib import Path verbose = 0 @@ -149,9 +149,9 @@ def fetch_example(url): # Find a suitable fetch command if shutil.which("curl") is not None: - fetch = "curl -L -s -S -f -o" + fetch = [ "curl", "-L", "-s", "-S", "-f", "-o" ] elif shutil.which("wget") is not None: - fetch = "wget -q -O" + fetch = [ "wget", "-q", "-O" ] else: blab("Couldn't find curl or wget", -1) #blab("Couldn't find curl or wget", 0) @@ -165,7 +165,7 @@ def fetch_example(url): # Try to fetch the remote files gotfile = False for fn in ("Configuration.h", "Configuration_adv.h", "_Bootscreen.h", "_Statusscreen.h"): - if os.system(f"{fetch} wgot {url}/{fn} >/dev/null 2>&1") == 0: + if subprocess.call(fetch + [ "wgot", f"{url}/{fn}" ], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) == 0: shutil.move('wgot', config_path(fn)) gotfile = True blab(f"Fetched {fn}", 2)