texlive[51056] Master: help and profile now default text mode

commits+siepo at tug.org commits+siepo at tug.org
Thu May 9 10:58:01 CEST 2019


Revision: 51056
          http://tug.org/svn/texlive?view=revision&revision=51056
Author:   siepo
Date:     2019-05-09 10:58:01 +0200 (Thu, 09 May 2019)
Log Message:
-----------
help and profile now default text mode everywhere

Modified Paths:
--------------
    trunk/Master/install-tl
    trunk/Master/install-tl-windows.bat

Modified: trunk/Master/install-tl
===================================================================
--- trunk/Master/install-tl	2019-05-08 23:38:12 UTC (rev 51055)
+++ trunk/Master/install-tl	2019-05-09 08:58:01 UTC (rev 51056)
@@ -38,43 +38,65 @@
 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
     ) {
+
+  # make syntax uniform: --a => -a, a=b => 'a b'
+  my @tmp_args = ();
+  my $p;
+  my $i=-1;
+  while ($i<$#ARGV) {
+    $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 $i=-1;
+  my $asked4tcl = 0;
   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') {
+  $i = -1;
+  while ($i < $#tmp_args) {
+    $p = $tmp_args[++$i];
+    if ($p eq '-gui') {
+      # look ahead at next parameter
+      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;
-      } else {
-        last; # other gui
-      }
-    } elsif ($p =~ /^-?-gui/ && $p !~ /^-?-gui-lang/) {
-      # look ahead at next parameter
-      if ($i == $#ARGV) {
-        $want_tcl = 1; # default gui
-        last;
-      } elsif ($ARGV[$i+1] eq 'tcl') {
+        $asked4tcl = 1;
         $i++;
-        $want_tcl = 1;
-      } elsif ($ARGV[$i+1] eq 'expert' || $ARGV[$i+1] eq 'perltk' ||
-                 $ARGV[$i+1] eq 'wizard' || $ARGV[$i+1] eq 'text') {
+      } 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);
     }

Modified: trunk/Master/install-tl-windows.bat
===================================================================
--- trunk/Master/install-tl-windows.bat	2019-05-08 23:38:12 UTC (rev 51055)
+++ trunk/Master/install-tl-windows.bat	2019-05-09 08:58:01 UTC (rev 51056)
@@ -29,7 +29,8 @@
 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 @@
 :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,31 +90,52 @@
 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 %forbid% == yes set tcl=no
 
-if yes == %notcl% set tcl=no
-
 rem Check for tex directories on path and remove them.
 rem Need to remove any double quotes from path
 set path=%path:"=%
@@ -158,9 +187,9 @@
 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:



More information about the tex-live-commits mailing list