From f98bbd8ba046ef06a3dcba4677f431740f92f6bc Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Thu, 9 May 2019 08:58:01 +0000 Subject: help and profile now default text mode everywhere git-svn-id: svn://tug.org/texlive/trunk@51056 c570f23f-e606-0410-a88d-b1316a301751 --- Master/install-tl | 76 ++++++++++++++++++++++++++++--------------- Master/install-tl-windows.bat | 57 ++++++++++++++++++++++++-------- 2 files changed, 92 insertions(+), 41 deletions(-) diff --git a/Master/install-tl b/Master/install-tl index abe4ca265f7..58858b3a9a2 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -38,43 +38,65 @@ BEGIN { if (($^O !~ /^MSWin/i) && # this wrapper is only for unix, since windows has its own wrapper ($#ARGV >= 0 || ($^O eq 'darwin')) && - # tcl parameter may still come, or tcl is default + # tcl parameter may still come, or tcl is default ($#ARGV < 0 || $ARGV[0] ne '-from_ext_gui') - # this run is not invoked by tcl + # this run is not invoked by tcl ) { - my $want_tcl = ($^O eq 'darwin'); + + # make syntax uniform: --a => -a, a=b => 'a b' + my @tmp_args = (); + my $p; my $i=-1; - my @new_args = (); while ($i<$#ARGV) { - # build argument array @new_args for install-tl-gui.tcl. - # quit scanning and building @new_args once tcl is ruled out. - my $p = $ARGV[++$i]; - if ($p =~ /^-?-gui=(.*$)/) { - if ($1 eq 'tcl') { - $want_tcl = 1; - } else { - last; # other gui - } - } elsif ($p =~ /^-?-gui/ && $p !~ /^-?-gui-lang/) { + $p = $ARGV[++$i]; + $p =~ s/^--/-/; + if ($p =~ /^(.*)=(.*)$/) { + push (@tmp_args, $1, $2); + } else { + push (@tmp_args, $p); + } + } + + # build argument array @new_args for install-tl-gui.tcl. + # '-gui' or '-gui tcl' will not be copied to @new_args. + # quit scanning and building @new_args once tcl is ruled out. + my $want_tcl = ($^O eq 'darwin'); + my $asked4tcl = 0; + my @new_args = (); + $i = -1; + while ($i < $#tmp_args) { + $p = $tmp_args[++$i]; + if ($p eq '-gui') { # look ahead at next parameter - if ($i == $#ARGV) { - $want_tcl = 1; # default gui - last; - } elsif ($ARGV[$i+1] eq 'tcl') { - $i++; + if ($i == $#tmp_args || $tmp_args[$i+1] =~ /^-/) { + $want_tcl = 1; # default value for -gui + $asked4tcl = 1; + } elsif ($tmp_args[$i+1] eq 'tcl') { $want_tcl = 1; - } elsif ($ARGV[$i+1] eq 'expert' || $ARGV[$i+1] eq 'perltk' || - $ARGV[$i+1] eq 'wizard' || $ARGV[$i+1] eq 'text') { + $asked4tcl = 1; + $i++; + } else { # other value for -gui $want_tcl = 0; last; - } else { - # next parameter relates to something else, so default gui is wanted - $want_tcl = 1; } - } elsif ($p =~ /^-?-no-gui/) { - $want_tcl = 0; - last; } else { + my $forbid = 0; + for my $q (qw/in-place profile help/) { + if ($p eq "-$q") { + # default text mode + $want_tcl = 0 unless $asked4tcl; + last; + } + } + for my $q (qw/print-platform version no-gui/) { + if ($p eq "-$q") { + # enforce text mode + $want_tcl = 0; + $forbid = 1; + last; + } + } + last if $forbid; # not gui-related, continue collecting @new_args push (@new_args, $p); } diff --git a/Master/install-tl-windows.bat b/Master/install-tl-windows.bat index 2ec5f2f77fd..e20a653c6a7 100755 --- a/Master/install-tl-windows.bat +++ b/Master/install-tl-windows.bat @@ -29,7 +29,8 @@ for /f "usebackq tokens=2 delims='" %%a in (`perl -V:version 2^>NUL`) do ( rem set instroot before %0 gets overwritten during argument processing set instroot=%~dp0 -set notcl=no +set asked4gui=no +set forbid=no set tcl=yes set args= goto rebuildargs @@ -45,35 +46,42 @@ rem code block for gui argument :dogui if x == x%1 ( set tcl=yes +set asked4gui=yes shift goto rebuildargs ) if text == %1 ( set tcl=no +set forbid=yes set args=%args% -no-gui shift goto rebuildargs ) else if wizard == %1 ( set tcl=yes +set asked4gui=yes shift goto rebuildargs ) else if perltk == %1 ( set tcl=yes +set asked4gui=yes shift goto rebuildargs ) else if expert == %1 ( set tcl=yes +set asked4gui=yes shift goto rebuildargs ) else if tcl == %1 ( set tcl=yes +set asked4gui=yes shift goto rebuildargs ) else ( set tcl=yes +set asked4gui=yes goto rebuildargs ) -rem last case: -gui without parameter, do not shift +rem last case was -gui without parameter to shift rem loop for argument scanning :rebuildargs @@ -82,30 +90,51 @@ set p= set q= if x == x%0 goto nomoreargs set p=%0 + rem flip backslashes, if any set p=%p:\=/% -rem replace -- with - but test with quotes replaced with something else + +rem replace '--' with '-' but replace quotes in %p +rem with something else for comparing set q=%p:"=x% if not "%q:~,2%" == "--" goto nominmin set p=%p:~1% :nominmin -if -print-platform == %p% set tcl=no -if -version == %p% set tcl=no + +rem countermand gui parameter for short output. +rem assume text mode for help and for profile install, +rem unless gui was explicitly requested. +if -print-platform == %p% ( +set tcl=no +set forbid=yes +) +if -version == %p% ( +set tcl=no +set forbid=yes +) if -no-gui == %p% ( -set notcl=yes -set args=%args% -no-gui -goto rebuildargs +set tcl=no +set forbid=yes +) +if -profile == %p% ( +if no == %asked4gui% ( +set tcl=no +) +) +if -help == %p% ( +if no == %asked4gui% ( +set tcl=no +) ) if -gui == %p% goto dogui -rem not a gui argument: copy to args string +rem -no-gui or not a gui argument: copy to args string rem a spurious initial blank is harmless. set args=%args% %p% goto rebuildargs :nomoreargs - -if yes == %notcl% set tcl=no +if %forbid% == yes set tcl=no rem Check for tex directories on path and remove them. rem Need to remove any double quotes from path @@ -158,9 +187,9 @@ rem echo "%instroot%tlpkg\tltcl\tclkit.exe" "%instroot%tlpkg\installer\install-t rem pause "%instroot%tlpkg\tltcl\tclkit.exe" "%instroot%tlpkg\installer\install-tl-gui.tcl" -- %args% ) else ( -rem echo perl "%instroot%install-tl" %args% -rem pause -perl "%instroot%install-tl" %args% +echo perl "%instroot%install-tl" %args% +pause +rem perl "%instroot%install-tl" %args% ) rem The nsis installer will need this: -- cgit v1.2.3