/usr/lib/python2.7/dist-packages/rpy_wintools.py is in python-rpy 1.0.3-30.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # <license/>
import os, os.path, sys, shutil
import rpy_tools
def get_RHOMES():
# Standard R
Rhomes = get_RHOMES_inner("R")
# RStat, commercially packaged R from Random Technologies LLC
Rhomes.extend( get_RHOMES_inner("RStat") )
if os.environ.get('RHOME', None):
Rhomes.insert(0, os.environ.get('RHOME', None))
return Rhomes
def get_RHOMES_inner(progname="R"):
from win32com.shell import shell, shellcon
program_files = shell.SHGetFolderPath(0,
shellcon.CSIDL_PROGRAM_FILES,
0,
0)
Rdir = os.path.join(program_files, progname)
Rhomes = []
if os.path.exists(Rdir):
RVersionDirs = os.listdir(Rdir)
for thisRVersionDir in RVersionDirs:
BasePath = os.path.join(Rdir, thisRVersionDir)
DLLPath1 = os.path.join(BasePath, "bin", "R.dll" )
DLLPath2 = os.path.join(BasePath, "lib", "R.dll" )
if os.path.exists(DLLPath1) or os.path.exists(DLLPath2):
Rhomes.append( BasePath )
return Rhomes
if __name__ == '__main__':
RHomes = get_RHOMES()
print "Found", len(RHomes), " R Installations:"
for path in RHomes:
print " ", path
print
|