From 768669a635740188ef5d86fb59b87431d6ad24b4 Mon Sep 17 00:00:00 2001 From: Mit4el Date: Wed, 9 Aug 2023 23:33:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=B1=D0=BA=D1=83=20=D0=BF=D1=80=D0=B8=20=D0=BE=D0=B4?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B8=20=D1=81=20=D0=A4?= =?UTF-8?q?=D0=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prebuildscript.py | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/prebuildscript.py b/prebuildscript.py index dc8114f3..7eb4a4b1 100644 --- a/prebuildscript.py +++ b/prebuildscript.py @@ -2,12 +2,27 @@ import os import configparser -config = configparser.ConfigParser() # создаём объекта парсера INI -config.read("platformio.ini") -deviceName = config["platformio"]["default_envs"] -# удаляем объектный файл где используется время сборки, для обновления -try: - os.remove("./.pio/build/"+deviceName+"/src/Main.cpp.o") -except OSError as e: - # If it fails, inform the user. - print("Error: %s - %s." % (e.filename, e.strerror)) \ No newline at end of file +def before_build(): # source, target, env + print("Current Build targets", BUILD_TARGETS) + # Это всё потому что не работает "buildprog". При сборке прошивки Targets пустой, на всякий случай исключим все остальные + if (BUILD_TARGETS == ['upload'] or + BUILD_TARGETS == ['buildfs'] or + BUILD_TARGETS == ['uploadfs'] or + BUILD_TARGETS == ['uploadfsota'] or + BUILD_TARGETS == ['size']): + return + + print("Clear BUILD_TIME, delete main.o !") + config = configparser.ConfigParser() # создаём объекта парсера INI + config.read("platformio.ini") + deviceName = config["platformio"]["default_envs"] + # удаляем объектный файл где используется время сборки, для обновления + try: + os.remove("./.pio/build/"+deviceName+"/src/Main.cpp.o") + except OSError as e: + # If it fails, inform the user. + print("Error: %s - %s." % (e.filename, e.strerror)) + +#env.AddPreAction("buildprog", before_build) # $BUILD_DIR/src/main.cpp.o + +before_build() \ No newline at end of file