Skip to content

Commit

Permalink
Try to install R package rgdal if unavailable.
Browse files Browse the repository at this point in the history
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@353 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
cpolymeris@gmail.com committed Aug 19, 2012
1 parent 6629230 commit 13e6dcb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/sextante/r/RAlgorithm.py
Expand Up @@ -227,6 +227,13 @@ def getExportCommands(self):

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

0 comments on commit 13e6dcb

Please sign in to comment.