Rewrite scripts in Python

Our shell scripts are not very Windows-friendly. Let's use Python instead, just like Chromium does.