Move packages around so we can install packages into the sandbox.
This commit is contained in:
@@ -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
12
common/lib/calc/setup.py
Normal 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"
|
||||
],
|
||||
)
|
||||
@@ -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
13
common/lib/chem/setup.py
Normal 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",
|
||||
],
|
||||
)
|
||||
21
common/lib/codejail/README
Normal file
21
common/lib/codejail/README
Normal 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
|
||||
|
||||
|
||||
1
common/lib/sandbox-packages/README
Normal file
1
common/lib/sandbox-packages/README
Normal file
@@ -0,0 +1 @@
|
||||
This directory is in the Python path for sandboxed Python execution.
|
||||
17
common/lib/sandbox-packages/setup.py
Normal file
17
common/lib/sandbox-packages/setup.py
Normal 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",
|
||||
],
|
||||
)
|
||||
@@ -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
|
||||
|
||||
@@ -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
6
sandbox-requirements.txt
Normal 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
|
||||
Reference in New Issue
Block a user