Revision: 527
          http://rpy.svn.sourceforge.net/rpy/?rev=527&view=rev
Author:   lgautier
Date:     2008-05-21 12:54:11 -0700 (Wed, 21 May 2008)

Log Message:
-----------
With code gotten from RPy-1.x, it now seems to roughly work on Win32

Modified Paths:
--------------
    branches/rpy_nextgen/rpy/rinterface/__init__.py.in

Modified: branches/rpy_nextgen/rpy/rinterface/__init__.py.in
===================================================================
--- branches/rpy_nextgen/rpy/rinterface/__init__.py.in  2008-05-21 19:30:30 UTC 
(rev 526)
+++ branches/rpy_nextgen/rpy/rinterface/__init__.py.in  2008-05-21 19:54:11 UTC 
(rev 527)
@@ -1,4 +1,28 @@
 import os
 os.environ["R_HOME"]="%R_HOME%"
 
+# Win32-specific code copied from RPy-1.x
+# FIXME: isnt't it possible to have conditional code
+# at build time ?
+import sys
+if sys.platform == 'win32':
+    import win32api
+    R_HOME = os.environ["R_HOME"]
+    os.environ['PATH'] += ';' + os.path.join(R_HOME, 'bin')
+    os.environ['PATH'] += ';' + os.path.join(R_HOME, 'modules')
+    os.environ['PATH'] += ';' + os.path.join(R_HOME, 'lib')
+
+    # Load the R dll using the explicit path
+    # First try the bin dir:
+    Rlib = os.path.join(R_HOME, 'bin', 'R.dll')
+    # Then the lib dir:
+    if not os.path.exists(Rlib):
+        Rlib = os.path.join(R_HOME, 'lib', 'R.dll')
+    # Otherwise fail out!
+    if not os.path.exists(Rlib):
+        raise RuntimeError("Unable to locate R.dll within %s" % R_HOME)
+
+    win32api.LoadLibrary( Rlib )
+    del(R_HOME)
+    
 from rinterface import *


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to