Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
configuration: fix round-trip bugs by removing configobj
West has historically relied on the third-party configobj library for writing configuration files instead of using the standard library's configparser module. The reason why is that configobj has round-trip support for comments. However, the public reading API uses configparser. Up until now, we were assuming that the two were compatible for the simple purposes we needed, and indeed they've proven compatible "enough" that the different code paths on read vs. write haven't been an issue. This has become a problem now that we are introducing the manifest.groups configuration option, though, because its value contains commas. The configparser and configobj file formats have a semantic difference between these two options, though: [section] foo = "one,two" bar = one,two The difference is: - in configobj, 'foo' is the string "one,two" and 'bar' is the list ['one', 'two'] - in configparser, 'foo' is the string '"one,two"' and bar is the string 'one,two' Further, the configobj library automatically adds quotes around any string that contains commas to enforce this distinction. This is breaking round-trips, since: west config section.foo one,two # configobj writes "one,two" west config section.foo # configparser reads '"one,two"' Looking at it further, configobj development seems to have stalled in 2014, and the most significant user it claims in its documentation (IPython) has moved on to .py and .json configuration files. This isn't worth the hassle. Just drop the configobj dependency and use configparser everywhere. This will delete comments that users have added to their configuration files and may otherwise reorder sections, but having the round-trip semantics correct is more important than that. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
- Loading branch information