forked from openlp/openlp
use map instead of list comprehension; blank lines
This commit is contained in:
parent
b98e36aff2
commit
dc06b0b947
@ -78,40 +78,34 @@ OPTIONAL_MODULES = [
|
|||||||
|
|
||||||
w = sys.stdout.write
|
w = sys.stdout.write
|
||||||
|
|
||||||
|
|
||||||
def check_vers(version, required, text):
|
def check_vers(version, required, text):
|
||||||
if type(version) is str:
|
if type(version) is str:
|
||||||
version = version.split('.')
|
version = version.split('.')
|
||||||
version = [int(x) for x in version]
|
version = map(int, version)
|
||||||
if type(required) is str:
|
if type(required) is str:
|
||||||
required = required.split('.')
|
required = required.split('.')
|
||||||
required = [int(x) for x in required]
|
required = map(int, required)
|
||||||
w(' %s >= %s ... ' % (text, '.'.join([str(x) for x in required])))
|
w(' %s >= %s ... ' % (text, '.'.join(map(str, required))))
|
||||||
if version >= required:
|
if version >= required:
|
||||||
w('.'.join([str(x) for x in version]) + os.linesep)
|
w('.'.join(map(str, version)) + os.linesep)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
w('FAIL' + os.linesep)
|
w('FAIL' + os.linesep)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def print_vers_fail(required, text):
|
def print_vers_fail(required, text):
|
||||||
print(' %s >= %s ... FAIL' % (text, required))
|
print(' %s >= %s ... FAIL' % (text, required))
|
||||||
|
|
||||||
|
|
||||||
def verify_python():
|
def verify_python():
|
||||||
if not check_vers(list(sys.version_info), VERS['Python'], text='Python'):
|
if not check_vers(list(sys.version_info), VERS['Python'], text='Python'):
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
def verify_versions():
|
def verify_versions():
|
||||||
print('Verifying version of modules...')
|
print('Verifying version of modules...')
|
||||||
try:
|
try:
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
check_vers(QtCore.PYQT_VERSION_STR, VERS['PyQt4'],
|
check_vers(QtCore.PYQT_VERSION_STR, VERS['PyQt4'], 'PyQt4')
|
||||||
'PyQt4')
|
check_vers(QtCore.qVersion(), VERS['Qt4'], 'Qt4')
|
||||||
check_vers(QtCore.qVersion(), VERS['Qt4'],
|
|
||||||
'Qt4')
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print_vers_fail(VERS['PyQt4'], 'PyQt4')
|
print_vers_fail(VERS['PyQt4'], 'PyQt4')
|
||||||
print_vers_fail(VERS['Qt4'], 'Qt4')
|
print_vers_fail(VERS['Qt4'], 'Qt4')
|
||||||
@ -126,7 +120,6 @@ def verify_versions():
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
print_vers_fail(VERS['enchant'], 'enchant')
|
print_vers_fail(VERS['enchant'], 'enchant')
|
||||||
|
|
||||||
|
|
||||||
def check_module(mod, text='', indent=' '):
|
def check_module(mod, text='', indent=' '):
|
||||||
space = (30 - len(mod) - len(text)) * ' '
|
space = (30 - len(mod) - len(text)) * ' '
|
||||||
w(indent + '%s%s... ' % (mod, text) + space)
|
w(indent + '%s%s... ' % (mod, text) + space)
|
||||||
@ -137,7 +130,6 @@ def check_module(mod, text='', indent=' '):
|
|||||||
w('FAIL')
|
w('FAIL')
|
||||||
w(os.linesep)
|
w(os.linesep)
|
||||||
|
|
||||||
|
|
||||||
def verify_pyenchant():
|
def verify_pyenchant():
|
||||||
w('Enchant (spell checker)... ')
|
w('Enchant (spell checker)... ')
|
||||||
try:
|
try:
|
||||||
@ -150,14 +142,13 @@ def verify_pyenchant():
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
w('FAIL' + os.linesep)
|
w('FAIL' + os.linesep)
|
||||||
|
|
||||||
|
|
||||||
def verify_pyqt():
|
def verify_pyqt():
|
||||||
w('Qt4 image formats... ')
|
w('Qt4 image formats... ')
|
||||||
try:
|
try:
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
read_f = ', '.join([unicode(format).lower() \
|
read_f = ', '.join([unicode(format).lower()
|
||||||
for format in QtGui.QImageReader.supportedImageFormats()])
|
for format in QtGui.QImageReader.supportedImageFormats()])
|
||||||
write_f= ', '.join([unicode(format).lower() \
|
write_f = ', '.join([unicode(format).lower()
|
||||||
for format in QtGui.QImageWriter.supportedImageFormats()])
|
for format in QtGui.QImageWriter.supportedImageFormats()])
|
||||||
w(os.linesep)
|
w(os.linesep)
|
||||||
print(' read: %s' % read_f)
|
print(' read: %s' % read_f)
|
||||||
@ -165,9 +156,7 @@ def verify_pyqt():
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
w('FAIL' + os.linesep)
|
w('FAIL' + os.linesep)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
verify_python()
|
verify_python()
|
||||||
|
|
||||||
print('Checking for modules...')
|
print('Checking for modules...')
|
||||||
@ -187,6 +176,5 @@ def main():
|
|||||||
verify_pyqt()
|
verify_pyqt()
|
||||||
verify_pyenchant()
|
verify_pyenchant()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == u'__main__':
|
if __name__ == u'__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user