From d6c536f542893b3e45792fc55ec6fb7e53d9d8ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 3 Oct 2019 15:57:53 +0200
Subject: [PATCH] Drop routines for downloading X13-ARIMA-SEATS binaries from
 the website

On Windows and macOS, those binaries are now bundled in packages. On Debian,
one can use the official x13as package.
---
 README.md                      | 24 ++++++----------
 externals/x13/.gitignore       |  4 ---
 externals/x13/installx13.m     | 50 ----------------------------------
 externals/x13/uninstallx13.m   | 35 ------------------------
 externals/x13/updatex13.m      | 29 --------------------
 src/initialize_dseries_class.m |  2 +-
 6 files changed, 10 insertions(+), 134 deletions(-)
 delete mode 100644 externals/x13/.gitignore
 delete mode 100644 externals/x13/installx13.m
 delete mode 100644 externals/x13/uninstallx13.m
 delete mode 100644 externals/x13/updatex13.m

diff --git a/README.md b/README.md
index 3cac86b..ddcd261 100644
--- a/README.md
+++ b/README.md
@@ -30,25 +30,19 @@ Add the `dseries/src` folder to the MATLAB/Octave path, and run the following co
     >> dseries().initialize()
 
 which, depending on your system, will add the necessary subfolders to
-the MATLAB/Octave path. Also, if
-[X13-ARIMA-SEATS](https://www.census.gov/srd/www/x13as/) is not
-installed in your system (on debian it is possible to install it with
-the `apt-get`) you will need (only the first time) to install the
-binary. Scripts are available to install (or update) this
-dependency. From the MATLAB/Octave prompt:
+the MATLAB/Octave path.
 
-    >> cd dseries/externals/x13
-    >> installx13()
-
-and run the configuration again:
-
-    >> dseries.initialize()
-
-You should not see the warning related to the missing `x13as`
-binary. You are then ready to go. A full documentation will come soon,
+You are then ready to go. A full documentation will come soon,
 but you can already obtain a general idea by looking into the Dynare
 reference manual.
 
+Note that [X13-ARIMA-SEATS](https://www.census.gov/srd/www/x13as/) is required
+for accessing all the features of the toolbox. On Windows and macOS, an
+X13-ARIMA-SEATS binary is included in standalone dseries packages and in Dynare
+packages. On Debian and Ubuntu it is possible to install X13-ARIMA-SEATS with
+`apt install x13as` (on Debian, you must have the non-free archive area listed
+in package sources).
+
 ## Examples
 
 ### Instantiate a dseries object from an array
diff --git a/externals/x13/.gitignore b/externals/x13/.gitignore
deleted file mode 100644
index f81d555..0000000
--- a/externals/x13/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-x13.zip
-linux/*
-windows/*
-*~
diff --git a/externals/x13/installx13.m b/externals/x13/installx13.m
deleted file mode 100644
index aa97fe7..0000000
--- a/externals/x13/installx13.m
+++ /dev/null
@@ -1,50 +0,0 @@
-function installx13()
-
-% Installs CENSUS X13 binaries (Windows and Linux).
-
-% Copyright (C) 2017-2018 Dynare Team
-%
-% This code 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 dseries submodule 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/>.
-
-
-if ~exist('x13.zip','file')
-    if ~isoctave() && verLessThan('matlab', 'R2014b')
-        websave('x13.zip', 'https://www.dynare.org/x13/x13.zip');
-    else
-        urlwrite('https://www.dynare.org/x13/x13.zip', 'x13.zip');
-    end
-    unzip('x13.zip');
-    if ismac()
-        if exist('./osx', 'dir')
-            rmdir('osx', 's')
-        end
-        mkdir osx;
-        movefile('binaries/osx/*','./osx');
-    elseif isunix()
-        if exist('./linux', 'dir')
-            rmdir('linux', 's')
-        end
-        mkdir linux;
-        movefile('binaries/linux/*','./linux');
-    elseif ispc()
-        if exist('./windows', 'dir')
-            rmdir('windows', 's')
-        end
-        mkdir windows;
-        movefile('binaries/windows/*','./windows');
-    else
-        error('X13 is not available for the current platform!')
-    end
-    rmdir('binaries', 's');
-end
diff --git a/externals/x13/uninstallx13.m b/externals/x13/uninstallx13.m
deleted file mode 100644
index 2e2c04c..0000000
--- a/externals/x13/uninstallx13.m
+++ /dev/null
@@ -1,35 +0,0 @@
-function uninstallx13()
-
-% Uninstalls CENSUS X13 binaries (Windows, OSX and Linux).
-
-% Copyright (C) 2017 Dynare Team
-%
-% This code 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 dseries submodule 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/>.
-
-
-if exist('x13.zip','file')
-    delete('x13.zip')
-end
-
-if exist('linux','dir')
-    rmdir('linux', 's')
-end
-
-if exist('windows','dir')
-    rmdir('windows', 's')
-end
-
-if exist('osx','dir')
-    rmdir('osx', 's')
-end
\ No newline at end of file
diff --git a/externals/x13/updatex13.m b/externals/x13/updatex13.m
deleted file mode 100644
index adf3126..0000000
--- a/externals/x13/updatex13.m
+++ /dev/null
@@ -1,29 +0,0 @@
-function updatex13()
-
-% Uninstalls CENSUS X13 binaries (Windows, OSX and Linux).
-
-% Copyright (C) 2017 Dynare Team
-%
-% This code 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 dseries submodule 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/>.
-
-
-if exist('x13.zip','file')
-    delete('x13.zip')
-end
-
-if exist('./binaries', 'dir')
-    rmdir('binaries', 's');
-end
-
-installx13();
\ No newline at end of file
diff --git a/src/initialize_dseries_class.m b/src/initialize_dseries_class.m
index b041008..0b239a0 100644
--- a/src/initialize_dseries_class.m
+++ b/src/initialize_dseries_class.m
@@ -37,7 +37,7 @@ else
     error('Unsupported platform.')
 end
 if nox13
-    warning('X13 binary is not available.\nIf you are under Debian or Ubuntu, you can install it through your package manager, with ''apt install x13as''.\nOtherwise, you can install it manually by running\nthe function installx13() available in:\n\n\t%s\n', [dseries_src_root(1:end-4), 'externals' filesep() 'x13']);
+    warning('X13 binary is not available.\nIf you are under Debian or Ubuntu, you can install it through your package manager, with ''apt install x13as''.\nIf you are under Windows or macOS, this probably means that you did not install the dseries toolbox through an official package.\n');
 end
 
 % Set the subfolders to be added in the path.
-- 
GitLab