38.15.7. path_properties.py

In order to build and run each userland and baremetal example properly, we need per-file metadata such as compiler flags and required number of cores.

This data is stored is stored in path_properties.py at path_properties_tuples.

Maybe we should embed it magically into source files directories to make it easier to see? But one big Python dict was easier to implement so we started like this. And it allows factoring chunks out easily.

The format is as follows:

'path_component': (
    {'property': value},
    {
        'child_path_component':
        {
            {'child_property': },
            {}
        }
    }
)

and as a shortcut, paths that don’t have any children can be written directly as:

'path_component': {'property': value}

Properties of parent directories apply to all children.

Lists coming from parent directories are extended instead of overwritten by children, this is especially useful for C compiler flags.

To quickly determine which properties a path has, you can use getprops, e.g.:

./getprops userland/c/hello.c

which outputs values such as:

allowed_archs=None
allowed_emulators=None
arm_aarch32=False
arm_sve=False
baremetal=True