30 lines
903 B
Python
Executable file
30 lines
903 B
Python
Executable file
#!/usr/bin/env python
|
|
|
|
import os
|
|
import sys
|
|
|
|
|
|
def get_functions():
|
|
ns = {}
|
|
fn = os.path.join(os.path.dirname(__file__), 'wscript')
|
|
with open(fn) as f:
|
|
code = compile(f.read(), fn, 'exec')
|
|
eval(code, ns, ns)
|
|
return ns
|
|
|
|
if __name__ == '__main__':
|
|
if os.geteuid() != 0:
|
|
print("Not running as root. Elevating...")
|
|
args = ['sudo', sys.executable] + sys.argv + [os.environ]
|
|
os.execlpe('sudo', *args)
|
|
elif input("Are you sure you want to install (allthethings)? [Y/N]: ").lower() == 'y':
|
|
os.system('./install-waf.sh')
|
|
waf_scripts = []
|
|
for key, func in get_functions().items():
|
|
if type(func).__name__ == 'function':
|
|
waf_scripts.append(key)
|
|
|
|
for func in waf_scripts:
|
|
cmd = "waf {}".format(func)
|
|
print("Running {}".format(cmd))
|
|
os.system("sudo " + cmd)
|