modified: interface/ri_install.py
update
make tab equal 4 spaces
This commit is contained in:
@@ -24,27 +24,27 @@ import os.path
|
||||
import ri_data
|
||||
|
||||
def install_over(ret):
|
||||
if ri_oper.Rate.value == 100 and ret == 0:
|
||||
if display.set_task_over():
|
||||
print "reboot ..."
|
||||
os.system("reboot")
|
||||
else:
|
||||
display.root_destroy()
|
||||
if ri_oper.Rate.value == 100 and ret == 0:
|
||||
if display.set_task_over():
|
||||
print "reboot ..."
|
||||
os.system("reboot")
|
||||
else:
|
||||
display.root_destroy()
|
||||
|
||||
def main():
|
||||
global has_run
|
||||
if has_run: return
|
||||
has_run = True
|
||||
for instance in oper_list:
|
||||
ret = instance.install()
|
||||
if ret:
|
||||
display.error(instance, ret)
|
||||
break
|
||||
else:
|
||||
ri_oper.display_sub_operation((ri_oper.language=='chinese' \
|
||||
and instance.chinese_name or instance.english_name)+\
|
||||
(ri_oper.language=='chinese' and u' 成功\n' or ' success\n'))
|
||||
install_over(ret)
|
||||
global has_run
|
||||
if has_run: return
|
||||
has_run = True
|
||||
for instance in oper_list:
|
||||
ret = instance.install()
|
||||
if ret:
|
||||
display.error(instance, ret)
|
||||
break
|
||||
else:
|
||||
ri_oper.display_sub_operation((ri_oper.language=='chinese' \
|
||||
and instance.chinese_name or instance.english_name)+\
|
||||
(ri_oper.language=='chinese' and u' 成功\n' or ' success\n'))
|
||||
install_over(ret)
|
||||
|
||||
has_run = False
|
||||
|
||||
@@ -52,28 +52,28 @@ def print_usages():
|
||||
print 'Usages: %s [-l|--language language] [-d|--display display-mode] [install_xml_file]' %sys.argv[0]
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "l:d:", ["language=", "display="])
|
||||
opts, args = getopt.getopt(sys.argv[1:], "l:d:", ["language=", "display="])
|
||||
except getopt.GetoptError:
|
||||
print_usages()
|
||||
sys.exit(1)
|
||||
print_usages()
|
||||
sys.exit(1)
|
||||
|
||||
if len(args)>0:
|
||||
ri_data.install_xml = args[0]
|
||||
ri_data.install_xml = args[0]
|
||||
|
||||
#ri_data.install_xml default value is set in ri_data.py
|
||||
if os.path.isfile(ri_data.install_xml):
|
||||
ri_data.init_from_xml()
|
||||
ri_data.init_from_xml()
|
||||
else:
|
||||
print 'error: install xml(%s) does not exist' %ri_data.install_xml
|
||||
sys.exit(1)
|
||||
print 'error: install xml(%s) does not exist' %ri_data.install_xml
|
||||
sys.exit(1)
|
||||
|
||||
ri_oper.language='english'
|
||||
disp = 'ri_inst_cli'
|
||||
for opt,arg in opts:
|
||||
if opt in ("-l","--language"):
|
||||
ri_oper.language=arg.lower()
|
||||
elif opt in ("-d", "--display"):
|
||||
disp = 'ri_inst_%s' %arg.lower()
|
||||
if opt in ("-l","--language"):
|
||||
ri_oper.language=arg.lower()
|
||||
elif opt in ("-d", "--display"):
|
||||
disp = 'ri_inst_%s' %arg.lower()
|
||||
exec 'import %s as display' %disp
|
||||
|
||||
ri_oper.display_operation = display.set_task
|
||||
|
||||
Reference in New Issue
Block a user