Various style and build fixes.

* Fixed most pylint warnings.
* Suppressing distutils import error.
* Suppressing py2exe import error, as is installed by configure script.
* Moved setup code inside a main function.