[FL-3098] Up toolchain to version 20 (#2397)

* Up toolchain to 20
* Python reformat, add version info into fbtenv

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Max Andreev 2023-02-15 19:56:25 +03:00 committed by GitHub
parent 25e8947282
commit 2fdebb639b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 4 deletions

View File

@ -22,7 +22,6 @@ def _convert_image(source_filename: str):
class DolphinBubbleAnimation: class DolphinBubbleAnimation:
FILE_TYPE = "Flipper Animation" FILE_TYPE = "Flipper Animation"
FILE_VERSION = 1 FILE_VERSION = 1
@ -243,7 +242,6 @@ class DolphinBubbleAnimation:
class DolphinManifest: class DolphinManifest:
FILE_TYPE = "Flipper Animation Manifest" FILE_TYPE = "Flipper Animation Manifest"
FILE_VERSION = 1 FILE_VERSION = 1

View File

@ -1,5 +1,6 @@
import serial.tools.list_ports as list_ports import serial.tools.list_ports as list_ports
# Returns a valid port or None, if it cannot be found # Returns a valid port or None, if it cannot be found
def resolve_port(logger, portname: str = "auto"): def resolve_port(logger, portname: str = "auto"):
if portname != "auto": if portname != "auto":

View File

@ -173,12 +173,14 @@ class Templite:
"""Renders the template according to the given namespace.""" """Renders the template according to the given namespace."""
stack = [] stack = []
namespace["__file__"] = self.file namespace["__file__"] = self.file
# add write method # add write method
def write(*args): def write(*args):
for value in args: for value in args:
stack.append(str(value)) stack.append(str(value))
namespace["write"] = write namespace["write"] = write
# add include method # add include method
def include(file): def include(file):
if not os.path.isabs(file): if not os.path.isabs(file):

View File

@ -13,7 +13,7 @@ if not ["%FBT_NOENV%"] == [""] (
exit /b 0 exit /b 0
) )
set "FLIPPER_TOOLCHAIN_VERSION=19" set "FLIPPER_TOOLCHAIN_VERSION=20"
if ["%FBT_TOOLCHAIN_ROOT%"] == [""] ( if ["%FBT_TOOLCHAIN_ROOT%"] == [""] (
set "FBT_TOOLCHAIN_ROOT=%FBT_ROOT%\toolchain\x86_64-windows" set "FBT_TOOLCHAIN_ROOT=%FBT_ROOT%\toolchain\x86_64-windows"
@ -31,9 +31,12 @@ if not exist "%FBT_TOOLCHAIN_VERSION_FILE%" (
set /p REAL_TOOLCHAIN_VERSION=<"%FBT_TOOLCHAIN_VERSION_FILE%" set /p REAL_TOOLCHAIN_VERSION=<"%FBT_TOOLCHAIN_VERSION_FILE%"
if not "%REAL_TOOLCHAIN_VERSION%" == "%FLIPPER_TOOLCHAIN_VERSION%" ( if not "%REAL_TOOLCHAIN_VERSION%" == "%FLIPPER_TOOLCHAIN_VERSION%" (
echo FBT: starting toolchain upgrade process..
powershell -ExecutionPolicy Bypass -File "%FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1" %flipper_toolchain_version% "%FBT_TOOLCHAIN_ROOT%" powershell -ExecutionPolicy Bypass -File "%FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1" %flipper_toolchain_version% "%FBT_TOOLCHAIN_ROOT%"
set /p REAL_TOOLCHAIN_VERSION=<"%FBT_TOOLCHAIN_VERSION_FILE%"
) )
echo FBT: using toolchain version %REAL_TOOLCHAIN_VERSION%
set "HOME=%USERPROFILE%" set "HOME=%USERPROFILE%"
set "PYTHONHOME=%FBT_TOOLCHAIN_ROOT%\python" set "PYTHONHOME=%FBT_TOOLCHAIN_ROOT%\python"
set "PYTHONPATH=" set "PYTHONPATH="

View File

@ -5,7 +5,7 @@
# public variables # public variables
DEFAULT_SCRIPT_PATH="$(pwd -P)"; DEFAULT_SCRIPT_PATH="$(pwd -P)";
SCRIPT_PATH="${SCRIPT_PATH:-$DEFAULT_SCRIPT_PATH}"; SCRIPT_PATH="${SCRIPT_PATH:-$DEFAULT_SCRIPT_PATH}";
FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"19"}"; FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"20"}";
FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}"; FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}";
fbtenv_show_usage() fbtenv_show_usage()
@ -35,6 +35,7 @@ fbtenv_restore_env()
PATH="$(echo "$PATH" | /usr/bin/sed "s/$TOOLCHAIN_ARCH_DIR_SED\/bin://g")"; PATH="$(echo "$PATH" | /usr/bin/sed "s/$TOOLCHAIN_ARCH_DIR_SED\/bin://g")";
PATH="$(echo "$PATH" | /usr/bin/sed "s/$TOOLCHAIN_ARCH_DIR_SED\/protobuf\/bin://g")"; PATH="$(echo "$PATH" | /usr/bin/sed "s/$TOOLCHAIN_ARCH_DIR_SED\/protobuf\/bin://g")";
PATH="$(echo "$PATH" | /usr/bin/sed "s/$TOOLCHAIN_ARCH_DIR_SED\/openocd\/bin://g")"; PATH="$(echo "$PATH" | /usr/bin/sed "s/$TOOLCHAIN_ARCH_DIR_SED\/openocd\/bin://g")";
PATH="$(echo "$PATH" | /usr/bin/sed "s/$TOOLCHAIN_ARCH_DIR_SED\/openssl\/bin://g")";
if [ -n "${PS1:-""}" ]; then if [ -n "${PS1:-""}" ]; then
PS1="$(echo "$PS1" | sed 's/\[fbt\]//g')"; PS1="$(echo "$PS1" | sed 's/\[fbt\]//g')";
elif [ -n "${PROMPT:-""}" ]; then elif [ -n "${PROMPT:-""}" ]; then
@ -248,6 +249,7 @@ fbtenv_check_download_toolchain()
elif [ ! -f "$TOOLCHAIN_ARCH_DIR/VERSION" ]; then elif [ ! -f "$TOOLCHAIN_ARCH_DIR/VERSION" ]; then
fbtenv_download_toolchain || return 1; fbtenv_download_toolchain || return 1;
elif [ "$(cat "$TOOLCHAIN_ARCH_DIR/VERSION")" -ne "$FBT_TOOLCHAIN_VERSION" ]; then elif [ "$(cat "$TOOLCHAIN_ARCH_DIR/VERSION")" -ne "$FBT_TOOLCHAIN_VERSION" ]; then
echo "FBT: starting toolchain upgrade process.."
fbtenv_download_toolchain || return 1; fbtenv_download_toolchain || return 1;
fi fi
return 0; return 0;
@ -269,6 +271,11 @@ fbtenv_download_toolchain()
return 0; return 0;
} }
fbtenv_print_version()
{
echo "FBT: using toolchain version $(cat "$TOOLCHAIN_ARCH_DIR/VERSION")";
}
fbtenv_main() fbtenv_main()
{ {
fbtenv_check_sourced || return 1; fbtenv_check_sourced || return 1;
@ -281,10 +288,12 @@ fbtenv_main()
fbtenv_check_script_path || return 1; fbtenv_check_script_path || return 1;
fbtenv_check_download_toolchain || return 1; fbtenv_check_download_toolchain || return 1;
fbtenv_set_shell_prompt; fbtenv_set_shell_prompt;
fbtenv_print_version;
PATH="$TOOLCHAIN_ARCH_DIR/python/bin:$PATH"; PATH="$TOOLCHAIN_ARCH_DIR/python/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/bin:$PATH"; PATH="$TOOLCHAIN_ARCH_DIR/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/protobuf/bin:$PATH"; PATH="$TOOLCHAIN_ARCH_DIR/protobuf/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/openocd/bin:$PATH"; PATH="$TOOLCHAIN_ARCH_DIR/openocd/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/openssl/bin:$PATH";
SAVED_PYTHONNOUSERSITE="${PYTHONNOUSERSITE:-""}"; SAVED_PYTHONNOUSERSITE="${PYTHONNOUSERSITE:-""}";
SAVED_PYTHONPATH="${PYTHONPATH:-""}"; SAVED_PYTHONPATH="${PYTHONPATH:-""}";