Commit 7c498be6 by Ned Batchelder

Move packages around so we can install packages into the sandbox.

parent 70930c25
...@@ -12,7 +12,7 @@ from django.http import HttpResponse ...@@ -12,7 +12,7 @@ from django.http import HttpResponse
from django.shortcuts import redirect from django.shortcuts import redirect
from mitxmako.shortcuts import render_to_response, render_to_string from mitxmako.shortcuts import render_to_response, render_to_string
import capa.calc import calc
import track.views import track.views
...@@ -20,7 +20,7 @@ def calculate(request): ...@@ -20,7 +20,7 @@ def calculate(request):
''' Calculator in footer of every page. ''' ''' Calculator in footer of every page. '''
equation = request.GET['equation'] equation = request.GET['equation']
try: try:
result = capa.calc.evaluator({}, {}, equation) result = calc.evaluator({}, {}, equation)
except: except:
event = {'error': map(str, sys.exc_info()), event = {'error': map(str, sys.exc_info()),
'equation': equation} 'equation': equation}
......
from setuptools import setup
setup(
name="calc",
version="0.1",
py_modules=["calc"],
install_requires=[
"pyparsing==1.5.6",
"numpy",
"scipy"
],
)
...@@ -4,5 +4,5 @@ setup( ...@@ -4,5 +4,5 @@ setup(
name="capa", name="capa",
version="0.1", version="0.1",
packages=find_packages(exclude=["tests"]), packages=find_packages(exclude=["tests"]),
install_requires=['distribute==0.6.30', 'pyparsing==1.5.6'], install_requires=["distribute==0.6.34"],
) )
from setuptools import setup
setup(
name="chem",
version="0.1",
packages=["chem"],
install_requires=[
"pyparsing==1.5.6",
"numpy",
"scipy",
"nltk==2.0.4",
],
)
Choose a place for the virtualenv, call it <SANDENV>
Create a virtualenv:
virtualenv <SANDENV>
Install the sandbox requirements
Edit an AppArmor profile:
<SANDENV>/bin/python {
...
}
Parse the profiles
$ apparmor_parser
$ aaenforce <SANDENV>/bin/python
This directory is in the Python path for sandboxed Python execution.
from setuptools import setup
setup(
name="sandbox-packages",
version="0.1",
packages=[
"symmath",
"verifiers",
],
py_modules=[
"eia",
],
install_requires=[
# symmath needs:
"sympy", "requests", "lxml",
],
)
...@@ -14,7 +14,7 @@ import fs.osfs ...@@ -14,7 +14,7 @@ import fs.osfs
import numpy import numpy
import capa.calc as calc import calc
import xmodule import xmodule
from xmodule.x_module import ModuleSystem from xmodule.x_module import ModuleSystem
from mock import Mock from mock import Mock
......
# Python libraries to install that are local to the mitx repo # Python libraries to install that are local to the mitx repo
-e common/lib/calc
-e common/lib/capa -e common/lib/capa
-e common/lib/xmodule -e common/lib/chem
-e common/lib/codejail -e common/lib/codejail
-e common/lib/xmodule
-e . -e .
# Packages to install in the Python sandbox for secured execution.
numpy==1.6.2
scipy==0.11.0
-e common/lib/calc
-e common/lib/chem
-e common/lib/sandbox-packages
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment