From c574e24cad3460ee484c9ad0fee07d92e2707e5c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 22 Dec 2022 17:50:40 +0100 Subject: [PATCH] minor clean up in scripts (#17483) --- pio-tools/gen-berry-structures.py | 3 +-- pio-tools/gzip-firmware.py | 2 +- pio-tools/http-uploader.py | 1 + pio-tools/name-firmware.py | 4 +--- pio-tools/override_copy.py | 7 ++++--- pio-tools/pre_source_dir.py | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/pio-tools/gen-berry-structures.py b/pio-tools/gen-berry-structures.py index 622ebbd53..de975a8e5 100644 --- a/pio-tools/gen-berry-structures.py +++ b/pio-tools/gen-berry-structures.py @@ -1,6 +1,5 @@ Import("env") -env = DefaultEnvironment() -platform = env.PioPlatform() + import os import glob import subprocess diff --git a/pio-tools/gzip-firmware.py b/pio-tools/gzip-firmware.py index a497e03fb..e03418262 100644 --- a/pio-tools/gzip-firmware.py +++ b/pio-tools/gzip-firmware.py @@ -1,7 +1,7 @@ Import("env") + import os import shutil -import pathlib import tasmotapiolib import gzip diff --git a/pio-tools/http-uploader.py b/pio-tools/http-uploader.py index fafbcfe03..b9442e1f6 100644 --- a/pio-tools/http-uploader.py +++ b/pio-tools/http-uploader.py @@ -1,6 +1,7 @@ # Original idea by Pascal Gollor at 2022-12-13 Import("env") + import os import tasmotapiolib diff --git a/pio-tools/name-firmware.py b/pio-tools/name-firmware.py index dcb1e9d30..d6a310337 100644 --- a/pio-tools/name-firmware.py +++ b/pio-tools/name-firmware.py @@ -1,9 +1,7 @@ Import("env") -Import("projenv") -import os + import shutil import pathlib - import tasmotapiolib diff --git a/pio-tools/override_copy.py b/pio-tools/override_copy.py index 4f17079b2..53a2762a5 100644 --- a/pio-tools/override_copy.py +++ b/pio-tools/override_copy.py @@ -1,21 +1,22 @@ Import('env') + import os import shutil # copy tasmota/user_config_override_sample.h to tasmota/user_config_override.h if os.path.isfile("tasmota/user_config_override.h"): print ("*** use provided user_config_override.h as planned ***") -else: +else: shutil.copy("tasmota/user_config_override_sample.h", "tasmota/user_config_override.h") # copy platformio_override_sample.ini to platformio_override.ini if os.path.isfile("platformio_override.ini"): print ("*** use provided platformio_override.ini as planned ***") -else: +else: shutil.copy("platformio_override_sample.ini", "platformio_override.ini") # copy platformio_tasmota_cenv_sample.ini to platformio_tasmota_cenv.ini if os.path.isfile("platformio_tasmota_cenv.ini"): print ("*** use provided platformio_tasmota_cenv.ini as planned ***") -else: +else: shutil.copy("platformio_tasmota_cenv_sample.ini", "platformio_tasmota_cenv.ini") diff --git a/pio-tools/pre_source_dir.py b/pio-tools/pre_source_dir.py index 660f5df0a..6027d2ba9 100644 --- a/pio-tools/pre_source_dir.py +++ b/pio-tools/pre_source_dir.py @@ -1,8 +1,8 @@ +Import("env") + import glob import os -Import("env") - def FindInoNodes(env): src_dir = glob.escape(env.subst("$PROJECT_SRC_DIR")) return env.Glob(os.path.join(src_dir, "*.ino")) + env.Glob(