40 lines
1.4 KiB
Python
Executable File
40 lines
1.4 KiB
Python
Executable File
#!/usr/bin/python3
|
|
|
|
from subprocess import call
|
|
from sys import argv, platform, exit, stderr
|
|
from os import environ, chdir
|
|
import shlex
|
|
import subprocess
|
|
|
|
if __name__ == '__main__':
|
|
r = {environ.get('PATH')}
|
|
setup_path = {
|
|
'darwin': '/Applications/Houdini/Houdini17.5.173/Frameworks/Houdini.framework/Versions/Current/Resources',
|
|
'linux': '/opt/hfs17.5.229',
|
|
}
|
|
if platform not in setup_path:
|
|
print('Platform `{}` not supported... yet.', file=stderr)
|
|
exit(1)
|
|
chdir(setup_path[platform])
|
|
if '-r3' in argv:
|
|
redshift_path = '/opt/redshift3'
|
|
else:
|
|
redshift_path = '/opt/redshift'
|
|
environ.update({
|
|
'HOUDINI_NO_SPLASH': '1',
|
|
'HOUDINI_DSO_ERROR': '2',
|
|
'PATH': ':'.join(['{}/bin'.format(redshift_path),
|
|
environ.get('PATH')]),
|
|
'HOUDINI_PATH': '{}/redshift4houdini/17.5.173;&'.format(redshift_path),
|
|
'REDSHIFT_COREDATAPATH': '{}'.format(redshift_path),
|
|
})
|
|
command = shlex.split("env -i sh -c '. houdini_setup >/dev/null && env'")
|
|
proc = subprocess.Popen(command, stdout=subprocess.PIPE,
|
|
universal_newlines=True)
|
|
for line in proc.stdout:
|
|
(key, _, value) = str(line.strip()).partition('=')
|
|
environ[key] = value
|
|
print(key, '=', value)
|
|
proc.communicate()
|
|
call(['./bin/houdini'], env=environ)
|