Author: Wim Lavrijsen <wlavrij...@lbl.gov>
Branch: reflex-support
Changeset: r55490:304012893b6b
Date: 2012-06-07 15:34 -0700
http://bitbucket.org/pypy/pypy/changeset/304012893b6b/

Log:    use root-config, if available

diff --git a/pypy/module/cppyy/capi/cint_capi.py 
b/pypy/module/cppyy/capi/cint_capi.py
--- a/pypy/module/cppyy/capi/cint_capi.py
+++ b/pypy/module/cppyy/capi/cint_capi.py
@@ -11,8 +11,14 @@
 incpath = pkgpath.join("include")
 
 if os.environ.get("ROOTSYS"):
-    rootincpath = [os.path.join(os.environ["ROOTSYS"], "include")]
-    rootlibpath = [os.path.join(os.environ["ROOTSYS"], "lib")]
+    import commands
+    (stat, incdir) = commands.getstatusoutput("root-config --incdir")
+    if stat != 0:        # presumably Reflex-only
+        rootincpath = [os.path.join(os.environ["ROOTSYS"], "include")]
+        rootlibpath = [os.path.join(os.environ["ROOTSYS"], "lib64"), 
os.path.join(os.environ["ROOTSYS"], "lib")]
+    else:
+        rootincpath = [incdir]
+        rootlibpath = commands.getoutput("root-config --libdir").split()
 else:
     rootincpath = []
     rootlibpath = []
diff --git a/pypy/module/cppyy/capi/reflex_capi.py 
b/pypy/module/cppyy/capi/reflex_capi.py
--- a/pypy/module/cppyy/capi/reflex_capi.py
+++ b/pypy/module/cppyy/capi/reflex_capi.py
@@ -10,8 +10,14 @@
 incpath = pkgpath.join("include")
 
 if os.environ.get("ROOTSYS"):
-    rootincpath = [os.path.join(os.environ["ROOTSYS"], "include")]
-    rootlibpath = [os.path.join(os.environ["ROOTSYS"], "lib64"), 
os.path.join(os.environ["ROOTSYS"], "lib")]
+    import commands
+    (stat, incdir) = commands.getstatusoutput("root-config --incdir")
+    if stat != 0:        # presumably Reflex-only
+        rootincpath = [os.path.join(os.environ["ROOTSYS"], "include")]
+        rootlibpath = [os.path.join(os.environ["ROOTSYS"], "lib64"), 
os.path.join(os.environ["ROOTSYS"], "lib")]
+    else:
+        rootincpath = [incdir]
+        rootlibpath = commands.getoutput("root-config --libdir").split()
 else:
     rootincpath = []
     rootlibpath = []
diff --git a/pypy/module/cppyy/test/Makefile b/pypy/module/cppyy/test/Makefile
--- a/pypy/module/cppyy/test/Makefile
+++ b/pypy/module/cppyy/test/Makefile
@@ -10,7 +10,11 @@
   cppflags=
 else
   genreflex=$(ROOTSYS)/bin/genreflex
-  cppflags=-I$(ROOTSYS)/include -L$(ROOTSYS)/lib64 -L$(ROOTSYS)/lib
+  ifeq ($(wildcard $(ROOTSYS)/include),)     # standard locations used?
+    cppflags=-I$(shell root-config --incdir) -L$(shell root-config --libdir)
+  else
+    cppflags=-I$(ROOTSYS)/include -L$(ROOTSYS)/lib64 -L$(ROOTSYS)/lib
+  endif
 endif
 
 PLATFORM := $(shell uname -s)
@@ -32,6 +36,7 @@
 
 ifeq ($(CINT),)
 %Dict.so: %_rflx.cpp %.cxx
+       echo $(cppflags)
        g++ -o $@ $^ -shared -lReflex $(cppflags) $(cppflags2)
 
 %_rflx.cpp: %.h %.xml
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to