From 1f73488085fbc7390bee70339aed31bc25997206 Mon Sep 17 00:00:00 2001 From: "aroben@apple.com" Date: Fri, 8 Jul 2011 20:58:44 +0000 Subject: [PATCH] Remove commit-log-editor's dependency on Module::Load::Conditional This module isn't available in Perl 5.8.8 (the version used on Leopard). Fixes REGRESSION (r90583): webkitpy.common.checkout.checkout_unittest failing on Leopard Reviewed by Daniel Bates. * Scripts/commit-log-editor: Use the new loadTermReadKey() function instead of Module::Load::Conditional::can_load. (loadTermReadKey): Added. Tries to load Term::ReadKey and returns true if it's successful. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@90664 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Tools/ChangeLog | 15 +++++++++++++++ Tools/Scripts/commit-log-editor | 10 ++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 9a4b096..1ebfc48 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,5 +1,20 @@ 2011-07-08 Adam Roben + Remove commit-log-editor's dependency on Module::Load::Conditional + + This module isn't available in Perl 5.8.8 (the version used on Leopard). + + Fixes REGRESSION (r90583): + webkitpy.common.checkout.checkout_unittest failing on Leopard + + Reviewed by Daniel Bates. + + * Scripts/commit-log-editor: Use the new loadTermReadKey() function instead of + Module::Load::Conditional::can_load. + (loadTermReadKey): Added. Tries to load Term::ReadKey and returns true if it's successful. + +2011-07-08 Adam Roben + Make checkout_unittest more robust against files moving around Fixes checkout_unittest contains ugly, fragile code to find the diff --git a/Tools/Scripts/commit-log-editor b/Tools/Scripts/commit-log-editor index fe9061b..a7dd239 100755 --- a/Tools/Scripts/commit-log-editor +++ b/Tools/Scripts/commit-log-editor @@ -34,13 +34,13 @@ use Getopt::Long; use File::Basename; use File::Spec; use FindBin; -use Module::Load::Conditional qw(can_load); use lib $FindBin::Bin; use VCSUtils; use webkitdirs; sub createCommitMessage(@); sub fixEnvironment(); +sub loadTermReadKey(); sub normalizeLineEndings($$); sub patchAuthorshipString($$$); sub removeLongestCommonPrefixEndingInDoubleNewline(\%); @@ -158,7 +158,7 @@ close LOG; $endl = $1 if $logContents =~ /(\r?\n)/; my $keepExistingLog = 1; -if ($regenerateLog && $existingLog && scalar(@changeLogs) > 0 && can_load(modules=>{ 'Term::ReadKey'=>undef })) { +if ($regenerateLog && $existingLog && scalar(@changeLogs) > 0 && loadTermReadKey()) { print "Existing log message detected, Use 'r' to regenerate log message from ChangeLogs, or any other key to keep the existing message.\n"; Term::ReadKey::ReadMode('cbreak'); my $key = Term::ReadKey::ReadKey(0); @@ -332,6 +332,12 @@ sub fixEnvironment() } } +sub loadTermReadKey() +{ + eval { require Term::ReadKey; }; + return !$@; +} + sub normalizeLineEndings($$) { my ($string, $endl) = @_; -- 1.8.3.1