utils.list_relative_paths: avoid os.path.relpath
Profiling suggested that the cumulative time spent in os.path.relpath() was the dominant cost of utils.list_relative_paths().
Try to call this only once per directory walked.
In Python 3.5, we can optimise further by using os.scandir() and maintaining relative paths as we go.
From my measurements, this results in a roughly 2.5x speedup. It seemed to save a few seconds from a two minute build.
Edited by Angelos Evripiotis