Mercurial > hg > octave-lojdl
changeset 15002:3172d7916158
Merge erroneously crated head
author | Carlo de Falco <cdf@users.sourceforge.net> |
---|---|
date | Sun, 22 Jul 2012 04:16:02 +0200 |
parents | 894cf2c07f92 (current diff) 4c8ddf57fcda (diff) |
children | 1f5dbfc23fc2 |
files | scripts/pkg/private/absolute_pathname.m |
diffstat | 4 files changed, 31 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/pkg/module.mk +++ b/scripts/pkg/module.mk @@ -1,7 +1,6 @@ FCN_FILE_DIRS += pkg pkg_PRIVATE_FCN_FILES = \ - pkg/private/absolute_pathname.m \ pkg/private/build.m \ pkg/private/configure_make.m \ pkg/private/copy_files.m \
--- a/scripts/pkg/pkg.m +++ b/scripts/pkg/pkg.m @@ -421,50 +421,46 @@ global_packages = archprefix; elseif (length (files) >= 1 && nargout <= 2 && ischar (files{1})) prefix = files{1}; - try - prefix = absolute_pathname (prefix); - catch + if (! exist (prefix, "dir")) [status, msg, msgid] = mkdir (prefix); if (status == 0) error("cannot create prefix %s: %s", prefix, msg); endif warning ("creating the directory %s\n", prefix); - prefix = absolute_pathname (prefix); - end_try_catch - prefix = absolute_pathname (prefix); - local_packages = prefix; + endif + local_packages = prefix = canonicalize_filename (prefix); user_prefix = true; if (length (files) >= 2 && ischar (files{2})) archprefix = files{2}; - try - archprefix = absolute_pathname (archprefix); - catch + if (! exist (archprefix, "dir")) [status, msg, msgid] = mkdir (archprefix); if (status == 0) error("cannot create archprefix %s: %s", archprefix, msg); endif warning ("creating the directory %s\n", archprefix); - archprefix = absolute_pathname (archprefix); - end_try_catch - global_packages = archprefix; + global_packages = archprefix = canonicalize_file_name (archprefix); + endif endif else error ("you must specify a prefix directory, or request an output argument"); endif - + case "local_list" if (length (files) == 0 && nargout == 0) disp (local_list); elseif (length (files) == 0 && nargout == 1) local_packages = local_list; elseif (length (files) == 1 && nargout == 0 && ischar (files{1})) - try - local_list = absolute_pathname (files{1}); - catch - ## Force file to be created - fclose (fopen (files{1}, "wt")); - local_list = absolute_pathname (files{1}); - end_try_catch + local_list = files{1}; + if (! exist (local_list, "file")) + try + ## Force file to be created + fclose (fopen (local_list, "wt")); + catch + error ("cannot create file %s", local_list); + end_try_catch + endif + local_list = canonicalize_file_name (local_list); else error ("you must specify a local_list file, or request an output argument"); endif @@ -475,13 +471,16 @@ elseif (length (files) == 0 && nargout == 1) local_packages = global_list; elseif (length (files) == 1 && nargout == 0 && ischar (files{1})) - try - global_list = absolute_pathname (files{1}); - catch - ## Force file to be created - fclose (fopen (files{1}, "wt")); - global_list = absolute_pathname (files{1}); - end_try_catch + global_list = files{1}; + if (! exist (global_list, "file")) + try + ## Force file to be created + fclose (fopen (files{1}, "wt")); + catch + error ("cannot create file %s", global_list); + end_try_catch + endif + global_list = canonicalize_file_name (global_list); else error ("you must specify a global_list file, or request an output argument"); endif
deleted file mode 100644 --- a/scripts/pkg/private/absolute_pathname.m +++ /dev/null @@ -1,33 +0,0 @@ -## Copyright (C) 2005-2012 Søren Hauberg -## Copyright (C) 2010 VZLU Prague, a.s. -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {@var{pth} =} absolute_pathname (@var{pth}) -## Undocumented internal function. -## @end deftypefn - -function pth = absolute_pathname (pth) - [status, msg, msgid] = fileattrib (pth); - if (status != 1) - error ("could not find the file or path %s", pth); - else - pth = msg.Name; - endif -endfunction -
--- a/scripts/pkg/private/build.m +++ b/scripts/pkg/private/build.m @@ -34,7 +34,10 @@ error ("could not create installation directory: %s", msg); endif endif - builddir = absolute_pathname (builddir); + [builddir, status] = canonicalize_file_name (builddir); + if (! status) + error ("cannot find directory %s", builddir); + endif installdir = fullfile (builddir, "install"); if (! exist (installdir, "dir")) [status, msg] = mkdir (installdir);