- append -O to python interpreter args for equo and spritz git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@2940 cd1c1023-2f26-0410-ae45-c471fc1f0318
49 lines
1.4 KiB
Python
Executable File
49 lines
1.4 KiB
Python
Executable File
#!/usr/bin/python -O
|
|
import sys, os
|
|
spritz_path = " python /usr/lib/entropy/spritz/spritz.py"
|
|
su_cmd = "xterm -e \"su -c '"+spritz_path+"'\""
|
|
if "--debug" in sys.argv:
|
|
os.environ['SPRITZ_DEBUG'] = "1"
|
|
sys.argv.remove("--debug")
|
|
|
|
def setup_env():
|
|
global spritz_path, su_cmd
|
|
pathenv = os.getenv("PATH")
|
|
if os.path.isfile("/etc/profile.env"):
|
|
f = open("/etc/profile.env")
|
|
env_file = f.readlines()
|
|
for line in env_file:
|
|
line = line.strip()
|
|
if line.startswith("export PATH='"):
|
|
line = line[len("export PATH='"):]
|
|
line = line.rstrip("'")
|
|
for path in line.split(":"):
|
|
pathenv += ":"+path
|
|
break
|
|
os.environ['PATH'] = pathenv
|
|
|
|
de_session = os.getenv('DESKTOP_SESSION')
|
|
if de_session == None: de_session = ''
|
|
path = os.getenv('PATH').split(":")
|
|
if de_session.find("kde") != -1:
|
|
for item in path:
|
|
itempath = os.path.join(item,'kdesu')
|
|
if os.access(itempath,os.X_OK):
|
|
su_cmd = itempath+spritz_path
|
|
break
|
|
else:
|
|
if os.access('/usr/bin/gksu',os.X_OK):
|
|
su_cmd = '/usr/bin/gksu'+spritz_path
|
|
|
|
|
|
|
|
setup_env()
|
|
tbz2s = [x for x in sys.argv[1:] if x.endswith(".tbz2")]
|
|
if tbz2s:
|
|
os.environ['SPRITZ_PACKAGES'] = ';'.join(tbz2s)
|
|
if os.getuid() == 0:
|
|
rc = os.system(spritz_path)
|
|
else:
|
|
rc = os.system(su_cmd)
|
|
raise SystemExit(rc)
|