summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/download
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-10-03 03:00:57 +0000
committerNorbert Preining <norbert@preining.info>2019-10-03 03:00:57 +0000
commit93c3758895674cc9ea3e8aaeeb3cf5d1bdc0e3be (patch)
tree5150bfff26491c4e57ddff629e62b4066295a925 /macros/latex/contrib/download
parentd94b7a8c132734a1bc4046d54a75c7882c4c2619 (diff)
CTAN sync 201910030300
Diffstat (limited to 'macros/latex/contrib/download')
-rw-r--r--macros/latex/contrib/download/Makefile45
-rw-r--r--macros/latex/contrib/download/README12
-rw-r--r--macros/latex/contrib/download/download.pdfbin144709 -> 261753 bytes
-rw-r--r--macros/latex/contrib/download/download.tex59
4 files changed, 74 insertions, 42 deletions
diff --git a/macros/latex/contrib/download/Makefile b/macros/latex/contrib/download/Makefile
index 229e714e72..b6c5e88d6d 100644
--- a/macros/latex/contrib/download/Makefile
+++ b/macros/latex/contrib/download/Makefile
@@ -1,23 +1,36 @@
+ZIP_NOATTRS :=
+ifeq ($(shell uname -s),Darwin)
+ ZIP_NOATTRS += -X
+endif
+
+TAR_NOATTRS :=
+ifeq ($(shell uname -s),Darwin)
+ TAR_NOATTRS += --disable-copyfile
+endif
+
TEXMFHOME ?= $(shell kpsewhich -var-value TEXMFHOME)
-.PHONY: all clean distclean install dist
-all: download.pdf
-clean:
+.PHONY: all clean distclean install dist test clean-test
+all: download.tex download.pdf download.sty README
+clean: clean-test
rm -f *.gl? *.id? *.aux # problematic files
rm -f *.bbl *.bcf *.bib *.blg *.xdy # biblatex
rm -f *.fls *.log *.out *.run.xml *.toc # junk
distclean: clean
- rm -f *.cls *.sty *.clo *.tar.gz *.tds.zip
+ rm -f *.cls *.sty *.clo *.tar.gz *.tds.zip README
git reset --hard
%.pdf: %.tex %.sty
makeglossaries $*
biber $*
- pdflatex -shell-escape $<
+ pdflatex -interaction=nonstopmode -halt-on-error -shell-escape $<
makeglossaries $*
- pdflatex -shell-escape $<
+ pdflatex -interaction=nonstopmode -halt-on-error -shell-escape $<
%.sty: %.tex
- pdflatex $<
+ pdflatex -interaction=nonstopmode -halt-on-error $<
+
+README: README.md
+ sed -e '1,4d;$$d' $< > $@
install: all
install -m 0644 download.sty $(TEXMFHOME)/tex/latex/download/download.sty
@@ -26,22 +39,30 @@ install: all
install -m 0644 README $(TEXMFHOME)/doc/latex/download/README
-mktexlsr
-download.tds.zip: download.tex download.pdf download.sty
- mkdir -p download/{tex,doc,source}/latex/download
+download.tds.zip: all
+ mkdir -p download/tex/latex/download
cp download.sty download/tex/latex/download/download.sty
+ mkdir -p download/doc/latex/download
cp download.pdf download/doc/latex/download/download.pdf
+ mkdir -p download/source/latex/download
cp download.tex download/source/latex/download/download.tex
cp README download/doc/latex/download/README
- cd download && zip -r ../download.tds.zip *
+ cd download && zip $(ZIP_NOATTRS) -r ../download.tds.zip *
rm -rf download
-download.tar.gz: download.tds.zip download.tex download.pdf
+download.tar.gz: all download.tds.zip
mkdir -p download
cp download.tex download/download.tex
cp download.pdf download/download.pdf
cp README download/README
cp Makefile download/Makefile
- tar -czf $@ download download.tds.zip
+ tar $(TAR_NOATTRS) -czf $@ download download.tds.zip
rm -rf download
dist: download.tar.gz
+
+test:
+ $(MAKE) -C tests
+
+clean-test:
+ $(MAKE) -C tests clean
diff --git a/macros/latex/contrib/download/README b/macros/latex/contrib/download/README
index af17fbfc62..653a7be348 100644
--- a/macros/latex/contrib/download/README
+++ b/macros/latex/contrib/download/README
@@ -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,15 +9,15 @@
%% 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.
-This is version 1.0 of the download package, a package which allows
+This is version 1.2 of the download package, a package which allows
LaTeX to download files using wget or cURL.
The following files are enclosed.
diff --git a/macros/latex/contrib/download/download.pdf b/macros/latex/contrib/download/download.pdf
index f31c6c4191..ef98a165ae 100644
--- a/macros/latex/contrib/download/download.pdf
+++ b/macros/latex/contrib/download/download.pdf
Binary files differ
diff --git a/macros/latex/contrib/download/download.tex b/macros/latex/contrib/download/download.tex
index 07559c8467..5ffa7d0ca7 100644
--- a/macros/latex/contrib/download/download.tex
+++ b/macros/latex/contrib/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