forked from arendst/Tasmota
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update changelogs * Fix compile warning (arendst#21411) * Remove non IDF5 code * Enabled watchdog for ESP32 and variants (arendst#21414) * Drop support of old insecure fingerprint algorithm (deprecated since v8.4.0) (arendst#21416) * Revert "Enabled watchdog for ESP32 and variants (arendst#21414)" (arendst#21417) This reverts commit e4ea62c. * Update changelogs * Fix Domoticz re-subscribe on MQTT reconnect. Regression from v13.4.0.3 (arendst#21281) * embed solidify external Berry files from url * typo * clang install in gitpod Dockerfile * clang install with sudo * try python3.12 * try BLE in var globs * solidify first * use full workspace for clang --------- Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com> Co-authored-by: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Co-authored-by: Staars <baars@klinikum-brandenburg.de>
- Loading branch information
1 parent
1518566
commit aebf4d1
Showing
20 changed files
with
176 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FROM gitpod/workspace-python-3.11 | ||
FROM gitpod/workspace-full | ||
|
||
USER gitpod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
# Little convenience script to solidify external berry files as embedded | ||
|
||
Import("env") | ||
|
||
import os | ||
import sys | ||
from genericpath import exists | ||
from os.path import join | ||
import subprocess | ||
from colorama import Fore, Back, Style | ||
import requests | ||
import re | ||
|
||
IS_WINDOWS = sys.platform.startswith("win") | ||
|
||
def ensureBerry(): | ||
BERRY_GEN_DIR = join(env.subst("$PROJECT_DIR"), "lib", "libesp32","berry") | ||
os.chdir(BERRY_GEN_DIR) | ||
BERRY_EXECUTABLE = join(BERRY_GEN_DIR,"berry") | ||
if IS_WINDOWS: | ||
berry_executable = join(BERRY_GEN_DIR,"berry.exe") | ||
else: | ||
if os.path.exists(BERRY_EXECUTABLE) == False: | ||
print("Will compile Berry executable") | ||
make_cmd = "make" | ||
subprocess.call(make_cmd, shell=False) | ||
|
||
if os.path.exists(BERRY_EXECUTABLE): | ||
return BERRY_EXECUTABLE | ||
else: | ||
return None | ||
|
||
def addEntryToModtab(source): | ||
code = source.decode("utf-8") | ||
class_name = None | ||
is_module = False | ||
|
||
pattern = (r'''(?<=module\()[^"].*''') # module?? | ||
result = re.findall(pattern,code) | ||
if len(result) > 0: | ||
class_name = result[0].replace("'","").replace('"','').replace(")","") | ||
print(class_name+" is a module") | ||
is_module = True | ||
else: # just a class | ||
pattern = (r'(?<=#@ solidify:).*') | ||
result = re.findall(pattern,code) | ||
if len(result) > 0: | ||
class_name = result[0].split(",")[0] | ||
print(class_name+" is a class") | ||
if class_name == None: | ||
print("Could not find class name - is '#@ solidify:' used in Berry file??") | ||
print(Fore.RED + "Aborting build process!!") | ||
quit() | ||
MODTAB_PATH = join(env.subst("$PROJECT_DIR"), "lib", "libesp32","berry","default","be_modtab.c") | ||
with open(MODTAB_PATH, 'r') as file: | ||
code = file.read() # reuse code var for modtab file | ||
if is_module: | ||
nmodule = f" &be_native_module({class_name})," | ||
if code.find(nmodule) == -1: | ||
code = code.replace( | ||
"&be_native_module(string),", | ||
f'&be_native_module(string),\n{nmodule}' | ||
) | ||
enmodule = f"be_extern_native_module({class_name});" | ||
if code.find(enmodule) == -1: | ||
code = code.replace( | ||
"be_extern_native_module(string);", | ||
f'be_extern_native_module(string);\n{enmodule}' | ||
) | ||
else: | ||
nclass = f" &be_native_class({class_name})," | ||
if code.find(nclass) == -1: | ||
code = code.replace( | ||
"&be_native_class(tasmota),", | ||
f'&be_native_class(tasmota),\n{nclass}' | ||
) | ||
enclass = f"be_extern_native_class({class_name});" | ||
if code.find(enclass) == -1: | ||
code = code.replace( | ||
"be_extern_native_class(tasmota);", | ||
f'be_extern_native_class(tasmota);\n{enclass}' | ||
) | ||
|
||
with open(MODTAB_PATH, 'w') as file: | ||
file.write(code) | ||
|
||
|
||
def addHeaderFile(name): | ||
print("Will solidify ",name) | ||
name = name.split(".")[0] | ||
data = f""" | ||
/******************************************************************** | ||
* {name} module | ||
* | ||
*******************************************************************/ | ||
#include "solidify/solidified_{name}.h" | ||
""" | ||
file_name = f"be_{name}_lib.c" | ||
file_path = join(BERRY_SOLIDIFY_DIR,"src",file_name) | ||
open(file_path,"w").write(data) | ||
|
||
def prepareBerryFiles(files): | ||
embedded_dir = join("src","embedded") | ||
for file in files: | ||
if "http" and "://" in file: | ||
response = requests.get(file.split(" ")[0]) | ||
if response.ok: | ||
target = join(embedded_dir,file.split(os.path.sep)[-1]) | ||
if len(file.split(" ")) > 1: | ||
target = join(embedded_dir,file.split(" ")[1]) | ||
print("Renaming",(file.split(os.path.sep)[-1]).split(" ")[0],"to",file.split(" ")[1]) | ||
open(target, "wb").write(response.content) | ||
addHeaderFile(file.split(os.path.sep)[-1]) | ||
addEntryToModtab(response.content) | ||
else: | ||
print(Fore.RED + "Failed to download: ",file) | ||
continue | ||
# maybe later ... | ||
# if os.path.isdir(file): | ||
# continue | ||
# else: | ||
# shutil.copy(file, embedded_dir) | ||
return True | ||
|
||
try: | ||
files = env.GetProjectOption("custom_berry_solidify") | ||
except: | ||
print("Nothing more to solidify") | ||
else: | ||
|
||
BERRY_EXECUTABLE = ensureBerry() | ||
|
||
BERRY_SOLIDIFY_DIR = join(env.subst("$PROJECT_DIR"), "lib", "libesp32","berry_tasmota") | ||
os.chdir(BERRY_SOLIDIFY_DIR) | ||
|
||
if prepareBerryFiles(files.splitlines()): | ||
solidify_command = BERRY_EXECUTABLE | ||
solidify_flags = " -s -g solidify_all.be" | ||
print("Start solidification for 'berry_tasmota':") | ||
subprocess.call(solidify_command + solidify_flags, shell=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.