[python] fix race condition in builder
see #315
On network shares we observed race conditions, where the file was not yet fully written before calling make or cmake and thus a rebuild was not properly triggered.
By explicitly syncing we ensure that the files are in a correct state.