diff options
author | Jayaram R Pai | 2014-09-10 17:33:49 +0530 |
---|---|---|
committer | Jayaram R Pai | 2014-09-10 17:33:49 +0530 |
commit | 4caaa04f8760beaa9c5947875fc16d49600ba8db (patch) | |
tree | 5251d4191e52f876ed57b7716d842e1ae145f025 /website | |
parent | bd7345a7f9fe0818071133c6ce752a163a60b9e8 (diff) | |
download | scilab-on-cloud-4caaa04f8760beaa9c5947875fc16d49600ba8db.tar.gz scilab-on-cloud-4caaa04f8760beaa9c5947875fc16d49600ba8db.tar.bz2 scilab-on-cloud-4caaa04f8760beaa9c5947875fc16d49600ba8db.zip |
changed config vars
Diffstat (limited to 'website')
-rw-r--r-- | website/helpers.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/website/helpers.py b/website/helpers.py index e11cfb3..d5a5a62 100644 --- a/website/helpers.py +++ b/website/helpers.py @@ -2,6 +2,7 @@ import os, re, sys, time, subprocess from soc.settings import PROJECT_DIR from timeout import TimerTask +from soc.config import SCILAB_BIN, SCIMAX_LOADER, UPLOADS_PATH def scilab_run(code, token, book_id, dependency_exists): #Check for system commands @@ -30,7 +31,7 @@ def scilab_run(code, token, book_id, dependency_exists): #Check whether to load scimax / maxima if 'syms' in code or 'Syms' in code: code = code.replace('syms', 'Syms') - code = 'exec(\'/home/cheese/scimax/loader.sce\');\nmaxinit\n' + code + code = 'exec(\'{0}\');\nmaxinit\n'.format(SCIMAX_LOADER) + code file_path = PROJECT_DIR + '/static/tmp/' + token + '.sci' @@ -38,7 +39,9 @@ def scilab_run(code, token, book_id, dependency_exists): f = open(file_path, "w") f.write('mode(2);\n') if dependency_exists: - f.write('getd("/var/www/scilab_in/uploads/{0}/DEPENDENCIES/");'.format(book_id)) + f.write( + 'getd("{0}/{1}/DEPENDENCIES/");'.format(UPLOADS_PATH, book_id) + ) f.write('lines(0);\n') f.write(unicode(code)) f.write('\nquit();') @@ -47,7 +50,7 @@ def scilab_run(code, token, book_id, dependency_exists): #this makes it possible to execute scilab without the problem of \ #getting stuck in the prompt in case of error cmd = 'printf "exec(\'{0}\',2);\nquit();"'.format(file_path) - cmd += ' | /home/cheese/scilab-5.4.1/bin/scilab-adv-cli -nw' + cmd += ' | {0} -nw'.format(SCILAB_BIN) task = TimerTask(cmd, timeout=15) output = task.run().communicate()[0] |