Skip to content

Commit 13e6dcb

Browse files
author
cpolymeris@gmail.com
committedAug 19, 2012
Try to install R package rgdal if unavailable.
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@353 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
1 parent 6629230 commit 13e6dcb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎src/sextante/r/RAlgorithm.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,13 @@ def getExportCommands(self):
227227

228228
def getImportCommands(self):
229229
commands = []
230+
# if rgdal is not available, try to install it
231+
# just use US mirror
232+
commands.append('options("repos"="http://cran.us.r-project.org")')
233+
rLibDir = "%s/rlibs" % SextanteUtils.userFolder()
234+
if not os.path.isdir(rLibDir): os.mkdir(rLibDir)
235+
commands.append(
236+
'tryCatch(find.package("rgdal"), error=function(e) install.packages("rgdal", lib="%s"))' % rLibDir)
230237
commands.append("library(\"rgdal\")");
231238
for param in self.parameters:
232239
if isinstance(param, ParameterRaster):

0 commit comments

Comments
 (0)
Please sign in to comment.