[Sciviews-commits] r343 - komodo/SciViews-K/defaults

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 10 16:26:29 CET 2010


Author: prezez
Date: 2010-11-10 16:26:29 +0100 (Wed, 10 Nov 2010)
New Revision: 343

Modified:
   komodo/SciViews-K/defaults/svStart.R
Log:
svStart.R: installing the packages in a right order (fixes dependency errors in a clean R installation)

Modified: komodo/SciViews-K/defaults/svStart.R
===================================================================
--- komodo/SciViews-K/defaults/svStart.R	2010-11-10 12:09:44 UTC (rev 342)
+++ komodo/SciViews-K/defaults/svStart.R	2010-11-10 15:26:29 UTC (rev 343)
@@ -3,8 +3,7 @@
 ## Version 0.9.11, 2010-02-09 Ph. Grosjean (phgrosjean at sciviews.org)
 ## Version 0.9.15, 2010-05-01 mod by K. Barton
 ## Version 0.9.19, 2010-10-03 mod by Ph. Grosjean
-## Version 0.9.20, 2010-10-11 mod by K. Barton
-## Version 0.9.21, 2010-11-10 mod by K. Barton
+## Version 0.9.20, 2010-11-10 mod by K. Barton
 
 ## TODO: also use value in koDebug to debug server from within R!
 
@@ -18,17 +17,19 @@
 pkgsDontLoad = c("codetools", "svTools"),
 skip = NULL)
 {
+	# Note (KB): it would make life a way easier to put all (and only)
+	# the necessary routines in a SINGLE package.
+
 	## Needed later for tryCatch'ing:
 	err.null <- function (e) return(NULL)
-
+	
 	## If minVersion is not provided, get it from packages in 'default' directory
 	pkg.extpat <- switch(.Platform$pkgType, win.binary = "zip", "tar\\.gz")
 	pkgFiles <- dir(pkg.dir, pattern = paste("^.*_[0-9\\.\\-]+\\.", pkg.extpat,
 											"$", sep=""))
-
 	if (all(is.na(minVersion))) {
-		#minVersion <- structure(gsub(sprintf("(^[a-zA-Z]+_|\\.%s$)",
-			#pkg.extpat), "", pkgFiles), names = gsub("_.*$", "", pkgFiles))
+		minVersion <- structure(gsub(sprintf("(^[a-zA-Z]+_|\\.%s$)",
+			pkg.extpat), "", pkgFiles), names = gsub("_.*$", "", pkgFiles))
 
 		minVersion <- package_version(gsub(sprintf("(^[a-zA-Z]+_|\\.%s$)",
 			pkg.extpat), "", pkgFiles))
@@ -40,12 +41,16 @@
 		names(minVersion) <- names(v)
 	}
 	pkgs <- names(minVersion)
-
+	
 	i.skip <- !(pkgs %in% skip)
 	pkgs <- pkgs[i.skip]
 	minVersion <- minVersion[i.skip]
 	pkgFiles <- pkgFiles[i.skip]
 
+	
+	# Needed because of dependency errors during a fresh installation...
+	pkgs <- pkgs[order(match(pkgs, c("svMisc", "svSocket","svGUI")))]
+
 	## TODO: if R crashes before this code is done, 00LOCK remains and it is not
 	## possible to initiate SciViews extensions any more! => use a different
 	## mechanism (perhaps, a file in /tmp and/or make sure the 00LOCK file
@@ -261,7 +266,7 @@
 				i <- order(package_version(pkgVersion), decreasing = TRUE)[1]
 				pkgFile <-  pkgFile[i]
 				pkgVersion <-  pkgVersion[i]
-
+				
 				## For some reasons (bug probably?) I cannot install a package
 				## in R 2.10.1 under Mac OS X when the path to the package has
 				## spaces. Also, correct a bug here when installing package
@@ -310,7 +315,7 @@
 
 		## Determine which packages we don't want to load
 		pkgs <- pkgs[!(pkgs %in% pkgsDontLoad)]
-
+		
 		## Split pkgs to primary and secondary
 		pkgsPrimary <- pkgs[!(pkgs %in% pkgsLast)]
 		pkgsSecondary <- pkgs[pkgs %in% pkgsLast]
@@ -345,12 +350,12 @@
 						res <- !inherits(try(startHttpServer(port =
 							getOption("ko.serve")), silent = TRUE), "try-error")
 					} else res <- TRUE
-
+					
 					if (!all(res)) {
 						cat("Impossible to start the SciViews R HTTP server\n(port",
 							getOption("ko.serve"), "already in use?)\n")
 						cat("Solve the problem, then type: require(svGUI)\n")
-						cat("or choose a different port for the server in Komodo\n")
+						cat("or choose a different port for the server in Komodo\n")						
 					} else {
 						cat("R is SciViews ready!\n")
 						assignTemp(".SciViewsReady", TRUE)
@@ -491,13 +496,13 @@
 		## Record the home page for the help server in an option
 		options(helphome = paste("http://127.0.0.1:", tools:::httpdPort,
 				"/doc/html/index.html", sep = ""))
-
+		
 		## I need to get the help file URL, but help() does not provide it any
 		## more! This is a temporary workaround for this problem
 		assignTemp("getHelpURL", function (x, ...) {
 			file <- as.character(x)
 			if (length(file) == 0) return("")
-			## Extension ".html" may be missing
+			## Extension ".html" may be missing 
 			htmlfile <- basename(file)
 			if (length(file) > 1) {
 				## If more then one topic is found
@@ -608,10 +613,10 @@
 			sep = ";"))
 		)
 	}
-
+	
 	## Do we have a .Rprofile file to source?
 	if (file.exists(".Rprofile")) source(".Rprofile")
-
+	
 	return(invisible(res))
 }
 ### SciViews install end ###



More information about the Sciviews-commits mailing list