[pypy-svn] r76018 - in pypy/branch/reflex-support/pypy/module/cppyy: . test

arigo at codespeak.net arigo at codespeak.net
Thu Jul 8 12:53:21 CEST 2010


Author: arigo
Date: Thu Jul  8 12:53:20 2010
New Revision: 76018

Modified:
   pypy/branch/reflex-support/pypy/module/cppyy/capi.py
   pypy/branch/reflex-support/pypy/module/cppyy/test/Makefile
   pypy/branch/reflex-support/pypy/module/cppyy/test/test_cppyy.py
Log:
Support two installations: either genreflex is installed,
or ROOT is in $ROOTSYS.


Modified: pypy/branch/reflex-support/pypy/module/cppyy/capi.py
==============================================================================
--- pypy/branch/reflex-support/pypy/module/cppyy/capi.py	(original)
+++ pypy/branch/reflex-support/pypy/module/cppyy/capi.py	Thu Jul  8 12:53:20 2010
@@ -6,18 +6,18 @@
 srcpath = py.path.local(__file__).dirpath().join("src")
 incpath = py.path.local(__file__).dirpath().join("include")
 
-try:
-   rootincpath = os.path.join(os.environ["ROOTSYS"], "include")
-   rootlibpath = os.path.join(os.environ["ROOTSYS"], "lib")
-except KeyError:
-   print 'please set ROOTSYS envar to the location of the ROOT installation'
-   raise
+if os.environ.get("ROOTSYS"):
+    rootincpath = [os.path.join(os.environ["ROOTSYS"], "include")]
+    rootlibpath = [os.path.join(os.environ["ROOTSYS"], "lib")]
+else:
+    rootincpath = []
+    rootlibpath = []
 
 eci = ExternalCompilationInfo(
     separate_module_files=[srcpath.join("reflexcwrapper.cxx")],
-    include_dirs=[incpath, rootincpath],
+    include_dirs=[incpath] + rootincpath,
     includes=["reflexcwrapper.h"],
-    library_dirs=[rootlibpath],
+    library_dirs=rootlibpath,
     libraries=["Reflex"],
     use_cpp_linker=True,
 )

Modified: pypy/branch/reflex-support/pypy/module/cppyy/test/Makefile
==============================================================================
--- pypy/branch/reflex-support/pypy/module/cppyy/test/Makefile	(original)
+++ pypy/branch/reflex-support/pypy/module/cppyy/test/Makefile	Thu Jul  8 12:53:20 2010
@@ -1,8 +1,13 @@
-LD_LIBRARY_PATH := ${LD_LIBRARY_PATH}:${ROOTSYS}/lib
 ROOTSYS := ${ROOTSYS}
 
-example01Dict.so: example01.cxx
-	echo $(ROOTSYS)
-	$(ROOTSYS)/bin/genreflex example01.cxx
-	g++ -o $@ example01_rflx.cpp -shared -I$(ROOTSYS)/include -L$(ROOTSYS)/lib -lReflex
+ifeq ($(ROOTSYS),)
+  genreflex=genreflex
+  cppflags=
+else
+  genreflex=$(ROOTSYS)/bin/genreflex
+  cppflags=-I$(ROOTSYS)/include -L$(ROOTSYS)/lib
+endif
 
+example01Dict.so: example01.cxx
+	$(genreflex) example01.cxx
+	g++ -o $@ example01_rflx.cpp -shared -lReflex $(cppflags)

Modified: pypy/branch/reflex-support/pypy/module/cppyy/test/test_cppyy.py
==============================================================================
--- pypy/branch/reflex-support/pypy/module/cppyy/test/test_cppyy.py	(original)
+++ pypy/branch/reflex-support/pypy/module/cppyy/test/test_cppyy.py	Thu Jul  8 12:53:20 2010
@@ -1,4 +1,4 @@
-import py, os
+import py, os, sys
 from pypy.conftest import gettestobjspace
 from pypy.module.cppyy import interp_cppyy, executor
 
@@ -9,7 +9,11 @@
 space = gettestobjspace(usemodules=['cppyy'])
 
 def setup_module(mod):
-    os.system("make")
+    if sys.platform == 'win32':
+        py.test.skip("win32 not supported so far")
+    err = os.system("cd '%s' && make" % currpath)
+    if err:
+        raise OSError("'make' failed (see stderr)")
 
 class TestCPPYYImplementation:
     def test_class_query(self):



More information about the Pypy-commit mailing list