Remove a DEBUG_VAR, that broke release build.
Refactor gen-version.sh script

Review 1028 by @tryneus
Closes #1636
Python - better error messages when using dates

Review 1033 by @tryneus
Closes #1509
Merge branch 'next' into sam_97_alt