texlive[41873] trunk: latexpand (16aug16)

commits+karl at tug.org commits+karl at tug.org
Tue Aug 16 23:47:57 CEST 2016


Revision: 41873
          http://tug.org/svn/texlive?view=revision&revision=41873
Author:   karl
Date:     2016-08-16 23:47:57 +0200 (Tue, 16 Aug 2016)
Log Message:
-----------
latexpand (16aug16)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/latexpand/latexpand
    trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
    trunk/Master/texmf-dist/doc/support/latexpand/README
    trunk/Master/texmf-dist/doc/support/latexpand/version.txt
    trunk/Master/texmf-dist/scripts/latexpand/latexpand

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/support/latexpand/LICENCE

Modified: trunk/Build/source/texk/texlive/linked_scripts/latexpand/latexpand
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/latexpand/latexpand	2016-08-16 21:47:33 UTC (rev 41872)
+++ trunk/Build/source/texk/texlive/linked_scripts/latexpand/latexpand	2016-08-16 21:47:57 UTC (rev 41873)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 # Inspired by latexpand by D. Musliner, University of Michigan
-# 2012, 2013, 2014, 2015: Matthieu Moy <Matthieu.Moy at imag.fr>
+# 2012, 2013, 2014, 2015, 2016: Matthieu Moy <Matthieu.Moy at imag.fr>
 # BSD License
 
 use strict;
@@ -53,7 +53,7 @@
 {
 	# $VERSION's value will be substituted by 'make dist', but the
 	# next line won't (the string has to be broken to avoid it).
-	my $VERSION = 'v1.2-1-g47e2cee';
+	my $VERSION = 'v1.3';
 	if ($VERSION eq '@LATEXPAND' . '_VERSION@') {
 		my($vol,$dir,$file) = File::Spec->splitpath($0);
 		chdir($dir);
@@ -78,8 +78,8 @@
 }
 
 if ($output && $output ne "-") {
-	open OUTPUT, '>', "$output" or die $!;
-	STDOUT->fdopen(\*OUTPUT, 'w') or die $!;
+	open (my $OUTPUT, '>', "$output") or die $!;
+	STDOUT->fdopen(\*$OUTPUT, 'w') or die $!;
 }
 
 sub say
@@ -105,9 +105,8 @@
 	my $file = shift;
 	my $prefix = (shift || "");
 	my $in_comment = 0;
-	local(*FILE);
-	open(FILE, $file) or die "could not open input file '$file'\n";
-	while (my $line = <FILE>) {
+	open(my $FILE, "<", $file) or die "could not open input file '$file'\n";
+	while (my $line = <$FILE>) {
 		if ($line =~ /^[ \t]*\\endinput/) {
 			$line =~ s/(\\endinput.*)\n/% $1/;
 			$in_comment = 1;
@@ -123,17 +122,18 @@
 		# ignored by LaTeX, but we don't allow anything before
 		# to avoid e.g. \verb|\end{document}| from terminating
 		# the file.
-		if (!$keep_comments && $line =~ /^[ \t]*\\end{document}/) {
+		if (!$keep_comments && $line =~ /^[ \t]*\\end\{document\}/) {
 			last;
 		}
 	}
-	close(FILE);
+	close($FILE);
 	return $in_comment;
 }
 
 sub process_line
 {
-	my ($_, $prefix, $file) = @_;
+	my ($line, $prefix, $file) = @_;
+	$_ = $line;
 	# Consider \makeatletter only in preamble, because we do want
 	# to warn on \someCommand{\makeatletter\command at with@arobase}.
 	if ($in_preamble && /^[^%]*\\makeatletter/) {
@@ -149,13 +149,23 @@
 		print STDERR "Warning: consider using --makeatletter if the result is not compilable.\n";
 	}
 	unless ($keep_comments) {
-		if ($empty_comments) {
-			s/^%.*$/%/;
-			s/([^\\])%.*$/$1%/;
-		} else {
-			s/^%.*\n//;
-			s/([^\\])%.*\n/$1/;
+		if (!$empty_comments) {
+			# Include \n in pattern to avoid matching
+			# comments at end of files
+
+			# remove comments + whitespace-only lines completely
+			s/^\s*%.*\n//;
+
+			# remove only the comment if the line has actual content
+			s/([^\\])%.*\n/$1\n/;
 		}
+		# Apply the "empty comments" treatment unconditionally
+		# for end-of-files comments not matched above (it
+		# doesn't harm to keep an empty comment sometimes, but
+		# it may harm to leave a real comment if the goal was
+		# to strip them).
+		s/^%.*$/%/;
+		s/([^\\])%.*$/$1%/;
 	}
 
 	unless ($keep_includes) {
@@ -203,7 +213,7 @@
 	if ($expand_usepackage) {
 		# Don't bother with before and after text, we just require the
 		# usepackage to be alone on its line.
-		if (my ($package_name) = /^\s*\\usepackage{([^}]*)}\s*(%.*)?$/) {
+		if (my ($package_name) = /^\s*\\usepackage\{([^\}]*)\}\s*(%.*)?$/) {
 			my $full = find_file($package_name . ".sty", $TEXINPUTS);
 			if ($full) {
 				say $prefix . "Found package file: $full\n";
@@ -216,7 +226,7 @@
 	}
 	if ($expand_bbl) {
 		if (my ($before, $bib_name, $after)
-			 = /^(.*)\\bibliography{([^}]*)}(.*)$/) {
+			 = /^(.*)\\bibliography\{([^\}]*)\}(.*)$/) {
 			# The BBL file is not necessarily $bib_name.
 			# Take it from the command-line.
 			print $before . $nl;
@@ -233,7 +243,7 @@
 			print STDERR "$full\n";
 		}
 	}
-	if (/^[ \t]*\\begin{document}/) {
+	if (/^[ \t]*\\begin\{document\}/) {
 		$in_preamble = 0;
 		if ($makeatletter) {
 			print '\makeatletter' . $nl;
@@ -257,7 +267,7 @@
 		die "ERROR: Could not find file [$file]\n";
 	} else {
 		print STDERR "Warning: Could not find file [$file]\n";
-		return undef;
+		return;
 	}
 }
 
@@ -334,7 +344,7 @@
 
 The latest version of latexpand is available here:
 
-  https://gitorious.org/latexpand
+  https://gitlab.com/latexpand/latexpand
 
 Versions are uploaded to ctan.org from time to time:
 
@@ -342,8 +352,13 @@
 
 =head1 BUGS
 
-Please, report bugs to Matthieu Moy <Matthieu.Moy at imag.fr>.
+Please, report bugs on the issue tracker on the project site:
 
+  https://gitlab.com/latexpand/latexpand/issues
+
+Alternatively, you may email directly the author: Matthieu Moy
+<Matthieu.Moy at imag.fr>.
+
 =head2 Known bugs
 
 =head3 Verbatim
@@ -352,6 +367,9 @@
 will therefore process any \include, \input, ... directives that
 appear within verbatim environments (while it shouldn't).
 
+LaTeX comments inside verbatim environments are also incorrectly
+stripped. You can use --keep-comments as a workaround to avoid this.
+
 =head3 Comment environment
 
 It would be nice to remove code between \begin{comment} and
@@ -401,4 +419,4 @@
 
 =head1 VERSION
 
-This is latexpand version v1.2-1-g47e2cee.
+This is latexpand version v1.3.

Modified: trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl	2016-08-16 21:47:33 UTC (rev 41872)
+++ trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl	2016-08-16 21:47:57 UTC (rev 41873)
@@ -1,5 +1,5 @@
 #!/usr/bin/env perl
-# $Id: tlmgr.pl 41476 2016-06-18 00:45:25Z preining $
+# $Id: tlmgr.pl 41794 2016-08-03 23:11:36Z karl $
 #
 # Copyright 2008-2016 Norbert Preining
 # This file is licensed under the GNU General Public License version 2
@@ -6,8 +6,8 @@
 # or any later version.
 #
 
-my $svnrev = '$Revision: 41476 $';
-my $datrev = '$Date: 2016-06-18 02:45:25 +0200 (Sat, 18 Jun 2016) $';
+my $svnrev = '$Revision: 41794 $';
+my $datrev = '$Date: 2016-08-04 01:11:36 +0200 (Thu, 04 Aug 2016) $';
 my $tlmgrrevision;
 my $prg;
 if ($svnrev =~ m/: ([0-9]+) /) {
@@ -7843,7 +7843,7 @@
 disabled, a signature file (C<texlive.tlpdb.*.asc>) of the checksum file
 is downloaded and the signature verified. The signature is created by
 the TeX Live Distribution GPG key 0x06BAB6BC, which in turn is signed by
-Karl Berry's key 0x9DEB46C0 and Norbert Preining's key 0x6CACA448.  All
+Karl Berry's key 0x30D155AD and Norbert Preining's key 0x6CACA448.  All
 of these keys are obtainable from the standard key servers.
 
 Additional trusted keys can be added using the C<key> action.

Added: trunk/Master/texmf-dist/doc/support/latexpand/LICENCE
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexpand/LICENCE	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/support/latexpand/LICENCE	2016-08-16 21:47:57 UTC (rev 41873)
@@ -0,0 +1,30 @@
+Copyright (c) 2012, 2013, 2014, 2015, 2016,
+              Matthieu Moy <Matthieu.Moy at grenoble-inp.fr>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Modified: trunk/Master/texmf-dist/doc/support/latexpand/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexpand/README	2016-08-16 21:47:33 UTC (rev 41872)
+++ trunk/Master/texmf-dist/doc/support/latexpand/README	2016-08-16 21:47:57 UTC (rev 41873)
@@ -46,7 +46,7 @@
 GETTING LATEXPAND
     The latest version of latexpand is available here:
 
-      https://gitorious.org/latexpand
+      https://gitlab.com/latexpand/latexpand
 
     Versions are uploaded to ctan.org from time to time:
 
@@ -53,8 +53,13 @@
       http://www.ctan.org/pkg/latexpand
 
 BUGS
-    Please, report bugs to Matthieu Moy <Matthieu.Moy at imag.fr>.
+    Please, report bugs on the issue tracker on the project site:
 
+      https://gitlab.com/latexpand/latexpand/issues
+
+    Alternatively, you may email directly the author: Matthieu Moy
+    <Matthieu.Moy at imag.fr>.
+
   Known bugs
    Verbatim
     latexpand currently ignores \begin{verbatim} ... \end{verbatim}, and
@@ -61,6 +66,9 @@
     will therefore process any \include, \input, ... directives that appear
     within verbatim environments (while it shouldn't).
 
+    LaTeX comments inside verbatim environments are also incorrectly
+    stripped. You can use --keep-comments as a workaround to avoid this.
+
    Comment environment
     It would be nice to remove code between \begin{comment} and
     \end{comment} too if \usepackage{comment} is used.
@@ -106,5 +114,5 @@
     https://lacl.fr/~caubert/notes/portabilite-du-tex.html#dependances
 
 VERSION
-    This is latexpand version v1.2-1-g47e2cee.
+    This is latexpand version v1.3.
 

Modified: trunk/Master/texmf-dist/doc/support/latexpand/version.txt
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexpand/version.txt	2016-08-16 21:47:33 UTC (rev 41872)
+++ trunk/Master/texmf-dist/doc/support/latexpand/version.txt	2016-08-16 21:47:57 UTC (rev 41873)
@@ -1,2 +1,2 @@
-latexpand version v1.2-1-g47e2cee (47e2ceee9a43e8f7be9be9fc1c5bd191b96820bf).
-Committed on Sun May 24 15:05:43 2015 +0200.
+latexpand version v1.3 (4a4dec71711857554c0b6f5531a5147a47ff2cae).
+Committed on Sat Aug 13 19:51:30 2016 +0200.

Modified: trunk/Master/texmf-dist/scripts/latexpand/latexpand
===================================================================
--- trunk/Master/texmf-dist/scripts/latexpand/latexpand	2016-08-16 21:47:33 UTC (rev 41872)
+++ trunk/Master/texmf-dist/scripts/latexpand/latexpand	2016-08-16 21:47:57 UTC (rev 41873)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 # Inspired by latexpand by D. Musliner, University of Michigan
-# 2012, 2013, 2014, 2015: Matthieu Moy <Matthieu.Moy at imag.fr>
+# 2012, 2013, 2014, 2015, 2016: Matthieu Moy <Matthieu.Moy at imag.fr>
 # BSD License
 
 use strict;
@@ -53,7 +53,7 @@
 {
 	# $VERSION's value will be substituted by 'make dist', but the
 	# next line won't (the string has to be broken to avoid it).
-	my $VERSION = 'v1.2-1-g47e2cee';
+	my $VERSION = 'v1.3';
 	if ($VERSION eq '@LATEXPAND' . '_VERSION@') {
 		my($vol,$dir,$file) = File::Spec->splitpath($0);
 		chdir($dir);
@@ -78,8 +78,8 @@
 }
 
 if ($output && $output ne "-") {
-	open OUTPUT, '>', "$output" or die $!;
-	STDOUT->fdopen(\*OUTPUT, 'w') or die $!;
+	open (my $OUTPUT, '>', "$output") or die $!;
+	STDOUT->fdopen(\*$OUTPUT, 'w') or die $!;
 }
 
 sub say
@@ -105,9 +105,8 @@
 	my $file = shift;
 	my $prefix = (shift || "");
 	my $in_comment = 0;
-	local(*FILE);
-	open(FILE, $file) or die "could not open input file '$file'\n";
-	while (my $line = <FILE>) {
+	open(my $FILE, "<", $file) or die "could not open input file '$file'\n";
+	while (my $line = <$FILE>) {
 		if ($line =~ /^[ \t]*\\endinput/) {
 			$line =~ s/(\\endinput.*)\n/% $1/;
 			$in_comment = 1;
@@ -123,17 +122,18 @@
 		# ignored by LaTeX, but we don't allow anything before
 		# to avoid e.g. \verb|\end{document}| from terminating
 		# the file.
-		if (!$keep_comments && $line =~ /^[ \t]*\\end{document}/) {
+		if (!$keep_comments && $line =~ /^[ \t]*\\end\{document\}/) {
 			last;
 		}
 	}
-	close(FILE);
+	close($FILE);
 	return $in_comment;
 }
 
 sub process_line
 {
-	my ($_, $prefix, $file) = @_;
+	my ($line, $prefix, $file) = @_;
+	$_ = $line;
 	# Consider \makeatletter only in preamble, because we do want
 	# to warn on \someCommand{\makeatletter\command at with@arobase}.
 	if ($in_preamble && /^[^%]*\\makeatletter/) {
@@ -149,13 +149,23 @@
 		print STDERR "Warning: consider using --makeatletter if the result is not compilable.\n";
 	}
 	unless ($keep_comments) {
-		if ($empty_comments) {
-			s/^%.*$/%/;
-			s/([^\\])%.*$/$1%/;
-		} else {
-			s/^%.*\n//;
-			s/([^\\])%.*\n/$1/;
+		if (!$empty_comments) {
+			# Include \n in pattern to avoid matching
+			# comments at end of files
+
+			# remove comments + whitespace-only lines completely
+			s/^\s*%.*\n//;
+
+			# remove only the comment if the line has actual content
+			s/([^\\])%.*\n/$1\n/;
 		}
+		# Apply the "empty comments" treatment unconditionally
+		# for end-of-files comments not matched above (it
+		# doesn't harm to keep an empty comment sometimes, but
+		# it may harm to leave a real comment if the goal was
+		# to strip them).
+		s/^%.*$/%/;
+		s/([^\\])%.*$/$1%/;
 	}
 
 	unless ($keep_includes) {
@@ -203,7 +213,7 @@
 	if ($expand_usepackage) {
 		# Don't bother with before and after text, we just require the
 		# usepackage to be alone on its line.
-		if (my ($package_name) = /^\s*\\usepackage{([^}]*)}\s*(%.*)?$/) {
+		if (my ($package_name) = /^\s*\\usepackage\{([^\}]*)\}\s*(%.*)?$/) {
 			my $full = find_file($package_name . ".sty", $TEXINPUTS);
 			if ($full) {
 				say $prefix . "Found package file: $full\n";
@@ -216,7 +226,7 @@
 	}
 	if ($expand_bbl) {
 		if (my ($before, $bib_name, $after)
-			 = /^(.*)\\bibliography{([^}]*)}(.*)$/) {
+			 = /^(.*)\\bibliography\{([^\}]*)\}(.*)$/) {
 			# The BBL file is not necessarily $bib_name.
 			# Take it from the command-line.
 			print $before . $nl;
@@ -233,7 +243,7 @@
 			print STDERR "$full\n";
 		}
 	}
-	if (/^[ \t]*\\begin{document}/) {
+	if (/^[ \t]*\\begin\{document\}/) {
 		$in_preamble = 0;
 		if ($makeatletter) {
 			print '\makeatletter' . $nl;
@@ -257,7 +267,7 @@
 		die "ERROR: Could not find file [$file]\n";
 	} else {
 		print STDERR "Warning: Could not find file [$file]\n";
-		return undef;
+		return;
 	}
 }
 
@@ -334,7 +344,7 @@
 
 The latest version of latexpand is available here:
 
-  https://gitorious.org/latexpand
+  https://gitlab.com/latexpand/latexpand
 
 Versions are uploaded to ctan.org from time to time:
 
@@ -342,8 +352,13 @@
 
 =head1 BUGS
 
-Please, report bugs to Matthieu Moy <Matthieu.Moy at imag.fr>.
+Please, report bugs on the issue tracker on the project site:
 
+  https://gitlab.com/latexpand/latexpand/issues
+
+Alternatively, you may email directly the author: Matthieu Moy
+<Matthieu.Moy at imag.fr>.
+
 =head2 Known bugs
 
 =head3 Verbatim
@@ -352,6 +367,9 @@
 will therefore process any \include, \input, ... directives that
 appear within verbatim environments (while it shouldn't).
 
+LaTeX comments inside verbatim environments are also incorrectly
+stripped. You can use --keep-comments as a workaround to avoid this.
+
 =head3 Comment environment
 
 It would be nice to remove code between \begin{comment} and
@@ -401,4 +419,4 @@
 
 =head1 VERSION
 
-This is latexpand version v1.2-1-g47e2cee.
+This is latexpand version v1.3.



More information about the tex-live-commits mailing list