[pypy-svn] r70302 - in pypy/trunk/pypy: jit/backend/llsupport rpython/tool translator translator/c translator/c/test
arigo at codespeak.net
arigo at codespeak.net
Mon Dec 28 15:28:28 CET 2009
Author: arigo
Date: Mon Dec 28 15:28:27 2009
New Revision: 70302
Modified:
pypy/trunk/pypy/jit/backend/llsupport/gc.py
pypy/trunk/pypy/rpython/tool/rffi_platform.py
pypy/trunk/pypy/translator/c/gc.py
pypy/trunk/pypy/translator/c/test/test_boehm.py
pypy/trunk/pypy/translator/c/test/test_stackless.py
pypy/trunk/pypy/translator/driver.py
Log:
check_boehm() returned either an eci or None,
but None was not checked everywhere. Fix it
by renaming it to configure_boehm() and letting
the CompilationError go through.
Modified: pypy/trunk/pypy/jit/backend/llsupport/gc.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/llsupport/gc.py (original)
+++ pypy/trunk/pypy/jit/backend/llsupport/gc.py Mon Dec 28 15:28:27 2009
@@ -41,7 +41,7 @@
GcLLDescription.__init__(self, gcdescr, translator)
# grab a pointer to the Boehm 'malloc' function
from pypy.rpython.tool import rffi_platform
- compilation_info = rffi_platform.check_boehm()
+ compilation_info = rffi_platform.configure_boehm()
# Versions 6.x of libgc needs to use GC_local_malloc().
# Versions 7.x of libgc removed this function; GC_malloc() has
Modified: pypy/trunk/pypy/rpython/tool/rffi_platform.py
==============================================================================
--- pypy/trunk/pypy/rpython/tool/rffi_platform.py (original)
+++ pypy/trunk/pypy/rpython/tool/rffi_platform.py Mon Dec 28 15:28:27 2009
@@ -644,7 +644,7 @@
else:
raise CompilationError("Library %s is not installed" % (name,))
-def check_boehm(platform=None):
+def configure_boehm(platform=None):
if platform is None:
from pypy.translator.platform import platform
if sys.platform == 'win32':
@@ -658,13 +658,10 @@
includes=includes,
libraries=['gc'],
)
- try:
- return configure_external_library(
- 'gc', eci,
- [dict(prefix='gc-', include_dir='include', library_dir=library_dir)],
- symbol='GC_init')
- except CompilationError:
- return None
+ return configure_external_library(
+ 'gc', eci,
+ [dict(prefix='gc-', include_dir='include', library_dir=library_dir)],
+ symbol='GC_init')
if __name__ == '__main__':
doc = """Example:
Modified: pypy/trunk/pypy/translator/c/gc.py
==============================================================================
--- pypy/trunk/pypy/translator/c/gc.py (original)
+++ pypy/trunk/pypy/translator/c/gc.py Mon Dec 28 15:28:27 2009
@@ -215,8 +215,8 @@
def compilation_info(self):
eci = BasicGcPolicy.compilation_info(self)
- from pypy.rpython.tool.rffi_platform import check_boehm
- eci = eci.merge(check_boehm())
+ from pypy.rpython.tool.rffi_platform import configure_boehm
+ eci = eci.merge(configure_boehm())
pre_include_bits = []
if sys.platform == "linux2":
Modified: pypy/trunk/pypy/translator/c/test/test_boehm.py
==============================================================================
--- pypy/trunk/pypy/translator/c/test/test_boehm.py (original)
+++ pypy/trunk/pypy/translator/c/test/test_boehm.py Mon Dec 28 15:28:27 2009
@@ -3,12 +3,15 @@
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rpython.memory.test import snippet
-from pypy.rpython.tool.rffi_platform import check_boehm
from pypy.translator.c.genc import CExtModuleBuilder
from pypy import conftest
def setup_module(mod):
- if not check_boehm():
+ from pypy.rpython.tool.rffi_platform import configure_boehm
+ from pypy.translator.platform import CompilationError
+ try:
+ configure_boehm()
+ except CompilationError:
py.test.skip("Boehm GC not present")
class AbstractGCTestClass(object):
Modified: pypy/trunk/pypy/translator/c/test/test_stackless.py
==============================================================================
--- pypy/trunk/pypy/translator/c/test/test_stackless.py (original)
+++ pypy/trunk/pypy/translator/c/test/test_stackless.py Mon Dec 28 15:28:27 2009
@@ -20,8 +20,11 @@
import py
py.test.skip("stackless + refcounting doesn't work any more for now")
elif cls.gcpolicy == "boehm":
- from pypy.rpython.tool.rffi_platform import check_boehm
- if not check_boehm():
+ from pypy.rpython.tool.rffi_platform import configure_boehm
+ from pypy.translator.platform import CompilationError
+ try:
+ configure_boehm()
+ except CompilationError:
py.test.skip("Boehm GC not present")
def wrap_stackless_function(self, fn):
Modified: pypy/trunk/pypy/translator/driver.py
==============================================================================
--- pypy/trunk/pypy/translator/driver.py (original)
+++ pypy/trunk/pypy/translator/driver.py Mon Dec 28 15:28:27 2009
@@ -428,10 +428,13 @@
def possibly_check_for_boehm(self):
if self.config.translation.gc == "boehm":
- from pypy.rpython.tool.rffi_platform import check_boehm
- if not check_boehm(self.translator.platform):
+ from pypy.rpython.tool.rffi_platform import configure_boehm
+ from pypy.translator.platform import CompilationError
+ try:
+ configure_boehm(self.translator.platform)
+ except CompilationError, e:
i = 'Boehm GC not installed. Try e.g. "translate.py --gc=hybrid"'
- raise Exception(i)
+ raise Exception(str(e) + '\n' + i)
def task_database_c(self):
translator = self.translator
More information about the Pypy-commit
mailing list