[dpkg] 106/192: Dpkg::ErrorHandling: Only load Term::ANSIColor if we are using colors
Ximin Luo
infinity0 at debian.org
Tue Oct 17 11:04:06 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit 8829502bfc75a74b1539634bb3ca1f801589c0ff
Author: Guillem Jover <guillem at debian.org>
Date: Fri Jul 14 00:36:21 2017 +0200
Dpkg::ErrorHandling: Only load Term::ANSIColor if we are using colors
If we are not using colors we should not be imposing the additional load
times over most modules using the error handling functionality.
---
debian/changelog | 2 ++
scripts/Dpkg/ErrorHandling.pm | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 7e26637..d9f7b86 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,8 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
- Only load Dpkg::BuildOptions and Dpkg::Arch from Dpkg::Vendor-specific
modules if we are going to use them, reducing the load time of many
other modules.
+ - Only load Term::ANSIColor from Dpkg::ErrorHandling if we are going to
+ use colors, reducing the load time of many other modules.
* Documentation:
- Document currently accepted syntax for changelogs in deb-changelog(5).
Closes: #858579
diff --git a/scripts/Dpkg/ErrorHandling.pm b/scripts/Dpkg/ErrorHandling.pm
index 51424ef..b1f5ed0 100644
--- a/scripts/Dpkg/ErrorHandling.pm
+++ b/scripts/Dpkg/ErrorHandling.pm
@@ -45,7 +45,6 @@ our @EXPORT = qw(
);
use Exporter qw(import);
-use Term::ANSIColor;
use Dpkg ();
use Dpkg::Gettext;
@@ -67,6 +66,8 @@ sub setup_color
} else {
$use_color = 0;
}
+
+ require Term::ANSIColor if $use_color;
}
setup_color();
@@ -153,7 +154,7 @@ sub report_pretty
my ($msg, $color) = @_;
if ($use_color) {
- return colored($msg, $color);
+ return Term::ANSIColor::colored($msg, $color);
} else {
return $msg;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list