Refactor subfolder_list.py to enable unit testing. This means split the
implementation into separate logical functions. Additionally, modify the
code to improve PEP 8 compatibility and pylint result.
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
Fixes: #24576
The name of the symbolic link would be constructed using the full path
name to the target folder.
This is not needed and caused the issue raised in #24576.
This has been fixed by no longer using the toplevel target directory
in the link name, for example:
Old style: _project_zephyr_workspace_zephyr_include_sys
New style: include_sys
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
In order to make sure that the build works in folders that require a UTF
encoding, make sure that both CMake and the various Python scripts that
interact with each other on files use the same encoding, in this case
UTF-8.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier. Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.
By default all files without license information are under the default
license of Zephyr, which is Apache version 2.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Not needed in Python. Detected by check C0325 in pylint3.
Also replace an
if len(tag):
with just
if tag:
Empty strings, byte strings, lists, etc., are falsy in Python.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Found by "disordered --shuffle-dirents=yes".
Sorting os.walk() in scripts/subfolder_list.py removes the randomness in
the following files:
build/zephyr/misc/generated/syscalls_subdirs.txt
build/zephyr/CMakeFiles/syscall_list_h_target.dir/ or build.ninja
Sorting os.walk() in scripts/parse_syscalls.py removes the randomness
in:
build/zephyr/misc/generated/syscalls.json
build/zephyr/include/generated/syscall_dispatch.c
build/zephyr/include/generated/syscall_list.h
Note my (limited so far) testing did *not* observe any randomness in any
object file that this would address; the main purpose here is to remove
a very large amount of noise in diffoscope.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Fixes: #8380
This commit fixes the side-effect of PR #8211 where a 'ninja clean'
would try to remove dependency folders.
Changes:
- Symlinks are created during build and CMake targets now depends on
the symlinks. Thus, same behavior is achived with regards to
dependency handling, while at the same time, the output can be
cleaned as the dependencies are now attached to the symlinks.
- Dependencies have been changed so that generation of json files
depends on the trigger file and CMake depends upon the subdir txt
file. This prevents additional CMake runs after a clean.
Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
Fixes: #8210
Following changes has been made to ensure correct behavior on different
system:
- Python script to detect changes to directories, including empty ones.
When files are modified the list is updated
If sub-directories are added / removed a trigger file is touched to
notify cmake to re-run
- Windows: To detect changes to header files in include for
parse_syscalls.py all files must be individual monitored.
Hence all headers are globbed added to dependencies.
CMake configure depends on the folders so the added /
removed files are picked up.
- Other: Folders are monitored through the python list file so that
added / remove / modified
Added / removed sub-directories are detected through trigger
file in order to re-run cmake.
Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>