summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2012-04-08 11:59:02 +0000
committerNorbert Preining <preining@logic.at>2012-04-08 11:59:02 +0000
commite960ace7286c93805851de001178904958fb3c97 (patch)
tree3f1d9f4a2473fbeb251098b49e45b6721f796cdc /Master
parent17420727bb6e8eed8afff943f11cda347e889883 (diff)
allow TLPaper.pm to override file names and path components
git-svn-id: svn://tug.org/texlive/trunk@25874 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/tlpkg/TeXLive/TLPaper.pm92
1 files changed, 61 insertions, 31 deletions
diff --git a/Master/tlpkg/TeXLive/TLPaper.pm b/Master/tlpkg/TeXLive/TLPaper.pm
index 2ac7c8e02a5..19df02330d0 100644
--- a/Master/tlpkg/TeXLive/TLPaper.pm
+++ b/Master/tlpkg/TeXLive/TLPaper.pm
@@ -22,6 +22,17 @@ sub module_revision {
return $_modulerevision;
}
+BEGIN {
+ use Exporter ();
+ use vars qw( @ISA @EXPORT_OK @EXPORT );
+ @ISA = qw(Exporter);
+ @EXPORT_OK = qw(
+ %paper_config_path_component
+ %paper_config_name
+ );
+ @EXPORT = @EXPORT_OK;
+}
+
=pod
=head1 NAME
@@ -51,18 +62,28 @@ my %paper_sub = (
# Where to write to by default.
my %default_paper_config_path_component = (
- "xdvi" => "xdvi/XDvi",
- "pdftex" => "tex/generic/config/pdftexconfig.tex",
- "dvips" => "dvips/config/config.ps",
- "dvipdfmx" => "dvipdfmx/dvipdfmx.cfg",
- "dvipdfm" => "dvipdfm/config/config",
- "context" => "tex/context/user/cont-sys.tex",
+ "xdvi" => "xdvi",
+ "pdftex" => "tex/generic/config",
+ "dvips" => "dvips/config",
+ "dvipdfmx" => "dvipdfmx",
+ "dvipdfm" => "dvipdfm",
+ "context" => "tex/context/user",
+);
+
+my %default_paper_config_name = (
+ "xdvi" => "XDvi",
+ "pdftex" => "pdftexconfig.tex",
+ "dvips" => "config.ps",
+ "dvipdfmx" => "dvipdfmx.cfg",
+ "dvipdfm" => "config",
+ "context" => "cont-sys.tex",
);
# Output is done to the components in this hash.
# If a value is undefined, we take the one from %default_...
#
-my %paper_config_path_component;
+our %paper_config_path_component;
+our %paper_config_name;
my %xdvi_papersize = (
@@ -213,6 +234,15 @@ sub find_paper_file {
return $ret;
}
+sub setup_names {
+ my $prog = shift;
+ my $outcomp = $paper_config_path_component{$prog}
+ || $default_paper_config_path_component{$prog};
+ my $filecomp = $paper_config_name{$prog}
+ || $default_paper_config_name{$prog};
+ return ($outcomp, $filecomp);
+}
+
# xdvi format:
# /--- XDvi ---
@@ -228,12 +258,12 @@ sub paper_xdvi {
my $outtree = shift;
my $newpaper = shift;
- my $inp = &find_paper_file("xdvi", "other text files", "XDvi");
+ my ($outcomp, $filecomp) = setup_names("xdvi");
+ my $outfile = "$outtree/$outcomp/$filecomp";
+ my $inp = &find_paper_file("xdvi", "other text files", $filecomp);
+
return unless $inp;
- my $outcomp = $paper_config_path_component{"xdvi"}
- || $default_paper_config_path_component{"xdvi"};
- my $outfile = "$outtree/$outcomp";
my @sizes = keys %xdvi_papersize;
return &paper_do_simple($inp, "xdvi", '^\*paper: ', '^\*paper:\s+(\w+)\s*$',
@@ -260,11 +290,10 @@ sub paper_pdftex {
my $outtree = shift;
my $newpaper = shift;
- my $outcomp = $paper_config_path_component{"pdftex"}
- || $default_paper_config_path_component{"pdftex"};
- my $outfile = "$outtree/$outcomp";
-
- my $inp = &find_paper_file("pdftex", "tex", "pdftexconfig.tex");
+ my ($outcomp, $filecomp) = setup_names("pdftex");
+ my $outfile = "$outtree/$outcomp/$filecomp";
+ my $inp = &find_paper_file("pdftex", "tex", $filecomp);
+
return unless $inp;
open(FOO, "<$inp") || die "$0: open($inp) failed: $!";
@@ -405,13 +434,12 @@ sub paper_dvips {
my $outtree = shift;
my $newpaper = shift;
- my $inp = &find_paper_file("dvips", "dvips config", "config.ps");
+ my ($outcomp, $filecomp) = setup_names("dvips");
+ my $outfile = "$outtree/$outcomp/$filecomp";
+ my $inp = &find_paper_file("dvips", "dvips config", $filecomp);
+
return unless $inp;
- my $outcomp = $paper_config_path_component{"dvips"}
- || $default_paper_config_path_component{"dvips"};
- my $outfile = "$outtree/$outcomp";
-
open(FOO, "<$inp") || die "$0: open($inp) failed: $!";
my @lines = <FOO>;
close(FOO);
@@ -511,9 +539,10 @@ sub paper_dvips {
#
sub do_dvipdfm_and_x {
my ($inp,$prog,$outtree,$paplist,$newpaper) = @_;
- my $outcomp = $paper_config_path_component{$prog}
- || $default_paper_config_path_component{$prog};
- my $outfile = "$outtree/$outcomp";
+
+ my ($outcomp, $filecomp) = setup_names($prog);
+ my $outfile = "$outtree/$outcomp/$filecomp";
+
return &paper_do_simple($inp, $prog, '^p\s+', '^p\s+(\w+)\s*$',
sub {
my ($ll,$np) = @_;
@@ -526,7 +555,8 @@ sub paper_dvipdfm {
my $outtree = shift;
my $newpaper = shift;
- my $inp = &find_paper_file("dvipdfm", "other text files", "config");
+ my ($outcomp, $filecomp) = setup_names("dvipdfm");
+ my $inp = &find_paper_file("dvipdfm", "other text files", $filecomp);
return () unless $inp;
my @sizes = keys %dvipdfm_papersize;
@@ -537,7 +567,9 @@ sub paper_dvipdfmx {
my $outtree = shift;
my $newpaper = shift;
- my $inp = &find_paper_file("dvipdfmx", "other text files", "dvipdfmx.cfg");
+ my ($outcomp, $filecomp) = setup_names("dvipdfmx");
+
+ my $inp = &find_paper_file("dvipdfmx", "other text files", $filecomp);
return () unless $inp;
my @sizes = keys %dvipdfm_papersize;
@@ -556,11 +588,9 @@ sub paper_context {
my $outtree = shift;
my $newpaper = shift;
- my $outcomp = $paper_config_path_component{"context"}
- || $default_paper_config_path_component{"context"};
- my $outfile = "$outtree/$outcomp";
-
- my $inp = &find_paper_file("context", "tex", "cont-sys.tex", "cont-sys.rme");
+ my ($outcomp, $filecomp) = setup_names("context");
+ my $outfile = "$outtree/$outcomp/$filecomp";
+ my $inp = &find_paper_file("context", "tex", $filecomp, "cont-sys.rme");
return () unless $inp;
my @sizes = keys %pdftex_papersize;