diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-02 21:17:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-02 21:17:13 +0000 |
commit | 232a9e8c131c4a36b549eace3512642e409a233a (patch) | |
tree | 5ec51b0009f7e4d9f76d3f811cf6392d476a1344 /Master/texmf-dist/source/latex/download | |
parent | 5924d3d19a3cfd0f81b96b17199dff811f75027e (diff) |
download (2oct19)
git-svn-id: svn://tug.org/texlive/trunk@52257 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/download')
-rw-r--r-- | Master/texmf-dist/source/latex/download/download.tex | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/Master/texmf-dist/source/latex/download/download.tex b/Master/texmf-dist/source/latex/download/download.tex index 07559c8467f..5ffa7d0ca70 100644 --- a/Master/texmf-dist/source/latex/download/download.tex +++ b/Master/texmf-dist/source/latex/download/download.tex @@ -1,7 +1,7 @@ %% download - download files with LaTeX %% -%% Copyright (C) 2012-2013 by Simon Sigurdhsson <sigurdhsson@gmail.com> -%% +%% Copyright (C) 2012-2019 by Simon Sigurdhsson <sigurdhsson@gmail.com> +%% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 %% of this license or (at your option) any later version. @@ -9,11 +9,11 @@ %% http://www.latex-project.org/lppl.txt %% and version 1.3 or later is part of all distributions of LaTeX %% version 2005/12/01 or later. -%% +%% %% This work has the LPPL maintenance status `maintained'. -%% +%% %% The Current Maintainer of this work is Simon Sigurdhsson. -%% +%% %% This work consists of the file download.tex %% and the derived file download.sty. \documentclass{skdoc} @@ -41,9 +41,12 @@ \begin{document} % Change & version info - \version{1.1} + \version{1.2} \changes{1.0}{Initial version} \changes{1.1}{Added aria2 and axel engines} + \changes{1.2}{Protect a bunch of macros and conditionals. Track \pkg{expl3} changes (thanks to Phelype Oleinik)} + % Don't forget to update the version number and release date of + % the package declaration in the implementation! % Metadata \package[ctan=download,vcs=https://github.com/urdh/download]{download} @@ -65,7 +68,7 @@ access \Notice{do not indiscriminately run \hologo{pdfLaTeX} with the \texttt{--shell-escape} flag; using this package it would be possible to download malicious \texttt{.tex} that may abuse the - \cs{write18} access to harm your system}. + \cs{write18} access to harm your system}. \section{Usage} The package is very simple to use, but requires a *nix platform with @@ -88,12 +91,12 @@ engine (wget supports \texttt{http(s)} and \texttt{ftp}, cURL supports a few more, aria2 supports torrent downloads and axel supports downloading from multiple mirrors at once\footnote{See the - manpage of the respective command for more information.}; for most + manpage of the respective command for more information.}; for most cases wget should be enough). The optional argument \meta{filename} makes the underlying engine save the file with the specified filename \Notice{this also enables file existence checking; without it, the engine will attempt to - download the file even if it exists --- wget and aria2 see the + download the file even if it exists --- wget and aria2 see the existing file and do nothing, and axel probably replaces any existing file but cURL will download a new copy with a numeral suffix}. @@ -111,11 +114,11 @@ \begin{MacroCode}{package} \RequirePackage{expl3,l3keys2e,pdftexcmds,xparse} \end{MacroCode} - + Then, we declare ourselves to provide the \thepkg\ \LaTeX3 package. \begin{MacroCode}{package} \ProvidesExplPackage{download} - {2013/04/08}{1.1}{download files with LaTeX} + {2019/10/01}{1.2}{download files with LaTeX} \end{MacroCode} \subsection{Messages} @@ -130,7 +133,7 @@ \msg_new:nnnn{download}{no-engine}{Could~not~find~any~engine!} {Please~make~sure~one~of~the~engines~is~installed~and~in~your~PATH.} \end{MacroCode} - + We also have a message being displayed when \cs{download} is being used without its optional argument. This is a warning, since it may imply that cURL is creating a lot of unwanted files. @@ -138,7 +141,7 @@ \msg_new:nnnn{download}{no-name}{Using~\string\download\space~with~no~filename!} {This~means~I~will~download~the~file~even~if~it~already~exists.} \end{MacroCode} - + The last two messages are diagnostics written to the log when \opt{engine} is set to \texttt{auto}. \begin{MacroCode}{package} @@ -154,8 +157,9 @@ can define a new conditional that decides if we have unrestricted \cs{write18}. \begin{macro}{\__download_if_shellescape:F} + \changes{1.2}{This conditional is now protected} \begin{MacroCode}{package} -\prg_new_conditional:Nnn\__download_if_shellescape:{F}{ +\prg_new_protected_conditional:Nnn\__download_if_shellescape:{F}{ \if_cs_exist:N\pdf@shellescape \end{MacroCode} If the command sequence exists (it really should), we test to see @@ -163,7 +167,7 @@ if no \cs{write18} access is available, two if we have restricted access and one if access is unrestricted. \begin{MacroCode}{package} - \if_int_compare:w\pdf@shellescape=\c_one + \if_int_compare:w\pdf@shellescape=\c_one_int \prg_return_true: \else: \prg_return_false: @@ -187,8 +191,9 @@ an old file may break the check. \begin{macro}{\__download_rm:n}[1] {The file to be removed} + \changes{1.2}{This macro is now protected} \begin{MacroCode}{package} -\cs_new:Npn\__download_rm:n#1{ +\cs_new_protected:Npn\__download_rm:n#1{ \immediate\write18{rm~#1} } \end{MacroCode} @@ -234,8 +239,9 @@ {Filename to save file to, or \cs{NoValue}} {URL to fetch the file from} \changes{1.1}{cURL now follows redirects} + \changes{1.2}{This macro is now protected} \begin{MacroCode}{package} -\cs_new:Npn\__download_curl_do:nn#1#2{ +\cs_new_protected:Npn\__download_curl_do:nn#1#2{ \IfNoValueTF{#1}{ \end{MacroCode} When no optional argument is given, we just invoke cURL with the @@ -257,8 +263,9 @@ \begin{macro}{\__download_wget_do:nn}[2] {Filename to save file to, or \cs{NoValue}} {URL to fetch the file from} + \changes{1.2}{This macro is now protected} \begin{MacroCode}{package} -\cs_new:Npn\__download_wget_do:nn#1#2{ +\cs_new_protected:Npn\__download_wget_do:nn#1#2{ \IfNoValueTF{#1}{ \end{MacroCode} With wget, we pass the \texttt{-q} (quiet) flag as well as the @@ -280,8 +287,9 @@ \begin{macro}{\__download_ariaII_do:nn}[2] {Filename to save file to, or \cs{NoValue}} {URL to fetch the file from} + \changes{1.2}{This macro is now protected} \begin{MacroCode}{package} -\cs_new:Npn\__download_ariaII_do:nn#1#2{ +\cs_new_protected:Npn\__download_ariaII_do:nn#1#2{ \IfNoValueTF{#1}{ \end{MacroCode} With aria2, we pass the \texttt{-q} (quiet) flag as well as the @@ -303,8 +311,9 @@ \begin{macro}{\__download_axel_do:nn}[2] {Filename to save file to, or \cs{NoValue}} {URL to fetch the file from} + \changes{1.2}{This macro is now protected} \begin{MacroCode}{package} -\cs_new:Npn\__download_axel_do:nn#1#2{ +\cs_new_protected:Npn\__download_axel_do:nn#1#2{ \IfNoValueTF{#1}{ \end{MacroCode} With axel, we pass the \texttt{-q} (quiet) flag. @@ -330,8 +339,9 @@ \begin{macro*}{\__download_if_auto_test:TF} \begin{macro}{\__download_if_auto_test:F} \changes{1.1}{Added aria2c and axel engines to stack} + \changes{1.2}{This conditional is now protected} \begin{MacroCode}{package} -\prg_new_conditional:Nnn\__download_if_auto_test:{F,TF}{ +\prg_new_protected_conditional:Nnn\__download_if_auto_test:{F,TF}{ \__download_if_executable_test:nTF{wget}{ \prg_return_true: }{ @@ -355,13 +365,14 @@ \end{macro*} We also define an automatic equivalent of the engine \texttt{_do} - macros, which selects the engines in the order wget, cURL, aria2 + macros, which selects the engines in the order wget, cURL, aria2 and axel. \begin{macro}{\__download_auto_do:nn}[2] {Filename to save file to, or \cs{NoValue}} {URL to fetch the file from} + \changes{1.2}{This macro is now protected} \begin{MacroCode}{package} -\cs_new:Npn\__download_auto_do:nn#1#2{ +\cs_new_protected:Npn\__download_auto_do:nn#1#2{ \__download_if_executable_test:nTF{wget}{ \msg_info:nn{download}{use-wget} \__download_wget_do:nn{#1}{#2} @@ -468,7 +479,7 @@ } \end{MacroCode} \end{macro} - + And we're done. \begin{MacroCode}{package} \endinput |