Mercurial > jwe > octave
diff scripts/pkg/private/expand_rel_paths.m @ 27712:377f069841c1
Make packages installation dirs in global octave_packages file relative
to OCTAVE_HOME (bug #51632).
* make_rel_paths.m, expand_rel_paths.m: New files that replace OCTAVE_HOME part
of packages installation path with __OH__, or vice versa.
* pkg.m, install.m, uninstall.m: Call make_rel_paths.m before saving
octave_packages file.
* installed_packages.m: Add call to expand_rel_paths.m and standardize_paths.m.
* module.mk: Add expand_rel_path.m and make_rel_path.m.
author | Philip Nienhuis <prnienhuis@users.sf.net> |
---|---|
date | Sat, 16 Nov 2019 23:32:42 +0100 |
parents | |
children | b442ec6dda5c |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/pkg/private/expand_rel_paths.m Sat Nov 16 23:32:42 2019 +0100 @@ -0,0 +1,36 @@ +## Copyright (C) 2019 Philip Nienhuis +## +## This program 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. +## +## This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {} {@var{pkg_list} =} expand_rel_paths (@var{pkg_list}) +## Internal undocumented function. +## @end deftypefn + +## Author: Philip Nienhuis <prnienhuis@users.sf.net> +## Created: 2019-10-28 + +function pkg_list = expand_rel_paths (pkg_list) + + ## Prepend location of OCTAVE_HOME to install directories + loc = OCTAVE_HOME; + for i = 1:numel (pkg_list) + ## Be sure to only prepend OCTAVE_HOME to pertinent package paths + if (strncmpi (pkg_list{i}.dir, "__OH__", 6)) + pkg_list{i}.dir = [ loc pkg_list{i}.dir(7:end) ]; + pkg_list{i}.archprefix = [ loc pkg_list{i}.archprefix(7:end) ]; + endif + endfor + +endfunction