b64bbc4c0d
git-svn-id: http://svn.sabayonlinux.org/overlay@1688 d7aec97c-591d-0410-af39-a8856400b30a
555 lines
17 KiB
Python
Executable File
555 lines
17 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
import os
|
|
import string
|
|
import commands
|
|
import shutil
|
|
import sys
|
|
|
|
# Variables
|
|
xorgfile = "/etc/X11/xorg.conf"
|
|
lspci = '/sbin/lspci'
|
|
nvidia_settings = "/usr/share/applications/nvidia-settings.desktop"
|
|
|
|
# cmdlines
|
|
options = sys.argv[1:]
|
|
dryrun = False
|
|
noproprietary = False
|
|
nvidia_forcefail = False
|
|
nvidia_disablelegacy = False
|
|
legacy = False
|
|
noopengl = False
|
|
noexa = False
|
|
livecd = False
|
|
steps = []
|
|
forced_xdriver = ''
|
|
current_arch = os.uname()[4]
|
|
if current_arch == "x86_64":
|
|
ld_arch = "elf_x86_64"
|
|
else:
|
|
ld_arch = "elf_i386"
|
|
lspci_output = ''
|
|
for option in options:
|
|
if option == "--dry-run":
|
|
dryrun = True
|
|
elif option.startswith('--with-lspci=') and len(option.split("=")) >= 2:
|
|
option = option.split("=")[1:]
|
|
option = string.join(option,"=")
|
|
if option.startswith('"'): option = option[1:]
|
|
if option.startswith("'"): option = option[1:]
|
|
if option.endswith("'"): option = option[:len(option)-1]
|
|
if option.endswith('"'): option = option[:len(option)-1]
|
|
lspci_output = option
|
|
elif option.startswith('--forced-xdriver=') and len(option.split("=")) == 2:
|
|
forced_xdriver = option.split("=")[1]
|
|
elif option == "--noopengl":
|
|
noopengl = True
|
|
elif option == "--noexa":
|
|
noexa = True
|
|
|
|
if (not lspci_output):
|
|
lspci_output = commands.getoutput(lspci+' -nn | grep VGA')
|
|
else:
|
|
lspci_output = commands.getoutput('echo '+lspci_output+' | grep VGA')
|
|
|
|
# parse cmdline
|
|
# FIXME: add support for no-dri?
|
|
f = open("/proc/cmdline","r")
|
|
cmdline = f.readline().split()
|
|
f.close()
|
|
for cmd in cmdline:
|
|
if cmd == "noproprietary":
|
|
noproprietary = True
|
|
elif cmd == "nvidia=forcefail":
|
|
nvidia_forcefail = True
|
|
elif cmd == "nvidia=disablelegacy":
|
|
nvidia_disablelegacy = True
|
|
elif cmd == "legacy":
|
|
legacy = True
|
|
elif cmd == "noopengl":
|
|
noopengl = True
|
|
elif cmd == "cdroot":
|
|
livecd = True
|
|
elif cmd == "noexa":
|
|
noexa = True
|
|
elif cmd.startswith("xdriver=") and (len(cmd.split("=")) == 2):
|
|
if (not forced_xdriver): forced_xdriver = cmd.split("=")[1] # --forced-xdriver= owns
|
|
|
|
|
|
# Functions
|
|
def remove_proprietary_opengl():
|
|
if (not dryrun):
|
|
os.system('''
|
|
mount -t tmpfs none /usr/lib/opengl/ati &> /dev/null
|
|
mount -t tmpfs none /usr/lib/opengl/nvidia &> /dev/null
|
|
sed -i '/LIBGL_DRIVERS_PATH/ s/.*//' /etc/profile.env
|
|
''')
|
|
fix_possible_opengl_misconfiguration('xorg-x11')
|
|
else:
|
|
print "I was about to remove proprietary OpenGL libraries"
|
|
|
|
def check_if_driver_is_available(xdriver):
|
|
if os.path.isfile('/usr/lib/xorg/modules/drivers/'+xdriver+'_drv.so'):
|
|
print "check_if_driver_is_available for "+xdriver+": available"
|
|
return True
|
|
print "check_if_driver_is_available for "+xdriver+": not available"
|
|
return False
|
|
|
|
def check_if_proprietary_driver_system_is_healthy(kernelmod): #FIXME attenzione a dove usi questa
|
|
rc = os.system('modprobe '+kernelmod+' &> /dev/null')
|
|
if (rc == 0):
|
|
if kernelmod == "nvidia":
|
|
if os.path.exists('/usr/lib/opengl/nvidia/lib'):
|
|
print "check_if_proprietary_driver_system_is_healthy: nvidia healthy"
|
|
return True
|
|
print "check_if_proprietary_driver_system_is_healthy: nvidia NOT healthy"
|
|
return False
|
|
if kernelmod == "fglrx":
|
|
if os.path.exists('/usr/lib/opengl/ati/lib'):
|
|
print "check_if_proprietary_driver_system_is_healthy: ati healthy"
|
|
return True
|
|
print "check_if_proprietary_driver_system_is_healthy: ati NOT healthy"
|
|
return False
|
|
else:
|
|
return False
|
|
|
|
def deploy_nvidia_9xxxxx_drivers(): # reduce os.system usage
|
|
if (not dryrun):
|
|
# are they available ? we're on livecd...
|
|
if not os.path.isdir("/install-data/drivers"):
|
|
print "No /install-data/drivers available"
|
|
return False
|
|
|
|
packages = os.listdir("/install-data/drivers")
|
|
packages = [x for x in packages if x.startswith("nvidia-drivers-9") and x.endswith(".tbz2")]
|
|
if not packages:
|
|
return False
|
|
package_file = "/install-data/drivers/"+packages[0]
|
|
if not os.path.isfile(package_file):
|
|
print package_file+" does not exist???"
|
|
return False
|
|
|
|
# prepare system
|
|
if os.access('/usr/bin/qlist',os.X_OK):
|
|
os.system("""
|
|
qlist -e nvidia-drivers | xargs rm -rf
|
|
rm -rf /var/db/pkg/x11-drivers/nvidia-drivers-*
|
|
sed -i '/.*nvidia-drivers.*/d' /var/lib/portage/world
|
|
""")
|
|
else:
|
|
os.system("emerge -C nvidia-drivers &> /dev/null")
|
|
|
|
# remove old garbage - copy over - create module
|
|
os.system("""
|
|
rm /lib/modules/$(uname -r)/video/nvidia.ko -f
|
|
rm /lib/nvidia/* -rf
|
|
|
|
tar xjf """+package_file+""" -C / &> /dev/null
|
|
|
|
ld -m """+ld_arch+""" -r -o /lib/modules/$(uname -r)/video/nvidia.ko /lib/nvidia/nvidia.o /lib/nvidia/nvidia.mod.o
|
|
""")
|
|
# try to check driver status now
|
|
rc = check_if_proprietary_driver_system_is_healthy("nvidia")
|
|
return rc
|
|
else:
|
|
print "I was about to run deploy_nvidia_9xxxxx_drivers"
|
|
return False
|
|
|
|
|
|
def change_xorg_driver(xdriver):
|
|
if (not dryrun):
|
|
print "change X driver to "+xdriver
|
|
f = open(xorgfile,"r")
|
|
xorgconf = f.readlines()
|
|
f.close()
|
|
device = False
|
|
f = open(xorgfile,"w")
|
|
for line in xorgconf:
|
|
if (line.lower().find("section") != -1) and (line.lower().find("\"device\"") != -1):
|
|
device = True
|
|
if (line.lower().find("endsection") != -1):
|
|
device = False
|
|
if (device):
|
|
if (line.lower().find("driver") != -1):
|
|
# change line
|
|
line = ' Driver "'+xdriver+'"\n'
|
|
f.write(line)
|
|
f.flush()
|
|
f.close()
|
|
else:
|
|
print "I was about to change X driver to "+xdriver
|
|
|
|
def set_exa(exa = True):
|
|
if (not dryrun):
|
|
print "Enabling EXA"
|
|
f = open(xorgfile,"r")
|
|
xorgconf = f.readlines()
|
|
f.close()
|
|
device = False
|
|
f = open(xorgfile,"w")
|
|
for line in xorgconf:
|
|
if (line.lower().find("section") != -1) and (line.lower().find("\"device\"") != -1):
|
|
device = True
|
|
if (line.lower().find("endsection") != -1):
|
|
device = False
|
|
if (line.lower().find("accelmethod") != -1):
|
|
# skip line
|
|
continue
|
|
if (device) and (exa):
|
|
if (line.lower().find("driver") != -1):
|
|
# change line
|
|
line += ' Option "AccelMethod" "EXA"\n'
|
|
f.write(line)
|
|
f.flush()
|
|
f.close()
|
|
else:
|
|
print "I was about to change X driver to "+xdriver
|
|
|
|
def set_dri(status = True):
|
|
if (not dryrun):
|
|
if (status):
|
|
# enable
|
|
os.system('sed -i \'/"dri"/ s/#//\' '+xorgfile)
|
|
else:
|
|
# disable
|
|
os.system('sed -i \'/Load.*"dri"/ s/Load/#Load/\' '+xorgfile)
|
|
else:
|
|
print "I was about to set DRI to "+str(status)
|
|
|
|
def enable_forced_modes():
|
|
os.system('sed -i \'/Modes/ s/#//\' '+xorgfile)
|
|
|
|
def opengl_activate(profile):
|
|
if (not dryrun):
|
|
if (livecd):
|
|
os.system("opengl-activator "+profile+" &> /dev/null")
|
|
else:
|
|
os.system("eselect opengl set "+profile+" &> /dev/null")
|
|
else:
|
|
print "I was about to set opengl subsystem to: "+profile
|
|
|
|
def opengl_show():
|
|
if (livecd):
|
|
profile = commands.getoutput("opengl-activator show").split("\n")[0].strip()
|
|
else:
|
|
profile = commands.getoutput("eselect opengl show").split("\n")[0].strip()
|
|
return profile
|
|
|
|
def fix_possible_opengl_misconfiguration(profile):
|
|
# get current subsystem
|
|
current = opengl_show()
|
|
if (not dryrun):
|
|
if (profile in ("ati","nvidia","xorg-x11")) and (profile != current):
|
|
if profile == "ati" or profile == "nvidia":
|
|
os.system("""
|
|
umount /usr/lib/opengl/"""+profile+""" &> /dev/null
|
|
umount /usr/lib/opengl/"""+profile+""" &> /dev/null
|
|
""")
|
|
opengl_activate(profile)
|
|
else:
|
|
print "I was about to fix OpenGL subsystem to: "+profile+" while the current implementation is: "+current
|
|
|
|
def copy_nvidia_settings_on_desktop():
|
|
if os.path.isfile(nvidia_settings):
|
|
homes = os.listdir("/home")
|
|
homes = [x for x in homes if os.path.isdir("/home/"+x+"/Desktop")]
|
|
for home in homes:
|
|
try:
|
|
user = home
|
|
group = "users"
|
|
shutil.copy2(nvidia_settings,"/home/"+home+"/Desktop")
|
|
shutil.copystat(nvidia_settings,"/home/"+home+"/Desktop")
|
|
os.chown("/home/"+home+"/Desktop/"+os.path.basename(nvidia_settings),user,group)
|
|
except:
|
|
pass
|
|
|
|
def copy_ati_settings_on_desktop():
|
|
desktop_files = commands.getoutput('qlist -e ati-drivers | grep ".desktop"').split("\n")
|
|
desktop_files = [x for x in desktop_files if os.path.isfile(x)]
|
|
for ati_settings in desktop_files:
|
|
homes = os.listdir("/home")
|
|
homes = [x for x in homes if os.path.isdir("/home/"+x+"/Desktop")]
|
|
for home in homes:
|
|
try:
|
|
user = home
|
|
group = "users"
|
|
shutil.copy2(ati_settings,"/home/"+home+"/Desktop")
|
|
shutil.copystat(ati_settings,"/home/"+home+"/Desktop")
|
|
os.chown("/home/"+home+"/Desktop/"+os.path.basename(ati_settings),user,group)
|
|
except:
|
|
pass
|
|
|
|
def generate_nvidia_steps():
|
|
if check_if_proprietary_driver_system_is_healthy("nvidia"):
|
|
if (not noopengl):
|
|
steps.append(('fix_possible_opengl_misconfiguration','nvidia'))
|
|
steps.append(('copy_nvidia_settings_on_desktop',))
|
|
steps.append(('opengl_activate','nvidia'))
|
|
steps.append(('change_xorg_driver','nvidia'))
|
|
else:
|
|
if (livecd):
|
|
print "latest NVIDIA drivers couldn't be loaded, trying 9x.xx.xx drivers"
|
|
rc = deploy_nvidia_9xxxxx_drivers()
|
|
if (rc):
|
|
# then activate nvidia opengl subsystem after resetting it
|
|
steps.append(('opengl_activate','xorg-x11'))
|
|
steps.append(('opengl_activate','nvidia'))
|
|
os.makedirs("/lib/nvidia/legacy")
|
|
f = open("/lib/nvidia/legacy/running","w")
|
|
f.write("NVIDIA 9x.xx.xx\n")
|
|
f.flush()
|
|
f.close()
|
|
steps.append(('fix_possible_opengl_misconfiguration','nvidia'))
|
|
steps.append(('copy_nvidia_settings_on_desktop',))
|
|
else:
|
|
# it's a no-go!
|
|
print "NVIDIA drivers 9x.xx.xx failed to load too... sorry, switching to nv driver"
|
|
if (not noopengl):
|
|
steps.append(('opengl_activate','xorg-x11'))
|
|
steps.append(('change_xorg_driver','nv'))
|
|
else:
|
|
print "latest NVIDIA drivers couldn't be loaded, switchting to nv driver"
|
|
if (not noopengl):
|
|
steps.append(('opengl_activate','xorg-x11'))
|
|
steps.append(('change_xorg_driver','nv'))
|
|
|
|
def generate_generic_steps():
|
|
if (not noopengl):
|
|
steps.append(('set_dri',True))
|
|
steps.append(('remove_proprietary_opengl',))
|
|
steps.append(('opengl_activate','xorg-x11'))
|
|
|
|
### APPLICATION
|
|
|
|
# Create videocards list
|
|
videocards = lspci_output.split("\n")
|
|
|
|
# Run the program
|
|
cardnumber = 0
|
|
|
|
import re
|
|
# Intel
|
|
i740 = re.compile('.*intel.*74[0-9].*')
|
|
i810 = re.compile('.*Intel.*Corp.*')
|
|
# misc
|
|
silicon_motion = re.compile('.*silicon.*motion.*')
|
|
s3virge = re.compile('.*S3.*Virge.*')
|
|
# VIA
|
|
via = re.compile('.*VIA.*Tech.*')
|
|
unichrome = re.compile('.*via.*tech.*chrome.*')
|
|
# nVidia
|
|
nvidia = re.compile('.*nvidia corporation.*')
|
|
# ATi
|
|
ati = re.compile('.*ati.*technologies.*')
|
|
radeon_1x0 = re.compile('.*ati.*technologies.*r(v)?(s)?1[0-9][0-9].*')
|
|
radeon_2x0 = re.compile('.*ati.*technologies.*r(v)?(s)?2[0-9][0-9].*')
|
|
radeon_3x0 = re.compile('.*ati.*technologies.*r(v)?(s)?3[0-9][0-9].*')
|
|
radeon_4x0 = re.compile('.*ati.*technologies.*r(v)?(s)?4[0-9][0-9].*')
|
|
radeon_5x0 = re.compile('.*ati.*technologies.*r(v)?(s)?5[0-9][0-9].*')
|
|
radeon_6x0 = re.compile('.*ati.*technologies.*r(v)?(s)?6[0-9][0-9].*')
|
|
radeon_7xx0 = re.compile('.*ati.*technologies.*radeon.*7[0-9][0-9]0.*')
|
|
radeon_8xx0 = re.compile('.*ati.*technologies.*radeon.*8[0-9][0-9]0.*')
|
|
radeon_9xx0_free = re.compile('.*ati.*technologies.*radeon.*9[0-2][0-9]0.*')
|
|
radeon_9xx0_closed = re.compile('.*ati.*technologies.*radeon.*9[5-9][0-9]0.*')
|
|
radeon_Xxx0_closed = re.compile('.*ati.*technologies.*radeon.*x[0-9][0-9]0.*')
|
|
radeon_Xxxx0_closed = re.compile('.*ati.*technologies.*radeon.*x[0-9][0-9][0-9]0.*')
|
|
|
|
for videocard in videocards:
|
|
|
|
# setup card number
|
|
cardnumber += 1
|
|
print "Card Number: "+str(cardnumber)
|
|
|
|
steps = []
|
|
|
|
if forced_xdriver:
|
|
print "You have chosen to force X driver: "+forced_xdriver
|
|
if forced_xdriver == "fglrx":
|
|
if (not noopengl):
|
|
steps.append(('set_dri',True))
|
|
if check_if_proprietary_driver_system_is_healthy("fglrx"):
|
|
steps.append(('fix_possible_opengl_misconfiguration','ati'))
|
|
steps.append(('copy_ati_settings_on_desktop',))
|
|
steps.append(('opengl_activate','ati'))
|
|
else:
|
|
steps.append(('opengl_activate','xorg-x11'))
|
|
forced_xdriver = "radeon"
|
|
elif forced_xdriver == "nvidia":
|
|
generate_nvidia_steps()
|
|
elif forced_xdriver == "vesa":
|
|
steps.append(('enable_forced_modes',))
|
|
elif forced_xdriver == "sisusb":
|
|
steps.append(('set_dri',True))
|
|
steps.append(('remove_proprietary_opengl',))
|
|
else:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver',forced_xdriver))
|
|
else:
|
|
|
|
if os.path.isfile('/sys/module/sisusbvga'):
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','sisusb'))
|
|
print "SiS USB!"
|
|
|
|
elif videocard.lower().find('neomagic') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','neomagic'))
|
|
print "Neomagic!"
|
|
|
|
elif videocard.lower().find('mach64') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','ati'))
|
|
print "Mach64!"
|
|
|
|
elif videocard.lower().find('savage') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','savage'))
|
|
print "Savage!"
|
|
|
|
elif videocard.lower().find('virge') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','s3virge'))
|
|
print "Virge!"
|
|
|
|
elif videocard.lower().find('cyrix') != -1:
|
|
generate_generic_steps()
|
|
print "Cyrix!"
|
|
|
|
elif videocard.lower().find('i128') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','i128'))
|
|
print "i128!"
|
|
|
|
elif videocard.lower().find('rendition') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','rendition'))
|
|
print "Rendition!"
|
|
|
|
elif videocard.lower().find('tseng') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','tseng'))
|
|
print "Tseng!"
|
|
|
|
elif videocard.lower().find('3dfx interactive') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','tdfx'))
|
|
print "3Dfx!"
|
|
|
|
elif videocard.lower().find('trident') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','trident'))
|
|
print "Trident!"
|
|
|
|
elif videocard.lower().find('rage 128') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','r128'))
|
|
print "Rage128!"
|
|
|
|
elif videocard.find('Matrox') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','mga'))
|
|
print "Matrox!"
|
|
|
|
elif videocard.find('Cirrus') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','cirrus'))
|
|
print "Cirrus!"
|
|
|
|
elif videocard.find(' SiS ') != -1 or videocard.find('Silicon Integrated Systems') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','sis'))
|
|
print "SiS!"
|
|
|
|
elif videocard.lower().find('xgi') != -1 and videocard.find('Volari') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','sis'))
|
|
print "XGI Volari!"
|
|
|
|
elif videocard.find('VMWare') != -1 or videocard.find('VMware') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','vmware'))
|
|
print "VMware!"
|
|
|
|
elif i740.match(videocard.lower()):
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','i740'))
|
|
print "i740!"
|
|
|
|
elif s3virge.match(videocard):
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','s3virge'))
|
|
print "S3Virge!"
|
|
|
|
elif via.match(videocard):
|
|
generate_generic_steps()
|
|
if unichrome.match(videocard.lower()):
|
|
if check_if_driver_is_available('openchrome'):
|
|
steps.append(('change_xorg_driver','openchrome'))
|
|
else:
|
|
steps.append(('change_xorg_driver','via'))
|
|
print "UniChrome!"
|
|
else:
|
|
steps.append(('change_xorg_driver','via'))
|
|
print "VIA Tech!"
|
|
|
|
elif silicon_motion.match(videocard.lower()):
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','siliconmotion'))
|
|
print "Silicon Motion!"
|
|
|
|
elif i810.match(videocard): # non lower
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','i810'))
|
|
if (not noexa):
|
|
steps.append(('set_exa',))
|
|
print "Intel >= 810!"
|
|
|
|
elif videocard.lower().find('riva tnt') != -1:
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','nv'))
|
|
print "Riva TNT!"
|
|
|
|
elif nvidia.match(videocard.lower()):
|
|
generate_nvidia_steps()
|
|
print "NVIDIA!"
|
|
|
|
elif ati.match(videocard.lower()):
|
|
print "ATI Technologies"
|
|
if radeon_1x0.match(videocard.lower()) or radeon_2x0.match(videocard.lower()) or radeon_7xx0.match(videocard.lower()) or radeon_8xx0.match(videocard.lower()) or radeon_9xx0_free.match(videocard.lower()):
|
|
generate_generic_steps()
|
|
if (not noexa):
|
|
steps.append(('set_exa',))
|
|
steps.append(('change_xorg_driver','radeon'))
|
|
elif radeon_3x0.match(videocard.lower()) or radeon_4x0.match(videocard.lower()) or radeon_5x0.match(videocard.lower()) or radeon_6x0.match(videocard.lower()) or radeon_9xx0_closed.match(videocard.lower()) or radeon_Xxx0_closed.match(videocard.lower()) or radeon_Xxxx0_closed.match(videocard.lower()):
|
|
if (not noopengl):
|
|
steps.append(('set_dri',True))
|
|
steps.append(('fix_possible_opengl_misconfiguration','ati'))
|
|
steps.append(('copy_ati_settings_on_desktop',))
|
|
steps.append(('opengl_activate','ati'))
|
|
steps.append(('change_xorg_driver','fglrx'))
|
|
else:
|
|
print "ATTENTION !!!"
|
|
print "ATTENTION !!!"
|
|
print "ATTENTION !!!"
|
|
print "--> ATI Card undetected: "+videocard
|
|
print "SETTING OPEN SOURCE DRIVERS"
|
|
generate_generic_steps()
|
|
steps.append(('change_xorg_driver','radeon'))
|
|
if (not noexa):
|
|
steps.append(('set_exa',))
|
|
else:
|
|
print "ATTENTION !!!"
|
|
print "ATTENTION !!!"
|
|
print "ATTENTION !!!"
|
|
print "--> Video Card undetected: "+videocard
|
|
print "SETTING TO VESA"
|
|
print "Please report this output to Sabayon Linux developers or mail to LXNAY <at> SABAYONLINUX <dot> ORG"
|
|
|
|
# now run those steps
|
|
for step in steps:
|
|
if len(step) == 1:
|
|
eval(step[0])()
|
|
else:
|
|
param = step[1:][0]
|
|
eval(step[0])(param)
|