prevent a hen/egg problem when handling unsupported python versions

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2012-05-24 15:15:38 +02:00
parent 995e2c44ee
commit f795b83c8e

View file

@ -194,6 +194,13 @@ if __name__ == "__main__":
# Sys is needed for sys.exit()
import sys
cdistpythonversion = '3.2'
if sys.version < cdistpythonversion:
print('Cdist requires Python >= ' + cdistpythonversion +
' on the source host.', file=sys.stderr)
sys.exit(1)
exit_code = 0
try:
@ -201,11 +208,6 @@ if __name__ == "__main__":
import os
import re
cdistpythonversion = '3.2'
if sys.version < cdistpythonversion:
raise cdist.Error('Cdist requires Python >= ' + cdistpythonversion +
' on the source host.')
# Ensure our /lib/ is included into PYTHON_PATH
sys.path.insert(0, os.path.abspath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib')))