Tasmota/pio-tools/override_copy.py

29 lines
1.2 KiB
Python
Raw Normal View History

2020-05-06 15:23:29 +01:00
Import('env')
2022-12-22 16:50:40 +00:00
2020-05-06 15:23:29 +01:00
import os
2023-06-27 19:33:38 +01:00
import pathlib
from os.path import join
2020-05-06 15:23:29 +01:00
import shutil
2024-02-29 17:23:33 +00:00
from colorama import Fore, Back, Style
2020-05-06 15:23:29 +01:00
2023-06-27 19:33:38 +01:00
if " " in join(pathlib.Path(env["PROJECT_DIR"])):
2024-02-29 17:23:33 +00:00
print(Fore.RED + "*** Whitespace(s) in project path, unexpected issues/errors can happen ***")
2023-06-27 19:33:38 +01:00
2020-05-06 15:23:29 +01:00
# copy tasmota/user_config_override_sample.h to tasmota/user_config_override.h
if os.path.isfile("tasmota/user_config_override.h"):
2024-02-29 17:23:33 +00:00
print(Fore.GREEN + "*** use provided user_config_override.h as planned ***")
2022-12-22 16:50:40 +00:00
else:
2020-05-06 15:23:29 +01:00
shutil.copy("tasmota/user_config_override_sample.h", "tasmota/user_config_override.h")
2021-04-12 09:18:27 +01:00
# copy platformio_override_sample.ini to platformio_override.ini
if os.path.isfile("platformio_override.ini"):
2024-02-29 17:23:33 +00:00
print(Fore.GREEN + "*** use provided platformio_override.ini as planned ***")
2022-12-22 16:50:40 +00:00
else:
2021-04-12 09:18:27 +01:00
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"):
2024-02-29 17:23:33 +00:00
print(Fore.GREEN + "*** use provided platformio_tasmota_cenv.ini as planned ***")
2022-12-22 16:50:40 +00:00
else:
2021-04-24 19:11:27 +01:00
shutil.copy("platformio_tasmota_cenv_sample.ini", "platformio_tasmota_cenv.ini")