fusesoc
fusesoc copied to clipboard
Use pathlib for all paths
FuseSoC handles a lot of file paths, currently as strings. That's often confusing and can lead to bugs, e.g. when describing paths on Windows. Additionally, manipulating paths as strings requires either error-prone string concatenation, or os.path.*
calls, which are inconvenient to use at times. pathlib is a nice solution for that problem, as it allows us to handle a file system path as object.
~Unfortunately, the pathlib implementation in Python 3.5 is slightly annoying to use without the path-like interface accepted in open()
and friends, requiring explicit casts to str
instead. We either need to accept that and be extra careful in testing, or use the https://pypi.org/project/pathlib2/ backport for Python 3.5 (I'd probably prefer that).~ (We're Python 3.6+ now.)