Move one if check into python code

Reason: this removes one useless indentation level that breaks “tabs for
indentation, spaces for alignment” rule.
This commit is contained in:
ZyX 2014-08-26 20:19:04 +04:00
parent 39a7142cb7
commit 644dec76e0

View File

@ -97,18 +97,18 @@ finally
echomsg 'should set g:powerline_pycmd to "py3" to make it load correctly.' echomsg 'should set g:powerline_pycmd to "py3" to make it load correctly.'
endif endif
echohl None echohl None
call s:rcmd( "def powerline_troubleshoot():") call s:rcmd("def powerline_troubleshoot():")
call s:rcmd( " import sys") call s:rcmd(" import sys")
call s:rcmd( " if sys.version_info < (2, 6):") call s:rcmd(" if sys.version_info < (2, 6):")
call s:rcmd( " print('Too old python version: ' + sys.version + ' (first supported is 2.6)')") call s:rcmd(" print('Too old python version: ' + sys.version + ' (first supported is 2.6)')")
call s:rcmd( " elif sys.version_info[0] == 3 and sys.version_info[1] < 2:") call s:rcmd(" elif sys.version_info[0] == 3 and sys.version_info[1] < 2:")
call s:rcmd( " print('Too old python 3 version: ' + sys.version + ' (first supported is 3.2)')") call s:rcmd(" print('Too old python 3 version: ' + sys.version + ' (first supported is 3.2)')")
call s:rcmd( " try:") call s:rcmd(" try:")
call s:rcmd( " import powerline") call s:rcmd(" import powerline")
call s:rcmd( " except ImportError:") call s:rcmd(" except ImportError:")
call s:rcmd( " print('Unable to import powerline, is it installed?')") call s:rcmd(" print('Unable to import powerline, is it installed?')")
if strpart(expand('<sfile>'), 0, 5) !=# '/usr/'
call s:rcmd(" else:") call s:rcmd(" else:")
call s:rcmd(" if not vim.eval('expand(\"<sfile>\")').startswith('/usr/'):")
call s:rcmd(" import os") call s:rcmd(" import os")
call s:rcmd(" powerline_dir = os.path.realpath(os.path.normpath(powerline.__file__))") call s:rcmd(" powerline_dir = os.path.realpath(os.path.normpath(powerline.__file__))")
call s:rcmd(" powerline_dir = os.path.dirname(powerline.__file__)") call s:rcmd(" powerline_dir = os.path.dirname(powerline.__file__)")
@ -132,11 +132,10 @@ finally
call s:rcmd(" print('one in ' + real_powerline_dir + ', other in ' + real_this_dir + '.')") call s:rcmd(" print('one in ' + real_powerline_dir + ', other in ' + real_this_dir + '.')")
call s:rcmd(" print('You should remove one of this. Check out troubleshooting section,')") call s:rcmd(" print('You should remove one of this. Check out troubleshooting section,')")
call s:rcmd(" print('it contains some information about the alternatives.')") call s:rcmd(" print('it contains some information about the alternatives.')")
endif call s:rcmd("try:")
call s:rcmd( "try:") call s:rcmd(" powerline_troubleshoot()")
call s:rcmd( " powerline_troubleshoot()") call s:rcmd("finally:")
call s:rcmd( "finally:") call s:rcmd(" del powerline_troubleshoot")
call s:rcmd( " del powerline_troubleshoot")
execute s:pycmd s:pystr execute s:pycmd s:pystr
unlet s:pystr unlet s:pystr
unlet s:pycmd unlet s:pycmd