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

This commit is contained in:
Ned Batchelder
2013-02-19 11:07:11 -05:00
parent 70930c25c1
commit 7c498be606
24 changed files with 77 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ from django.http import HttpResponse
from django.shortcuts import redirect
from mitxmako.shortcuts import render_to_response, render_to_string
import capa.calc
import calc
import track.views
@@ -20,7 +20,7 @@ def calculate(request):
''' Calculator in footer of every page. '''
equation = request.GET['equation']
try:
result = capa.calc.evaluator({}, {}, equation)
result = calc.evaluator({}, {}, equation)
except:
event = {'error': map(str, sys.exc_info()),
'equation': equation}

12
common/lib/calc/setup.py Normal file
View File

@@ -0,0 +1,12 @@
from setuptools import setup
setup(
name="calc",
version="0.1",
py_modules=["calc"],
install_requires=[
"pyparsing==1.5.6",
"numpy",
"scipy"
],
)

View File

@@ -4,5 +4,5 @@ setup(
name="capa",
version="0.1",
packages=find_packages(exclude=["tests"]),
install_requires=['distribute==0.6.30', 'pyparsing==1.5.6'],
install_requires=["distribute==0.6.34"],
)

13
common/lib/chem/setup.py Normal file
View File

@@ -0,0 +1,13 @@
from setuptools import setup
setup(
name="chem",
version="0.1",
packages=["chem"],
install_requires=[
"pyparsing==1.5.6",
"numpy",
"scipy",
"nltk==2.0.4",
],
)

View File

@@ -0,0 +1,21 @@
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

View File

@@ -0,0 +1 @@
This directory is in the Python path for sandboxed Python execution.

View File

@@ -0,0 +1,17 @@
from setuptools import setup
setup(
name="sandbox-packages",
version="0.1",
packages=[
"symmath",
"verifiers",
],
py_modules=[
"eia",
],
install_requires=[
# symmath needs:
"sympy", "requests", "lxml",
],
)

View File

@@ -14,7 +14,7 @@ import fs.osfs
import numpy
import capa.calc as calc
import calc
import xmodule
from xmodule.x_module import ModuleSystem
from mock import Mock

View File

@@ -1,5 +1,7 @@
# Python libraries to install that are local to the mitx repo
-e common/lib/calc
-e common/lib/capa
-e common/lib/xmodule
-e common/lib/chem
-e common/lib/codejail
-e common/lib/xmodule
-e .

6
sandbox-requirements.txt Normal file
View File

@@ -0,0 +1,6 @@
# 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