Revision: 535
http://rpy.svn.sourceforge.net/rpy/?rev=535&view=rev
Author: lgautier
Date: 2008-05-27 21:38:57 -0700 (Tue, 27 May 2008)
Log Message:
-----------
Dropped the one python-C module per R version approach
(dynamic linking... it should just not matter).
Modified Paths:
--------------
branches/rpy_nextgen/rpy/rinterface/__init__.py
branches/rpy_nextgen/setup.py
Modified: branches/rpy_nextgen/rpy/rinterface/__init__.py
===================================================================
--- branches/rpy_nextgen/rpy/rinterface/__init__.py 2008-05-26 18:23:07 UTC
(rev 534)
+++ branches/rpy_nextgen/rpy/rinterface/__init__.py 2008-05-28 04:38:57 UTC
(rev 535)
@@ -1,25 +1,5 @@
-import os, sys, re
+import os, sys
-def get_rversion(R_HOME):
- r_exec = os.path.join(R_HOME, 'bin', 'R')
- # Twist if Win32
- if sys.platform == "win32":
- rp = os.popen3('"'+r_exec+'" --version')[2]
- else:
- rp = os.popen('"'+r_exec+'" --version')
- rversion = rp.readline()
- #Twist if 'R RHOME' spits out a warning
- if rversion.startswith("WARNING"):
- rversion = rp.readline()
- m = re.match('^R version ([^ ]+) .+$', rversion)
- if m is None:
- raise Exception("Error running 'R --version':\n" + rversion)
- rversion = m.groups()[0]
- rversion = rversion.split('.')
- rversion[0] = int(rversion[0])
- rversion[1] = int(rversion[1])
- return rversion
-
try:
R_HOME = os.environ["R_HOME"]
except KeyError:
@@ -31,16 +11,10 @@
R_HOME = R_HOME[1]
else:
R_HOME = R_HOME[0]
+ R_HOME = R_HOME.strip()
+ os.environ['R_HOME'] = R_HOME
-rversion = get_rversion(R_HOME)
-r_packversion = '%i%02i%s' %(rversion[0], rversion[1], rversion[2])
-rinterface_package = 'rpy2.rinterface.rinterface_' + r_packversion
-
-
-
# Win32-specific code copied from RPy-1.x
-# FIXME: isnt't it possible to have conditional code
-# at build time ?
if sys.platform == 'win32':
import win32api
os.environ['PATH'] += ';' + os.path.join(R_HOME, 'bin')
@@ -59,16 +33,7 @@
win32api.LoadLibrary( Rlib )
-#sys.path.insert(0, os.path.join(os.path.dirname(__file__),
-# 'rinterface_' + r_packversion))
-#print(sys.path[0])
-
-del(re)
-del(os)
del(sys)
-del(rversion)
-del(r_packversion)
+from rpy2.rinterface.rinterface import *
-rinterface = __import__(rinterface_package)
-
Modified: branches/rpy_nextgen/setup.py
===================================================================
--- branches/rpy_nextgen/setup.py 2008-05-26 18:23:07 UTC (rev 534)
+++ branches/rpy_nextgen/setup.py 2008-05-28 04:38:57 UTC (rev 535)
@@ -47,7 +47,6 @@
rversion[1] = int(rversion[1])
return rversion
-# FIXME: not neeeded anymore ?
def cmp_version(x, y):
if (x[0] < y[0]):
return -1
@@ -67,14 +66,18 @@
if rconfig.startswith("WARNING"):
rconfig = rp.readline()
rconfig = rconfig.strip()
- rconfig = re.match('^(-L.+) (-l.+)$', rconfig).groups()
- return rconfig
+ rconfig_m = re.match('^(-L.+) (-l.+)$', rconfig)
+ if rconfig_m is None:
+ raise Exception(cmd + '\nreturned\n' + rconfig)
+ return rconfig_m.groups()
rnewest = [0, 0, 0]
rversions = []
for RHOME in RHOMES:
RHOME = RHOME.strip()
rversion = get_rversion(RHOME)
+ if cmp_version(rversion[:2], [2, 7]) == -1:
+ raise Exception("R >= 2.7 required.")
rversions.append(rversion)
def getRinterface_ext(RHOME, r_packversion):
@@ -94,14 +97,14 @@
#f_out.close()
rinterface_ext = Extension(
- pack_name + ".rinterface.rinterface_" + r_packversion,
+ pack_name + '.rinterface.rinterface',
[os.path.join('rpy', 'rinterface', 'array.c'),
os.path.join('rpy', 'rinterface', 'rinterface.c')],
include_dirs = [ os.path.join(RHOME, 'include'),
os.path.join('rpy', 'rinterface')],
libraries = ['R', 'Rlapack', 'Rblas'],
library_dirs = r_libs,
- define_macros = [('RPY_RINTERFACE_INIT', 'initrinterface_' +
r_packversion), ],
+ #define_macros = [('RPY_RINTERFACE_INIT', 'initrinterface_' +
r_packversion), ],
runtime_library_dirs = r_libs,
extra_link_args = get_rconfig(RHOME, '--ldflags') +\
get_rconfig(RHOME, 'LAPACK_LIBS') +\
@@ -123,13 +126,15 @@
rinterface_exts.append(ri_ext)
rinterface_rversions.append(r_packversion)
+pack_dir = {pack_name: 'rpy'}
+
setup(name = "rpython",
version = pack_version,
description = "Python interface to the R language",
url = "http://rpy.sourceforge.net",
license = "(L)GPL",
ext_modules = rinterface_exts,
- package_dir = {pack_name: 'rpy'},
+ package_dir = pack_dir,
packages = [pack_name,
pack_name+'.robjects',
pack_name+'.robjects.tests'] + \
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list