When attempting to build the firmware using ufbt build, the following error occurs:
TypeError: 'float' object is not iterable:
File "C:\Users\nazar\.ufbt\current\scripts\ufbt\SConstruct", line 248:
app_artifacts = appenv.BuildAppElf(app)
File "C:\Users\nazar\.ufbt\toolchain\x86_64-windows\python\Lib\site-packages\SCons\Util\envs.py", line 251:
return self.method(*nargs, **kwargs)
File "C:\Users\nazar\.ufbt\current\scripts\fbt_tools\fbt_extapps.py", line 261:
env["EXT_APPS"][app.appid] = app_artifacts = app_builder.build()
File "C:\Users\nazar\.ufbt\current\scripts\fbt_tools\fbt_extapps.py", line 48:
self._setup_app_env()
File "C:\Users\nazar\.ufbt\current\scripts\fbt_tools\fbt_extapps.py", line 61:
("FAP_VERSION", f'\\"{".".join(map(str, self.app.fap_version))}\\"'),
Problem:
The issue originates from a TypeError in the file fbt_extapps.py, where the function is attempting to iterate over a float value. Specifically, the error is caused by the line that tries to join elements of self.app.fap_version:
("FAP_VERSION", f'\\"{".".join(map(str, self.app.fap_version))}\\"')
If self.app.fap_version contains float values, it will cause an issue since join expects an iterable of strings, and map(str, self.app.fap_version) will fail if fap_version is not an iterable of strings.
Proposed Solution:
To fix the issue, the code should be updated to ensure that self.app.fap_version is properly converted to strings before attempting to join them. The updated function should look like this:
def _setup_app_env(self):
# Clone the environment
self.app_env = self.fw_env.Clone(
FAP_SRC_DIR=self.app._appdir,
FAP_WORK_DIR=self.app_work_dir,
)
# Ensure fap_version is a list of strings
fap_version_str = '.'.join(map(str, self.app.fap_version)) # Convert elements to strings before joining
# Add the version and other defines
self.app_env.Append(
CPPDEFINES=[
("FAP_VERSION", f'\\"{fap_version_str}\\"'),
*self.app.cdefines,
],
)
# Set the variant directory for the build
self.app_env.VariantDir(self.app_work_dir, self.app._appdir, duplicate=False)
This change ensures that the fap_version is always treated as a sequence of strings, preventing the TypeError from occurring.
Additional Information:
- The issue occurs during the build process when using the
ufbt build command.
- It is critical to properly convert
fap_version to a string format to ensure the correct handling of the version number.
- After ufbt -c fix automatically deletes and changes to old version, I set for now 'Only reading' flag
When attempting to build the firmware using
ufbt build, the following error occurs:Problem:
The issue originates from a
TypeErrorin the filefbt_extapps.py, where the function is attempting to iterate over a float value. Specifically, the error is caused by the line that tries to join elements ofself.app.fap_version:If
self.app.fap_versioncontains float values, it will cause an issue sincejoinexpects an iterable of strings, andmap(str, self.app.fap_version)will fail iffap_versionis not an iterable of strings.Proposed Solution:
To fix the issue, the code should be updated to ensure that
self.app.fap_versionis properly converted to strings before attempting to join them. The updated function should look like this:This change ensures that the
fap_versionis always treated as a sequence of strings, preventing theTypeErrorfrom occurring.Additional Information:
ufbt buildcommand.fap_versionto a string format to ensure the correct handling of the version number.