summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-06-16 21:19:33 +0000
committerKarl Berry <karl@freefriends.org>2015-06-16 21:19:33 +0000
commitaabaf017d9f80254268cc35b62b781ad9dc598f6 (patch)
tree9e653c8221bdaf1f729803854928f01bcce99f5b /Build/source
parent42f448fd67c0906edfb3bf8ad7c7a6e336e31da0 (diff)
ptex2pdf (16jun15)
git-svn-id: svn://tug.org/texlive/trunk@37566 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/ptex2pdf/ptex2pdf.lua96
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/texlive/fmtutil.pl105
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/texlive/tlmgr.pl11
3 files changed, 161 insertions, 51 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/ptex2pdf/ptex2pdf.lua b/Build/source/texk/texlive/linked_scripts/ptex2pdf/ptex2pdf.lua
index f6e4fc0fbb6..3b0c5b5d62b 100755
--- a/Build/source/texk/texlive/linked_scripts/ptex2pdf/ptex2pdf.lua
+++ b/Build/source/texk/texlive/linked_scripts/ptex2pdf/ptex2pdf.lua
@@ -1,7 +1,7 @@
#!/usr/bin/env texlua
NAME = "ptex2pdf[.lua]"
-VERSION = "0.7"
+VERSION = "0.8"
AUTHOR = "Norbert Preining"
AUTHOREMAIL = "norbert@preining.info"
SHORTDESC = "Convert Japanese TeX documents to pdf"
@@ -152,11 +152,14 @@ CHANGELOG = [[
cygwin didn't like the (accidentally inserted) spaces after the
texlua in the shebang line, and stopped working with
"no such program: "texlua " ..."
-- version 0.7dev 2015-XX-XX
+- version 0.7 2015-04-29
move to github as gitorious will be closed, adapt help output
to generate github flavored markdown
check for files using kpathsea instead of opening directly, to allow
for input of files found by kpathsea (closes github issue 1)
+- version 0.8 2015-06-15
+ file name checks: first search for arg as is, then try .tex and .ltx
+ (closes github issue: 3)
]]
@@ -247,6 +250,7 @@ use_eptex = 0
use_uptex = 0
use_latex = 0
filename = ""
+bname = ""
exit_code = 0
narg = 1
repeat
@@ -323,46 +327,64 @@ end
-- initialize kpse
kpse.set_program_name(tex)
-if filename ~= "" and string.sub(filename, -4, -1) == ".tex" then
- filename = string.sub(filename, 1, -5)
+-- filename searching
+-- first search for the file as is,
+-- if not found, try file .tex, if that not found, file .ltx
+
+if ( filename == "" ) then
+ print("No filename argument given, exiting.")
+ os.exit(1)
+else
+ if ( kpse.find_file(filename) == nil ) then
+ -- try .tex extension
+ if ( kpse.find_file(filename .. ".tex") == nil ) then
+ -- last try .ltx
+ if ( kpse.find_file(filename .. ".ltx") == nil ) then
+ print("File cannot be found with kpathsea: ", filename .. "[.tex, .ltx]")
+ os.exit(1)
+ else
+ bname = filename
+ filename = filename .. ".ltx"
+ end
+ else
+ bname = filename
+ filename = filename .. ".tex"
+ end
+ else
+ -- if it has already an extension, we need to drop it to get the dvi name
+ bname = string.gsub(filename, "^(.*)%.[^.]+$", "%1")
+ end
end
--- if not io.open(filename .. ".tex", "r") then
--- print("Non-existent file: ", filename .. ".tex")
--- exit_code = 1
-if ( kpse.find_file(filename .. ".tex") == nil ) then
- print("File cannot be found with kpathsea: ", filename .. ".tex")
- exit_code = 1
-else
- -- make sure that on Windows/uptex we are using utf8 as command line encoding
- if use_uptex == 1 then
- if os.type == 'windows' then
- os.setenv('command_line_encoding', 'utf8')
- end
+-- we are still here, so we found a file
+-- make sure that on Windows/uptex we are using utf8 as command line encoding
+if use_uptex == 1 then
+ if os.type == 'windows' then
+ os.setenv('command_line_encoding', 'utf8')
end
- print("Processing ".. filename .. ".tex.")
- if (os.execute(tex .. " " .. texopts .. " \"" .. filename .. "\"") == 0) and
- (dvipdf == "" or (os.execute(dvipdf .. " " .. dvipdfopts .. " \"" .. filename .. "\"") == 0))
- then
- if dvipdf ~= "" then
- print(filename .. ".pdf generated by " .. dvipdf .. ".")
- end
- if intermediate == 1 then -- clean-up:
- if dvipdf ~= "" then
- os.remove( filename .. ".dvi" )
- end
- end
- else
- print("ptex2pdf processing of " .. filename .. ".tex fails.\n")
- exit_code = 2
- --[[ uncomment for debugging
- print("tex = ", tex)
- print("dvipdf = ", dvipdf)
- --]]
+end
+print("Processing ".. filename)
+if (os.execute(tex .. " " .. texopts .. " \"" .. filename .. "\"") == 0) and
+ (dvipdf == "" or (os.execute(dvipdf .. " " .. dvipdfopts .. " \"" .. bname .. ".dvi" .. "\"") == 0)) then
+ if dvipdf ~= "" then
+ print(bname .. ".pdf generated by " .. dvipdf .. ".")
+ end
+ if intermediate == 1 then -- clean-up:
+ if dvipdf ~= "" then
+ os.remove( bname .. ".dvi" )
end
-end --if not io.open ...
+ end
+else
+ print("ptex2pdf processing of " .. filename .. " failed.\n")
+ --[[ uncomment for debugging
+ print("tex = ", tex)
+ print("dvipdf = ", dvipdf)
+ --]]
+ os.exit(2)
+end
-os.exit( exit_code )
+-- all done ... exit with success
+os.exit( 0 )
diff --git a/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl b/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl
index 4bf66b2c952..53d5d70ce8b 100755
--- a/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl
+++ b/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# $Id: fmtutil.pl 37485 2015-05-23 16:52:36Z karl $
+# $Id: fmtutil.pl 37541 2015-06-15 00:00:42Z preining $
# fmtutil - utility to maintain format files.
# (Maintained in TeX Live:Master/texmf-dist/scripts/texlive.)
#
@@ -25,11 +25,11 @@ BEGIN {
}
-my $svnid = '$Id: fmtutil.pl 37485 2015-05-23 16:52:36Z karl $';
-my $lastchdate = '$Date: 2015-05-23 18:52:36 +0200 (Sat, 23 May 2015) $';
+my $svnid = '$Id: fmtutil.pl 37541 2015-06-15 00:00:42Z preining $';
+my $lastchdate = '$Date: 2015-06-15 02:00:42 +0200 (Mon, 15 Jun 2015) $';
$lastchdate =~ s/^\$Date:\s*//;
$lastchdate =~ s/ \(.*$//;
-my $svnrev = '$Revision: 37485 $';
+my $svnrev = '$Revision: 37541 $';
$svnrev =~ s/^\$Revision:\s*//;
$svnrev =~ s/\s*\$$//;
my $version = "r$svnrev ($lastchdate)";
@@ -228,11 +228,11 @@ sub main {
print_warning("--catcfg command not supported anymore!\n");
exit(1);
} elsif ($opts{'listcfg'}) {
- print_warning("--listcfg currently not implemented, be patient!\n");
+ return callback_list_cfg();
exit(1);
} elsif ($opts{'disablefmt'}) {
return callback_enable_disable_format($changes_config_file,
- $opts{'enablefmt'}, 'disabled');
+ $opts{'disablefmt'}, 'disabled');
} elsif ($opts{'enablefmt'}) {
return callback_enable_disable_format($changes_config_file,
$opts{'enablefmt'}, 'enabled');
@@ -665,14 +665,14 @@ sub enable_disable_format_engine {
my $origin = $alldata->{'merged'}{$fmt}{$eng}{'origin'};
if ($origin ne $tc) {
$alldata->{'fmtutil'}{$tc}{'formats'}{$fmt}{$eng} =
- {%{$alldata->{'fmtutil'}{$origin}{'formats'}{$fmt}{$eng}}}
+ {%{$alldata->{'fmtutil'}{$origin}{'formats'}{$fmt}{$eng}}};
+ $alldata->{'fmtutil'}{$tc}{'formats'}{$fmt}{$eng}{'line'} = -1;
}
$alldata->{'fmtutil'}{$tc}{'formats'}{$fmt}{$eng}{'status'} = $mode;
- $alldata->{'fmtutil'}{$tc}{'formats'}{$fmt}{$eng}{'line'} = -1;
- $alldata->{'fmtutil'}{$tc}{'formats'}{$fmt}{$eng}{'changed'} = 1;
+ $alldata->{'fmtutil'}{$tc}{'changed'} = 1;
$alldata->{'merged'}{$fmt}{$eng}{'status'} = $mode;
$alldata->{'merged'}{$fmt}{$eng}{'origin'} = $tc;
- dump_data();
+ # dump_data();
return save_fmtutil($tc);
}
} else {
@@ -732,12 +732,34 @@ sub callback_enable_disable_format {
}
}
+sub callback_list_cfg {
+ my @lines;
+ for my $f (keys %{$alldata->{'merged'}}) {
+ for my $e (keys %{$alldata->{'merged'}{$f}}) {
+ my $orig = $alldata->{'merged'}{$f}{$e}{'origin'};
+ my $hyph = $alldata->{'merged'}{$f}{$e}{'hyphen'};
+ my $stat = $alldata->{'merged'}{$f}{$e}{'status'};
+ my $args = $alldata->{'merged'}{$f}{$e}{'args'};
+ push @lines,
+ [ "$f/$e/$hyph",
+ "$f (engine=$e) $stat\n hyphen=$hyph, args=$args\n origin=$orig\n" ];
+ }
+ }
+ # sort lines
+ @lines = map { $_->[1] } sort { $a->[0] cmp $b->[0] } @lines;
+ print "List of all formats:\n";
+ print @lines;
+}
+
sub read_fmtutil_files {
my (@l) = @_;
for my $l (@l) { read_fmtutil_file($l); }
# in case the changes_config is a new one read it in and initialize it here
+ # the file might be already readable but not in ls-R so not found by
+ # kpsewhich. That means we need to check that it is readable and whether
+ # the lines entry is already defined
my $cc = $alldata->{'changes_config'};
- if (! -r $cc) {
+ if ((! -r $cc) || (!$alldata->{'fmtutil'}{$cc}{'lines'}) ) {
$alldata->{'fmtutil'}{$cc}{'lines'} = [ ];
}
#
@@ -946,6 +968,67 @@ sub determine_config_files {
+# returns 1 if actually saved due to changes
+sub save_fmtutil {
+ my $fn = shift;
+ return if $opts{'dry-run'};
+ my %fmtf = %{$alldata->{'fmtutil'}{$fn}};
+ if ($fmtf{'changed'}) {
+ TeXLive::TLUtils::mkdirhier(dirname($fn));
+ open (FN, ">$fn") || die "$prg: can't write to $fn: $!";
+ my @lines = @{$fmtf{'lines'}};
+ if (!@lines) {
+ print "Creating new config file $fn\n";
+ # update lsR database
+ $updLSR->add($fn);
+ $updLSR->exec();
+ $updLSR->reset();
+ }
+ # collect the lines with data
+ my %line_to_fmt;
+ my @add_fmt;
+ if (defined($fmtf{'formats'})) {
+ for my $f (keys %{$fmtf{'formats'}}) {
+ for my $e (keys %{$fmtf{'formats'}{$f}}) {
+ if ($fmtf{'formats'}{$f}{$e}{'line'} == -1) {
+ push @add_fmt, [ $f, $e ];
+ } else {
+ $line_to_fmt{$fmtf{'formats'}{$f}{$e}{'line'}} = [ $f, $e ];
+ }
+ }
+ }
+ }
+ for my $i (0..$#lines) {
+ if (defined($line_to_fmt{$i})) {
+ my $f = $line_to_fmt{$i}->[0];
+ my $e = $line_to_fmt{$i}->[1];
+ my $mode = $fmtf{'formats'}{$f}{$e}{'status'};
+ my $args = $fmtf{'formats'}{$f}{$e}{'args'};
+ my $hyph = $fmtf{'formats'}{$f}{$e}{'hyphen'};
+ my $p = ($mode eq 'disabled' ? "#! " : "");
+ print FN "$p$f $e $hyph $args\n";
+ } else {
+ print FN "$lines[$i]\n";
+ }
+ }
+ # add the new settings and maps
+ for my $m (@add_fmt) {
+ my $f = $m->[0];
+ my $e = $m->[1];
+ my $mode = $fmtf{'formats'}{$f}{$e}{'status'};
+ my $args = $fmtf{'formats'}{$f}{$e}{'args'};
+ my $hyph = $fmtf{'formats'}{$f}{$e}{'hyphen'};
+ my $p = ($mode eq 'disabled' ? "#! " : "");
+ print FN "$p$f $e $hyph $args\n";
+ }
+ close(FN) || warn("$prg: Cannot close file handle for $fn: $!");
+ delete $alldata->{'fmtutil'}{$fn}{'changed'};
+ return 1;
+ }
+ return 0;
+}
+
+
#
# $HOME and sudo and updmap-sys horror
# some instances of sudo do not reset $HOME to the home of root
diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
index 11741c5e5d8..76746e25f05 100755
--- a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
+++ b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
@@ -1,13 +1,13 @@
#!/usr/bin/env perl
-# $Id: tlmgr.pl 37488 2015-05-23 17:58:40Z karl $
+# $Id: tlmgr.pl 37523 2015-06-14 13:37:20Z preining $
#
# Copyright 2008-2015 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
#
-my $svnrev = '$Revision: 37488 $';
-my $datrev = '$Date: 2015-05-23 19:58:40 +0200 (Sat, 23 May 2015) $';
+my $svnrev = '$Revision: 37523 $';
+my $datrev = '$Date: 2015-06-14 15:37:20 +0200 (Sun, 14 Jun 2015) $';
my $tlmgrrevision;
my $prg;
if ($svnrev =~ m/: ([0-9]+) /) {
@@ -1553,6 +1553,10 @@ sub action_info {
if $tlp->cataloguedata->{'date'};
print "cat-license: ", $tlp->cataloguedata->{'license'}, "\n"
if $tlp->cataloguedata->{'license'};
+ print "cat-topics: ", $tlp->cataloguedata->{'topics'}, "\n"
+ if $tlp->cataloguedata->{'topics'};
+ print "cat-related: ", $tlp->cataloguedata->{'also'}, "\n"
+ if $tlp->cataloguedata->{'also'};
print "collection: ", @colls, "\n" if (@colls);
if ($opts{"list"}) {
if ($tlp->category eq "Collection" || $tlp->category eq "Scheme") {
@@ -1685,6 +1689,7 @@ sub search_pkg_desc {
my $t = "$pkg\n";
$t = $t . $tlp->shortdesc . "\n" if (defined($tlp->shortdesc));
$t = $t . $tlp->longdesc . "\n" if (defined($tlp->longdesc));
+ $t = $t . $tlp->cataloguedata->{'topics'} . "\n" if (defined($tlp->cataloguedata->{'topics'}));
my $pat = $what;
$pat = '\W' . $what . '\W' if ($inword);
my $matched = "";