comparison scripts/pkg/pkg.m @ 15000:4c8ddf57fcda

remove redundant private function absolute_pathname * scripts/pkg/pkg.m: remove calls to absolute_pathname * scripts/pkg/private/build.m: remove call to absolute_pathname * scripts/pkg/module.mk: remove absolute_pathname * scripts/pkg/private/absolute_pathname.m: remove file
author Carlo de Falco <cdf@users.sourceforge.net>
date Thu, 19 Jul 2012 21:28:00 +0200
parents e027f98403c3
children 3691a606283e
comparison
equal deleted inserted replaced
14876:54a386f2ac4e 15000:4c8ddf57fcda
419 elseif (length (files) == 0 && nargout >= 1) 419 elseif (length (files) == 0 && nargout >= 1)
420 local_packages = prefix; 420 local_packages = prefix;
421 global_packages = archprefix; 421 global_packages = archprefix;
422 elseif (length (files) >= 1 && nargout <= 2 && ischar (files{1})) 422 elseif (length (files) >= 1 && nargout <= 2 && ischar (files{1}))
423 prefix = files{1}; 423 prefix = files{1};
424 try 424 if (! exist (prefix, "dir"))
425 prefix = absolute_pathname (prefix);
426 catch
427 [status, msg, msgid] = mkdir (prefix); 425 [status, msg, msgid] = mkdir (prefix);
428 if (status == 0) 426 if (status == 0)
429 error("cannot create prefix %s: %s", prefix, msg); 427 error("cannot create prefix %s: %s", prefix, msg);
430 endif 428 endif
431 warning ("creating the directory %s\n", prefix); 429 warning ("creating the directory %s\n", prefix);
432 prefix = absolute_pathname (prefix); 430 endif
433 end_try_catch 431 local_packages = prefix = canonicalize_filename (prefix);
434 prefix = absolute_pathname (prefix);
435 local_packages = prefix;
436 user_prefix = true; 432 user_prefix = true;
437 if (length (files) >= 2 && ischar (files{2})) 433 if (length (files) >= 2 && ischar (files{2}))
438 archprefix = files{2}; 434 archprefix = files{2};
439 try 435 if (! exist (archprefix, "dir"))
440 archprefix = absolute_pathname (archprefix);
441 catch
442 [status, msg, msgid] = mkdir (archprefix); 436 [status, msg, msgid] = mkdir (archprefix);
443 if (status == 0) 437 if (status == 0)
444 error("cannot create archprefix %s: %s", archprefix, msg); 438 error("cannot create archprefix %s: %s", archprefix, msg);
445 endif 439 endif
446 warning ("creating the directory %s\n", archprefix); 440 warning ("creating the directory %s\n", archprefix);
447 archprefix = absolute_pathname (archprefix); 441 global_packages = archprefix = canonicalize_file_name (archprefix);
448 end_try_catch 442 endif
449 global_packages = archprefix;
450 endif 443 endif
451 else 444 else
452 error ("you must specify a prefix directory, or request an output argument"); 445 error ("you must specify a prefix directory, or request an output argument");
453 endif 446 endif
454 447
455 case "local_list" 448 case "local_list"
456 if (length (files) == 0 && nargout == 0) 449 if (length (files) == 0 && nargout == 0)
457 disp (local_list); 450 disp (local_list);
458 elseif (length (files) == 0 && nargout == 1) 451 elseif (length (files) == 0 && nargout == 1)
459 local_packages = local_list; 452 local_packages = local_list;
460 elseif (length (files) == 1 && nargout == 0 && ischar (files{1})) 453 elseif (length (files) == 1 && nargout == 0 && ischar (files{1}))
461 try 454 local_list = files{1};
462 local_list = absolute_pathname (files{1}); 455 if (! exist (local_list, "file"))
463 catch 456 try
464 ## Force file to be created 457 ## Force file to be created
465 fclose (fopen (files{1}, "wt")); 458 fclose (fopen (local_list, "wt"));
466 local_list = absolute_pathname (files{1}); 459 catch
467 end_try_catch 460 error ("cannot create file %s", local_list);
461 end_try_catch
462 endif
463 local_list = canonicalize_file_name (local_list);
468 else 464 else
469 error ("you must specify a local_list file, or request an output argument"); 465 error ("you must specify a local_list file, or request an output argument");
470 endif 466 endif
471 467
472 case "global_list" 468 case "global_list"
473 if (length (files) == 0 && nargout == 0) 469 if (length (files) == 0 && nargout == 0)
474 disp(global_list); 470 disp(global_list);
475 elseif (length (files) == 0 && nargout == 1) 471 elseif (length (files) == 0 && nargout == 1)
476 local_packages = global_list; 472 local_packages = global_list;
477 elseif (length (files) == 1 && nargout == 0 && ischar (files{1})) 473 elseif (length (files) == 1 && nargout == 0 && ischar (files{1}))
478 try 474 global_list = files{1};
479 global_list = absolute_pathname (files{1}); 475 if (! exist (global_list, "file"))
480 catch 476 try
481 ## Force file to be created 477 ## Force file to be created
482 fclose (fopen (files{1}, "wt")); 478 fclose (fopen (files{1}, "wt"));
483 global_list = absolute_pathname (files{1}); 479 catch
484 end_try_catch 480 error ("cannot create file %s", global_list);
481 end_try_catch
482 endif
483 global_list = canonicalize_file_name (global_list);
485 else 484 else
486 error ("you must specify a global_list file, or request an output argument"); 485 error ("you must specify a global_list file, or request an output argument");
487 endif 486 endif
488 487
489 case "rebuild" 488 case "rebuild"