Commit 9277bcb6 authored by Dóra Kocsis's avatar Dóra Kocsis

enforce minimal version requirements (MATLAB (R2015a), Octave (6)), add...

enforce minimal version requirements (MATLAB (R2015a), Octave (6)), add dependence to submodule: jsonlab
parent f597067c
Pipeline #3509 failed with stage
in 15 seconds
[submodule "contrib/jsonlab"]
path = contrib/jsonlab
url = https://github.com/fangq/jsonlab.git
Subproject commit 7499bd8fae221d3018d31b359a74422237a8b8ec
......@@ -17,11 +17,12 @@ function initialize_mdbnomics()
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% Get the path to the dseries toolbox.
% Get the path to the mdbnomics toolbox.
mdbnomics_src_root = strrep(which('initialize_mdbnomics'), 'initialize_mdbnomics.m', '');
% Set the subfolders to be added in the path.
p = {'utils'};
p = {'utils' ; ...
'/../contrib/jsonlab'};
  • I suggest to only add jsonlab to the path when it is actually used (my understanding is that it’s only needed for older MATLAB versions).

Please register or sign in to reply
% Add missing routines if dynare is not in the path
if ~exist('OCTAVE_VERSION', 'builtin') || ~exist('contains','builtin')
......@@ -36,6 +37,10 @@ if ~exist('matlab_ver_less_than','file')
p{end+1} = 'missing/matlab_ver_less_than';
end
if ~exist('octave_ver_less_than','file')
p{end+1} = 'missing/matlab_ver_less_than';
end
if exist('OCTAVE_VERSION', 'builtin') && ~exist('user_has_octave_forge_package','file')
p{end+1} = 'missing/user_has_octave_forge_package';
end
......@@ -44,4 +49,11 @@ end
P = cellfun(@(c)[mdbnomics_src_root c], p, 'uni', false);
addpath(P{:});
% Check minimal MATLAB and Octave requirements.
if isoctave && octave_ver_less_than('6')
error('The minimum Octave requirement of this package is version 6.');
elseif matlab_ver_less_than('8.5')
error('The minimum MATLAB requirement of this package is R2015a.');
end
assignin('caller', 'mdbnomics_src_root', mdbnomics_src_root);
function r = octave_ver_less_than(verstr)
% function r = octave_ver_less_than(verstr)
%
% Returns 1 if current Octave version is strictly older than
% the one given in argument.
%
% Note that this function will fail under Matlab.
%
% INPUTS
% verstr: a string of the format 'x.y' or 'x.y.z'
%
% OUTPUTS
% r: 0 or 1
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2008-2019 Dynare Team
%
% This file is part of Dynare.
%
% Dynare 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.
%
% Dynare 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 Dynare. If not, see <http://www.gnu.org/licenses/>.
r = compare_versions(version(), verstr, "<");
endfunction
......@@ -51,7 +51,10 @@ for gg = 1:size(grouped_series, 2)
posted_series_list{series} = posted_series;
end
json_request = sprintf('{"filters":%s,"series":%s}', dbnomics_filters, jsonencode(posted_series_list));
posted_series_list = savejson('',posted_series_list, 'Compact', 1);
posted_series_list = regexprep(posted_series_list,{' [[',']]'},{'[',']'});
json_request = sprintf('{"filters":%s,"series":%s}', dbnomics_filters, posted_series_list);
try
response = webwrite(apply_endpoint_url, json_request, opts);
catch
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment