python: Set VERSION using existing VERSION_MAJOR and VERSION_MINOR macros and some mintor refactoring.