make loading of R depend on environment variable USE_RLIBRARY
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2482 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
1e9418133b
commit
998cbf59cd
2 changed files with 16 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -21,8 +21,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import new
|
import os, re
|
||||||
import re
|
|
||||||
import compiler.pycodegen
|
import compiler.pycodegen
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
from persistent import Persistent
|
from persistent import Persistent
|
||||||
|
@ -37,13 +36,17 @@ from zope.security.untrustedpython.rcompile import RestrictionMutator as BaseRM
|
||||||
from zope.traversing.api import getParent, getPath
|
from zope.traversing.api import getParent, getPath
|
||||||
|
|
||||||
from cybertools.pyscript.interfaces import IPythonScript, IScriptContainer
|
from cybertools.pyscript.interfaces import IPythonScript, IScriptContainer
|
||||||
try:
|
|
||||||
#from cybertools.pyscript.rstat import r, rpy
|
HAS_R = use_R = bool(os.environ.get('USE_RLIBRARY', True))
|
||||||
import rpy
|
|
||||||
from rpy import r
|
if use_R:
|
||||||
HAS_R = True
|
try:
|
||||||
except ImportError:
|
#from cybertools.pyscript.rstat import r, rpy
|
||||||
HAS_R = False
|
import rpy
|
||||||
|
from rpy import r
|
||||||
|
HAS_R = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_R = False
|
||||||
|
|
||||||
|
|
||||||
unrestricted_objects = ('rpy', 'r', 'as_py', 'rstat')
|
unrestricted_objects = ('rpy', 'r', 'as_py', 'rstat')
|
||||||
|
|
|
@ -1,17 +1,6 @@
|
||||||
##############################################################################
|
"""Tests for pyscript
|
||||||
#
|
|
||||||
# Copyright (c) 2004 Zope Corporation and Contributors.
|
Based on Zope Python Page.
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# This software is subject to the provisions of the Zope Public License,
|
|
||||||
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
|
|
||||||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
|
|
||||||
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
"""Tests for Python Page
|
|
||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue