I've run the rpython translate to create a pypy sandbox.
~/pypy-2.3.1-linux64/bin/pypy ../../rpython/bin/rpython -O2 --sandbox targetpypystandalone
There are a few warnings, two which seem to involve time.
[sandbox:WARNING] Not Implemented: sandboxing for external function 'clock_gettime' [sandbox:WARNING] Not Implemented: sandboxing for external function 'clock_getres'
The long and short of it is while the translate finishes, the following output occurs when I run the sandbox:
'import site' failed
Python 2.7.6 (32f35069a16d819b58c1b6efb17c44e3e53397b2, Jun 11 2014, 19:06:04)
[PyPy 2.3.1 with GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>>
And then import time fails as well:
>>>> import time
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named time
>>>>
Is this expected behavior for the sandbox? If so, what's the proper practice to embed site-packages and the like within a sandboxed process? I was hoping to use pip to install in that env, but the sandboxing seems to make it very difficult. (basically I run up against import time when I attempt to install distribute.py, as it requires datetime which requires time)
Just went through the same issue. The solution is to include time
module when building the pypy-c
sandbox. In these instructions, add --withmod-time
when building:
pypy ../../rpython/bin/rpython -O2 --sandbox targetpypystandalone --withmod-time
Other possible flags are listed here: http://pypy.readthedocs.org/en/latest/config/commandline.html