diff options
author | Norbert Preining <norbert@preining.info> | 2021-05-21 14:11:47 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-06-10 23:11:40 +0900 |
commit | 18d19f08528af16cc09f82ccda7f38d57585c3a8 (patch) | |
tree | 63e1bf38e02fadc2b7a3b7fee2324f985aca6772 /Master/texmf-dist/scripts | |
parent | e90782a615eb546cae7930e198e276837f370e9c (diff) |
Rename Windows detection macros.
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/fmtutil.pl | 34 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 57 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgrgui.pl | 18 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/uninstall-win32.pl | 3 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/updmap.pl | 16 |
5 files changed, 62 insertions, 66 deletions
diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl index a32ada7fc2b..9679795414a 100755 --- a/Master/texmf-dist/scripts/texlive/fmtutil.pl +++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl @@ -42,9 +42,9 @@ use Cwd; # don't import anything automatically, this requires us to explicitly # call functions with TeXLive::TLUtils prefix, and makes it easier to # find and if necessary remove references to TLUtils -use TeXLive::TLUtils qw(); +use TeXLive::TLUtils qw(wndws); -require TeXLive::TLWinGoo if TeXLive::TLUtils::win32; +require TeXLive::TLWinGoo if wndws(); # numerical constants my $FMT_NOTSELECTED = 0; @@ -53,8 +53,8 @@ my $FMT_FAILURE = 2; my $FMT_SUCCESS = 3; my $FMT_NOTAVAIL = 4; -my $nul = (win32() ? 'nul' : '/dev/null'); -my $sep = (win32() ? ';' : ':'); +my $nul = (wndws() ? 'nul' : '/dev/null'); +my $sep = (wndws() ? ';' : ':'); my @deferred_stderr; my @deferred_stdout; @@ -84,7 +84,7 @@ chomp(our $TEXMFSYSCONFIG = `kpsewhich -var-value=TEXMFSYSCONFIG`); chomp(our $TEXMFHOME = `kpsewhich -var-value=TEXMFHOME`); # make sure that on windows *everything* is in lower case for comparison -if (win32()) { +if (wndws()) { $TEXMFDIST = lc($TEXMFDIST); $TEXMFVAR = lc($TEXMFVAR); $TEXMFSYSVAR = lc($TEXMFSYSVAR); @@ -280,7 +280,7 @@ sub main { # but for compatibility we'll silently keep the option. $cmd = 'edit'; my $editor = $ENV{'VISUAL'} || $ENV{'EDITOR'}; - $editor ||= (&win32 ? "notepad" : "vi"); + $editor ||= (&wndws ? "notepad" : "vi"); if (-r $changes_config_file) { ©File($changes_config_file, $bakFile); } else { @@ -389,7 +389,7 @@ sub callback_build_formats { # So make our own temp dir. my $tmpdir = ""; if (! $opts{"dry-run"}) { - if (win32()) { + if (wndws()) { my $foo; my $tmp_deflt = File::Spec->tmpdir; for my $i (1..5) { @@ -519,7 +519,7 @@ sub callback_build_formats { print_info("failed to build: $err (@err)\n") if ($err); print_info("total formats: $total\n"); chdir($thisdir) || warn "chdir($thisdir) failed: $!"; - if (win32()) { + if (wndws()) { # try to remove the tmpdir with all files TeXLive::TLUtils::rmtree($tmpdir); } @@ -1185,7 +1185,7 @@ sub determine_config_files { die "$prg: Config file \"$f\" not found"; } } - push @tmp, (win32() ? lc($f) : $f); + push @tmp, (wndws() ? lc($f) : $f); } @{$opts{'cnffile'}} = @tmp; # in case that config files are given on the command line, the first @@ -1196,12 +1196,12 @@ sub determine_config_files { chomp(@all_files); my @used_files; for my $f (@all_files) { - push @used_files, (win32() ? lc($f) : $f); + push @used_files, (wndws() ? lc($f) : $f); } # my $TEXMFLOCALVAR; my @TEXMFLOCAL; - if (win32()) { + if (wndws()) { chomp($TEXMFLOCALVAR =`kpsewhich --expand-path=\$TEXMFLOCAL`); @TEXMFLOCAL = map { lc } split(/;/ , $TEXMFLOCALVAR); } else { @@ -1337,7 +1337,7 @@ sub save_fmtutil { # and reset it to the real home dir of root. sub reset_root_home { - if (!win32() && ($> == 0)) { # $> is effective uid + if (!wndws() && ($> == 0)) { # $> is effective uid my $envhome = $ENV{'HOME'}; # if $HOME isn't an existing directory, we don't care. if (defined($envhome) && (-d $envhome)) { @@ -1406,16 +1406,6 @@ sub print_deferred_error { } -# copied from TeXLive::TLUtils to reduce dependencies -sub win32 { - if ($^O =~ /^MSWin/i) { - return 1; - } else { - return 0; - } -} - - # version, help. diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index e7117c23c62..b26cf4733bb 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -51,7 +51,11 @@ BEGIN { $Master =~ s!\\!/!g; $Master =~ s![^/]*$!../../..! unless ($Master =~ s!/texmf-dist/scripts/texlive/tlmgr\.pl$!!i); - $bindir = "$Master/bin/win32"; + if (tl_w32()) { + $bindir = "$Master/bin/win32"; + } else { + $bindir = "$Master/bin/win64"; + } $kpsewhichname = "kpsewhich.exe"; # path already set by wrapper batchfile } else { @@ -96,7 +100,7 @@ use TeXLive::TLWinGoo; use TeXLive::TLDownload; use TeXLive::TLConfFile; use TeXLive::TLCrypto; -TeXLive::TLUtils->import(qw(member info give_ctan_mirror win32 dirname +TeXLive::TLUtils->import(qw(member info give_ctan_mirror wndws tl_win32 tl_win64 dirname mkdirhier copy debug tlcmp repository_to_array)); use TeXLive::TLPaper; @@ -520,7 +524,7 @@ sub main { # and on Windows our Config.pm can apparently interfere, so always # skip it there. Or if users have NOPERLDOC set in the environment. my @noperldoc = (); - if (win32() || $ENV{"NOPERLDOC"}) { + if (wndws() || $ENV{"NOPERLDOC"}) { @noperldoc = ("-noperldoc", "1"); } else { if (!TeXLive::TLUtils::which("perldoc")) { @@ -843,7 +847,8 @@ sub do_cmd_and_check { if ($opts{"dry-run"}) { $ret = $F_OK; $out = ""; - } elsif (win32() && (! -r "$Master/bin/win32/luatex.dll")) { + } elsif ((tl_w32() && (! -r "$Master/bin/win32/luatex.dll")) || + (tl_w64() && (! -r "$Master/bin/win64/luatex.dll"))) { # deal with the case where only scheme-infrastructure is installed # on Windows, thus no luatex.dll is available and the wrapper cannot be started tlwarn("Cannot run wrapper due to missing luatex.dll\n"); @@ -1013,7 +1018,7 @@ sub handle_execute_actions { if ($regenerate_language) { for my $ext ("dat", "def", "dat.lua") { my $lang = "language.$ext"; - if (! TeXLive::TLUtils::win32()) { + if (! TeXLive::TLUtils::wndws()) { # Use full path for external command, except on Windows. $lang = "$TEXMFSYSVAR/tex/generic/config/$lang"; } @@ -1502,7 +1507,7 @@ sub action_path { } init_local_db(); my $winadminmode = 0; - if (win32()) { + if (wndws()) { # # for w32 we do system wide vs user setting detection as follows: # - if --w32mode is NOT given, @@ -1561,9 +1566,9 @@ sub action_path { } my $ret = $F_OK; if ($what =~ m/^add$/i) { - if (win32()) { + if (wndws()) { $ret |= TeXLive::TLUtils::w32_add_to_path( - $localtlpdb->root . "/bin/win32", + $localtlpdb->root . tl_w32() ? "/bin/win32" : "/bin/win64", $winadminmode); # ignore this return value, since broadcase_env might return # nothing in case of errors, and there is no way around it. @@ -1576,9 +1581,9 @@ sub action_path { $localtlpdb->option("sys_info")); } } elsif ($what =~ m/^remove$/i) { - if (win32()) { + if (wndws()) { $ret |= TeXLive::TLUtils::w32_remove_from_path( - $localtlpdb->root . "/bin/win32", + $localtlpdb->root . tl_w32() ? "/bin/win32" : "/bin/win64", $winadminmode); # ignore this return value, since broadcase_env might return # nothing in case of errors, and there is no way around it. @@ -3291,7 +3296,7 @@ sub action_update { } $updated{$pkg} = 1; next; - } elsif (win32() && ($pkg =~ m/$CriticalPackagesRegexp/)) { + } elsif (wndws() && ($pkg =~ m/$CriticalPackagesRegexp/)) { # we pretend that the update happened # in order to calculate file changes properly $updated{$pkg} = 1; @@ -3410,7 +3415,7 @@ sub action_update { # TODO logpackage("failed update: $pkg ($rev -> $mediarevstr)"); tlwarn("$prg: Installation of new version of $pkg failed, trying to unwind.\n"); - if (win32()) { + if (wndws()) { # w32 is notorious for not releasing a file immediately # we experienced permission denied errors my $newname = $unwind_package; @@ -3557,7 +3562,7 @@ sub action_update { my @found_pkgs = $localtlpdb->find_file($k); if ($#found_pkgs >= 0) { my $bad_file = 1; - if (win32()) { + if (wndws()) { # on w32 the packages have not been removed already, # so we check that the only package listed in @found_pkgs # is the one we are working on ($pkg) @@ -3583,7 +3588,7 @@ sub action_update { } } - if (!win32()) { + if (!wndws()) { for my $f (@infra_files_to_be_removed) { # TODO actually unlink the stuff #unlink("$Master/$f"); @@ -3614,7 +3619,7 @@ sub action_update { } # infra update and tlmgr restart on w32 is done by the updater batch script - if (win32() && $opts{'self'} && !$opts{"list"} && @critical) { + if (wndws() && $opts{'self'} && !$opts{"list"} && @critical) { info("$prg: Preparing TeX Live infrastructure update...\n"); for my $f (@infra_files_to_be_removed) { debug("file scheduled for removal $f\n"); @@ -3629,7 +3634,7 @@ sub action_update { } # only when we are not dry-running we restart the program - if (!win32() && $restart_tlmgr && !$opts{"dry-run"} && !$opts{"list"}) { + if (!wndws() && $restart_tlmgr && !$opts{"dry-run"} && !$opts{"list"}) { info("$prg: Restarting to complete update ...\n"); debug("restarting tlmgr @::SAVEDARGV\n"); # cleanup temp files before re-exec-ing tlmgr @@ -4760,11 +4765,11 @@ sub action_option { # ignore generate_update which is no longer used or needed. next if ($o eq "generate_updmap"); # ignore some things which are w32 specific - next if ($o eq "desktop_integration" && !win32()); - next if ($o eq "file_assocs" && !win32()); - next if ($o eq "w32_multi_user" && !win32()); + next if ($o eq "desktop_integration" && !wndws()); + next if ($o eq "file_assocs" && !wndws()); + next if ($o eq "w32_multi_user" && !wndws()); # - if (win32()) { + if (wndws()) { next if ($o =~ m/^sys_/); } if (defined $TLPDBOptions{$o}) { @@ -4828,7 +4833,7 @@ sub action_option { # when running w32 do not allow that a non-admin users sets # this from false to true my $do_it = 0; - if (win32()) { + if (wndws()) { if (admin()) { $do_it = 1; } else { @@ -5315,7 +5320,7 @@ Error message from creating MainWindow: # Return zero if successful, nonzero if failure. # sub uninstall_texlive { - if (win32()) { + if (wndws()) { printf STDERR "Please use \"Add/Remove Programs\" from the Control Panel " . "to uninstall TeX Live!\n"; return ($F_ERROR); @@ -6156,7 +6161,7 @@ sub action_postaction { tlwarn("$prg: action postaction needs as second argument one from 'shortcut', 'fileassoc', 'script'\n"); return; } - if (win32()) { + if (wndws()) { if ($opts{"w32mode"}) { if ($opts{"w32mode"} eq "user") { if (TeXLive::TLWinGoo::admin()) { @@ -6191,7 +6196,7 @@ sub action_postaction { @todo = $localtlpdb->expand_dependencies("-only-arch", $localtlpdb, @todo); } if ($type =~ m/^shortcut$/i) { - if (!win32()) { + if (!wndws()) { tlwarn("$prg: action postaction shortcut only works on windows.\n"); return; } @@ -6205,7 +6210,7 @@ sub action_postaction { } } } elsif ($type =~ m/^fileassoc$/i) { - if (!win32()) { + if (!wndws()) { tlwarn("$prg: action postaction fileassoc only works on windows.\n"); return; } @@ -6919,7 +6924,7 @@ sub init_local_db { # - if we are on Windows, it does not start with Drive:[\/] if (! ( $location =~ m!^(https?|ftp)://!i || $location =~ m!$TeXLive::TLUtils::SshURIRegex!i || - (win32() && (!(-e $location) || ($location =~ m!^.:[\\/]!) ) ) ) ) { + (wndws() && (!(-e $location) || ($location =~ m!^.:[\\/]!) ) ) ) ) { # seems to be a local path, try to normalize it my $testloc = abs_path($location); # however, if we were given a url, that will get "normalized" to the diff --git a/Master/texmf-dist/scripts/texlive/tlmgrgui.pl b/Master/texmf-dist/scripts/texlive/tlmgrgui.pl index 562ee8d1562..b6fee7e32fb 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgrgui.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgrgui.pl @@ -38,7 +38,7 @@ use Pod::Text; #use Devel::Leak; -use TeXLive::TLUtils qw(setup_programs platform_desc win32 debug); +use TeXLive::TLUtils qw(setup_programs platform_desc wndws debug); use TeXLive::TLConfig; # @@ -509,7 +509,7 @@ sub setup_menu_system { $menu->add('cascade', -label => __("Actions"), -menu => $menu_actions); } # on win32 people expect to have the Help button on the right side - if (win32()) { $menu->add('separator'); } + if (wndws()) { $menu->add('separator'); } $menu->add('cascade', -label => __("Help"), -menu => $menu_help); # @@ -545,7 +545,7 @@ sub setup_menu_system { -command => sub { do_general_settings(); }); $menu_options->add('command', -label => __("Paper ..."), -command => sub { do_paper_settings(); }); - if (!win32() && $mode_expert) { + if (!wndws() && $mode_expert) { $menu_options->add('command', -label => __("Platforms ..."), -command => sub { do_arch_settings(); }); } @@ -608,13 +608,13 @@ sub setup_menu_system { -state => $::action_button_state, -command => \&cb_handle_restore); - if (!win32()) { + if (!wndws()) { $menu_actions->add('command', -label => __("Handle symlinks in system dirs") . " ...", -state => $::action_button_state, -command => \&cb_handle_symlinks); } - if (!win32()) { + if (!wndws()) { $menu_actions->add('separator'); $menu_actions->add('command', -label => __("Remove TeX Live %s ...", $TeXLive::TLConfig::ReleaseYear), -state => $::action_button_state, @@ -1190,7 +1190,7 @@ sub do_general_settings { $back_config_set->Button(-text => __("Change"), -command => sub { select_autobackup($sw); }); - if (!win32()) { + if (!wndws()) { push @config_set_l, $back_config_set->Label(-text => __("Link destination for programs"), -anchor => "w"); $settings_label{'sys_bin'} = $back_config_set->Label(-textvariable => \$changeddefaults{"sys_bin"}{'display'}); @@ -1216,7 +1216,7 @@ sub do_general_settings { -command => sub { edit_dir_option ($sw, "sys_man"); }); } - if (win32()) { + if (wndws()) { push @config_set_l, $back_config_set->Label(-text => __("Create shortcuts on the desktop"), -anchor => "w"); $settings_label{'desktop_integration'} = $back_config_set->Label(-textvariable => \$changeddefaults{"desktop_integration"}{'display'}); @@ -1289,7 +1289,7 @@ sub apply_settings_changes { ########## PAPER HANDLING ################# sub init_paper_xdvi { - if (!win32()) { + if (!wndws()) { $papers{"xdvi"} = TeXLive::TLPaper::get_paper_list("xdvi"); $currentpaper{"xdvi"} = $papers{"xdvi"}->[0]; } @@ -2274,7 +2274,7 @@ You can then restart it to proceed with further updates."); $t .= "\n\n" . __("(Further updates will be available after tlmgr has been updated.)"); } - $t .= "\n\n" . __("Please wait a bit after the program has terminated so that the update can be completed.") if win32(); + $t .= "\n\n" . __("Please wait a bit after the program has terminated so that the update can be completed.") if wndws(); $sw->add("Label", -text => $t)->pack(-padx => "3m", -pady => "3m"); $sw->Show; } diff --git a/Master/texmf-dist/scripts/texlive/uninstall-win32.pl b/Master/texmf-dist/scripts/texlive/uninstall-win32.pl index 71aa86652a4..17dbaff1c9e 100755 --- a/Master/texmf-dist/scripts/texlive/uninstall-win32.pl +++ b/Master/texmf-dist/scripts/texlive/uninstall-win32.pl @@ -61,7 +61,8 @@ sub doit { `rmdir /s /q "$menupath\\$TeXLive::TLConfig::WindowsMainMenuName" 2>nul`; # remove bindir from PATH settings - TeXLive::TLUtils::w32_remove_from_path("$Master/bin/win32", + TeXLive::TLUtils::w32_remove_from_path( + TeXLive::TLUtils::tl_w32 ? "$Master/bin/win32" : "$Master/bin/win64", $localtlpdb->option("w32_multi_user")); # unsetenv_reg("TEXBINDIR"); diff --git a/Master/texmf-dist/scripts/texlive/updmap.pl b/Master/texmf-dist/scripts/texlive/updmap.pl index bda82741eea..e9b53fb76aa 100755 --- a/Master/texmf-dist/scripts/texlive/updmap.pl +++ b/Master/texmf-dist/scripts/texlive/updmap.pl @@ -37,7 +37,7 @@ my $version = "r$svnrev ($lastchdate)"; use Getopt::Long qw(:config no_autoabbrev ignore_case_always); use strict; -use TeXLive::TLUtils qw(mkdirhier mktexupd win32 basename dirname +use TeXLive::TLUtils qw(mkdirhier mktexupd wndws basename dirname sort_uniq member touch); (my $prg = basename($0)) =~ s/\.pl$//; @@ -54,7 +54,7 @@ chomp(my $TEXMFSYSCONFIG = `kpsewhich -var-value=TEXMFSYSCONFIG`); chomp(my $TEXMFHOME = `kpsewhich -var-value=TEXMFHOME`); # make sure that on windows *everything* is in lower case for comparison -if (win32()) { +if (wndws()) { $TEXMFDIST = lc($TEXMFDIST); $TEXMFVAR = lc($TEXMFVAR); $TEXMFSYSVAR = lc($TEXMFSYSVAR); @@ -232,7 +232,7 @@ sub main { if (! -f $f) { die "$prg: Config file \"$f\" not found."; } - push @tmp, (win32() ? lc($f) : $f); + push @tmp, (wndws() ? lc($f) : $f); } @{$opts{'cnffile'}} = @tmp; # in case that config files are given on the command line, the first @@ -243,12 +243,12 @@ sub main { chomp(@all_files); my @used_files; for my $f (@all_files) { - push @used_files, (win32() ? lc($f) : $f); + push @used_files, (wndws() ? lc($f) : $f); } # my $TEXMFLOCALVAR; my @TEXMFLOCAL; - if (win32()) { + if (wndws()) { chomp($TEXMFLOCALVAR =`kpsewhich --expand-path=\$TEXMFLOCAL`); @TEXMFLOCAL = map { lc } split(/;/ , $TEXMFLOCALVAR); } else { @@ -422,7 +422,7 @@ sub main { # but for compatibility we'll silently keep the option. $cmd = 'edit'; my $editor = $ENV{'VISUAL'} || $ENV{'EDITOR'}; - $editor ||= (&win32 ? "notepad" : "vi"); + $editor ||= (wndws() ? "notepad" : "vi"); if (-r $changes_config_file) { ©File($changes_config_file, $bakFile); } else { @@ -593,7 +593,7 @@ sub setupSymlinks { sub SymlinkOrCopy { my ($dir, $src, $dest) = @_; return ($src, $dest) if $opts{"dry-run"}; - if (&win32 || $opts{'copy'}) { # always copy + if (wndws() || $opts{'copy'}) { # always copy ©File("$dir/$src", "$dir/$dest"); } else { # symlink if supported by fs, copy otherwise system("cd \"$dir\" && ln -s $src $dest 2>/dev/null || " @@ -2216,7 +2216,7 @@ sub merge_data { # and reset it to the real home dir of root. sub reset_root_home { - if (!win32() && ($> == 0)) { # $> is effective uid + if (!wndws() && ($> == 0)) { # $> is effective uid my $envhome = $ENV{'HOME'}; # if $HOME isn't an existing directory, we don't care. if (defined($envhome) && (-d $envhome)) { |