Rewrite build script in python!

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>