diff options
author | Norbert Preining <preining@logic.at> | 2017-11-11 07:21:13 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2017-11-11 07:21:13 +0000 |
commit | 340f5c8eff5fb4baaac3b9d9c48aa974f7a489a3 (patch) | |
tree | 8acc98f3a91723f63204ba4bdda21fdc2cce9a85 /Master/texmf-dist | |
parent | 7dd43e0f528f7f7c28d31cf49699dea37d2539f8 (diff) |
json: dynamically select tl internal or external json mode
git-svn-id: svn://tug.org/texlive/trunk@45745 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index d266ddea84a..e74eff61c44 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -86,9 +86,6 @@ BEGIN { # make Perl find our packages first: unshift (@INC, "$Master/tlpkg"); - # add also tlpkg/TeXLive for copied modules like JSON which - # requests JSON::BackportPP - unshift (@INC, "$Master/tlpkg/TeXLive"); unshift (@INC, "$Master/texmf-dist/scripts/texlive"); } @@ -581,19 +578,6 @@ for the full story.\n"; tldie("$prg: Try --help if you need it.\n"); } - if ($opts{'json'}) { - eval { require JSON; }; - if ($@) { - # that didn't work out, give some usefull error message and stop - if ($^O =~ /^MSWin/i) { - require Win32; - my $msg = "Cannot load JSON, that should not happen as we ship it!\n(Error message: $@)\nStopping here.\n"; - Win32::MsgBox($msg, 1|Win32::MB_ICONSTOP(), "Warning"); - } - tldie("Cannot load JSON module, this should not happen, please report!\n"); - } - } - # # the main tree we will be working on $::maintree = $Master; @@ -1859,7 +1843,7 @@ sub action_restore { if (keys %backups) { if ($opts{'json'}) { my @bla = map { report_backup_revdate($_, "json", %{$backups{$_}}) } keys %backups; - my $str = JSON::encode_json(\@bla); + my $str = TeXLive::TLUtils::encode_json(\@bla); print "$str\n"; } else { print "Available backups:\n"; @@ -1877,7 +1861,7 @@ sub action_restore { if (!defined($rev)) { if ($opts{'json'}) { my @bla = report_backup_revdate($pkg, "json", %{$backups{$pkg}}); - my $str = JSON::encode_json(\@bla); + my $str = TeXLive::TLUtils::encode_json(\@bla); print "$str\n"; } else { print "Available backups for $pkg: "; @@ -3673,7 +3657,6 @@ sub show_one_package { } sub show_one_package_json { - require JSON; my ($p) = @_; my @out; my $loctlp = $localtlpdb->get_package($p); @@ -3691,8 +3674,8 @@ sub show_one_package_json { my $tlp = ($is_installed ? $loctlp : $remtlp); #my $tlp = ($is_available ? $remtlp : $loctlp); # add available, installed, lrev, rrev fields and remove revision field - my $str = $tlp->as_json(available => ($is_available ? $JSON::true : $JSON::false), - installed => ($is_installed ? $JSON::true : $JSON::false), + my $str = $tlp->as_json(available => ($is_available ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False()), + installed => ($is_installed ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False()), lrev => ($is_installed ? $loctlp->revision : 0), rrev => ($is_available ? $remtlp->revision : 0), revision => undef); |