diff scripts/pkg/pkg.m @ 8900:63ad1133d0ed

fix & simplify fix_depends pkg.m
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 02 Mar 2009 13:00:59 +0100
parents 2c8b2399247b
children eb63fbe60fab
line wrap: on
line diff
--- a/scripts/pkg/pkg.m	Mon Mar 02 12:12:29 2009 +0100
+++ b/scripts/pkg/pkg.m	Mon Mar 02 13:00:59 2009 +0100
@@ -1696,23 +1696,16 @@
     if (length (lpar) == 1 && length (rpar) == 1)
       package = tolower (strip (dep(1:lpar-1)));
       sub = dep(lpar(1)+1:rpar(1)-1);
-      parts = split_by (sub, " ");
-      idx = [];
-      for r = 1:size (parts, 1)
-	if (length (parts{r}) > 0)
-	  idx(end+1) = r;
-	endif
-      endfor
-
-      if (length (idx) != 2)
+      parts = strsplit (sub, " ", true);
+      if (length (parts) != 2)
 	error ("incorrect syntax for dependency `%s' in the DESCRIPTION file\n",
 	       dep);
       endif
-      operator = parts{idx(1)};
+      operator = parts{1};
       if (! any (strcmp (operator, {">", ">=", "<=", "<", "=="})))
 	error ("unsupported operator: %s", operator);
       endif
-      version  = fix_version (parts{idx(2)});
+      version  = fix_version (parts{2});
 
   ## If no version is specified for the dependency
   ## we say that the version should be greater than