Mercurial > octave
changeset 30421:b8c7c550e86f
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 02 Dec 2021 14:21:16 -0500 |
parents | 9f4442cccedf (current diff) 366aa563dd2e (diff) |
children | a5ca02c0ed7d |
files | NEWS etc/NEWS.7 |
diffstat | 6 files changed, 81 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Thu Dec 02 18:14:14 2021 +0100 +++ b/NEWS Thu Dec 02 14:21:16 2021 -0500 @@ -4,6 +4,11 @@ ### General improvements +- The pkg update command now accepts options that are passed to pkg install +for each updated package. Specifying @option{-local} or @option{-global} +will restrict update checks to local and global installed packgaes, +respectively. + ### Graphical User Interface
--- a/etc/NEWS.7 Thu Dec 02 18:14:14 2021 +0100 +++ b/etc/NEWS.7 Thu Dec 02 14:21:16 2021 -0500 @@ -124,6 +124,11 @@ The real name of the "magick++" library (including any potentially trailing "++") needs to be set in that option now. +- The pkg update command now accepts options that are passed to pkg install +for each updated package. Specifying @option{-local} or @option{-global} +will restrict update checks to local and global installed packgaes, +respectively. + ### Graphical User Interface - The graphical user interface is now available in Hungarian and
--- a/liboctave/array/Range.cc Thu Dec 02 18:14:14 2021 +0100 +++ b/liboctave/array/Range.cc Thu Dec 02 14:21:16 2021 -0500 @@ -192,7 +192,7 @@ template <typename T> void - xinit (T base, T limit, T inc, const bool reverse, T& final_val, + xinit (T base, T limit, T inc, bool reverse, T& final_val, octave_idx_type& nel) { // Catch obvious NaN ranges. @@ -259,8 +259,8 @@ template <typename T> void - xinit (const octave_int<T> base, const octave_int<T> limit, - const octave_int<T> inc, const bool reverse, + xinit (const octave_int<T>& base, const octave_int<T>& limit, + const octave_int<T>& inc, bool reverse, octave_int<T>& final_val, octave_idx_type& nel) { // We need an integer division that is truncating decimals instead
--- a/liboctave/array/Range.h Thu Dec 02 18:14:14 2021 +0100 +++ b/liboctave/array/Range.h Thu Dec 02 14:21:16 2021 -0500 @@ -57,7 +57,7 @@ // to the value of base + a multiple of the increment. range (const T& base, const T& increment, const T& limit, - const bool& reverse = false) + bool reverse = false) : m_base (base), m_increment (increment), m_limit (limit), m_final (), m_numel (), m_reverse (reverse) { @@ -82,13 +82,13 @@ // FIXME: Is there a way to limit this to T == double? range (const T& base, const T& increment, const T& limit, - octave_idx_type numel, const bool& reverse = false) + octave_idx_type numel, bool reverse = false) : m_base (base), m_increment (increment), m_limit (limit), m_final (limit), m_numel (numel), m_reverse (reverse) { } range (const T& base, const T& increment, const T& limit, - const T& final, octave_idx_type numel, const bool& reverse = false) + const T& final, octave_idx_type numel, bool reverse = false) : m_base (base), m_increment (increment), m_limit (limit), m_final (final), m_numel (numel), m_reverse (reverse) { } @@ -97,7 +97,7 @@ // range<T> (base, limit) when T is octave_idx_type. static range<T> make_constant (const T& base, octave_idx_type numel, - const bool& reverse = false) + bool reverse = false) { // We could just make this constructor public, but it allows // inconsistent ranges to be constructed. And it is probably much
--- a/scripts/pkg/pkg.m Thu Dec 02 18:14:14 2021 +0100 +++ b/scripts/pkg/pkg.m Thu Dec 02 14:21:16 2021 -0500 @@ -164,20 +164,35 @@ ## Check installed Octave Forge packages against repository and update any ## outdated items. Updated packages are installed either globally or locally ## depending on whether Octave is running with elevated privileges. This -## requires an internet connection and the cURL library. Usage: +## requires an internet connection and the cURL library. ## +## Options for the install command and the names of individual packages to be +## checked for updates may be specified as a list following the update +## command. If the @option{-local} or @option{-global} option is specified, +## @code{pkg update} limits the update check to the local or global installed +## packages, and installs updates in that same context. For example, +## +## Update all packages: ## @example ## pkg update ## @end example ## -## @noindent -## To update a single package use @code{pkg install -forge} -## +## Update all local packages: +## @example +## pkg update -local +## @end example +## +## Update certain packages, ignore dependencies, max verbosity: +## @example +## pkg update -verbose -nodeps image signal geometry +## @end example +## ## @noindent -## Updates for multiple packages are sorted alphabetically and not checked for -## dependencies affected by installation order. If dependency order related -## @code{pkg update} failures occur, use @code{pkg install -forge} to update -## packages individually. +## Updates for multiple packages are sorted alphabetically and not checked +## for dependencies affected by installation order. If dependency order +## related @code{pkg update} failure occurs, use @code{pkg update -nodeps} to +## ignore dependencies, or @code{pkg install -forge <package_name>} to update +## individual packages manually. ## ## @item uninstall ## Uninstall named packages. For example, @@ -716,6 +731,21 @@ case "update" installed_pkgs_lst = installed_packages (local_list, global_list); + ## If -global or -local, limit updates to global or local list pkgs + globalflag = any (strcmp (varargin, "-global")); + localflag = any (strcmp (varargin, "-local")); + if (globalflag || localflag) + if (globalflag && localflag) + error ("pkg: cannot specify both global and local options.") + elseif (globalflag) + [~, installed_pkgs_lst] = installed_packages (local_list, global_list); + else + [installed_pkgs_lst, ~] = installed_packages (local_list, global_list); + endif + else + installed_pkgs_lst = installed_packages (local_list, global_list); + endif + ## Explicit list of packages to update, rather than all packages if (numel (files) > 0) update_lst = {}; @@ -744,7 +774,9 @@ forge_pkg_version = "0"; end_try_catch if (compare_versions (forge_pkg_version, installed_pkg_version, ">")) - feval (@pkg, "install", "-forge", installed_pkg_name); + options_to_pass = varargin (strncmp (varargin, "-", 1)); + options_to_pass(end+1) = "-forge"; + feval (@pkg, "install", options_to_pass{:}, installed_pkg_name); endif endfor
--- a/test/range.tst Thu Dec 02 18:14:14 2021 +0100 +++ b/test/range.tst Thu Dec 02 14:21:16 2021 -0500 @@ -497,7 +497,7 @@ %!error <colon operator upper bound invalid> (uint8(1):-1:-6) ## Extreme integer values. -%!test <61132> +%!test <*61132> %! types = {"int8", "int16", "int32", "int64", ... %! "uint8", "uint16", "uint32", "uint64"}; %! for i = 1:numel (types) @@ -515,50 +515,38 @@ ## Test that ranges do not exceed limits for integer types -## Ascending ranges, signed +## Ascending ranges, signed and unsigned %!test <*61300> -%! int_types = {@int8, @int16, @int32, @int64}; -%! for i_type = 1:numel (int_types) -%! for i_start = 0:4 -%! assert ((int_types{i_type} (i_start) : 6 : 100)([1,end]), ... -%! [int_types{i_type}(i_start), int_types{i_type}(96+i_start)]); +%! types = {@int8, @int16, @int32, @int64, @uint8, @uint16, @uint32, @uint64}; +%! start = 0:5; +%! finish = start + 6 * floor ((100 - start) / 6); +%! for i_type = 1:numel (types) +%! for i_start = 1:numel(start) +%! assert ((types{i_type} (start(i_start)) : 6 : 100)([1,end]), ... +%! [types{i_type}(start(i_start)), types{i_type}(finish(i_start))]); %! endfor -%! assert ((int_types{i_type} (5) : 6 : 100)([1,end]), ... -%! [int_types{i_type}(5), int_types{i_type}(95)]); -%! endfor - -## Ascending ranges, unsigned -%!test <*61300> -%! int_types = {@uint8, @uint16, @uint32, @uint64}; -%! for i_type = 1:numel (int_types) -%! for i_start = 0:4 -%! assert ((int_types{i_type} (i_start) : 6 : 100)([1,end]), ... -%! [int_types{i_type}(i_start), int_types{i_type}(96+i_start)]); -%! endfor -%! assert ((int_types{i_type} (5) : 6 : 100)([1,end]), ... -%! [int_types{i_type}(5), int_types{i_type}(95)]); %! endfor ## Descending ranges, signed %!test <*61300> -%! int_types = {@int8, @int16, @int32, @int64}; -%! for i_type = 1:numel (int_types) -%! for i_start = 0:4 -%! assert ((int_types{i_type} (100-i_start) : -6 : 0)([1,end]), ... -%! [int_types{i_type}(100-i_start), int_types{i_type}(4-i_start)]); +%! types = {@int8, @int16, @int32, @int64}; +%! start = 100:-1:95; +%! finish = start - 6 * floor (start / 6); +%! for i_type = 1:numel (types) +%! for i_start = 1:numel(start) +%! assert ((types{i_type} (start(i_start)) : -6 : 0)([1,end]), ... +%! [types{i_type}(start(i_start)), types{i_type}(finish(i_start))]); %! endfor -%! assert ((int_types{i_type} (95) : -6 : 0)([1,end]), ... -%! [int_types{i_type}(95), int_types{i_type}(5)]); %! endfor ## Descending ranges, unsigned %!test <*61132> -%! int_types = {@uint8, @uint16, @uint32, @uint64}; -%! for i_type = 1:numel (int_types) -%! for i_start = 0:4 -%! assert ((int_types{i_type} (100-i_start) : -6 : 0)([1,end]), ... -%! [int_types{i_type}(100-i_start), int_types{i_type}(4-i_start)]); +%! types = {@uint8, @uint16, @uint32, @uint64}; +%! start = 100:-1:95; +%! finish = start - 6 * floor (start / 6); +%! for i_type = 1:numel (types) +%! for i_start = 1:numel(start) +%! assert ((types{i_type} (start(i_start)) : -6 : 0)([1,end]), ... +%! [types{i_type}(start(i_start)), types{i_type}(finish(i_start))]); %! endfor -%! assert ((int_types{i_type} (95) : -6 : 0)([1,end]), ... -%! [int_types{i_type}(95), int_types{i_type}(5)]); %! endfor