Bugzilla – Attachment 85571 Details for
Bug 21892
Robin Sheat is not a typo
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21892: Purposefully update codespell
Bug-21892-Purposefully-update-codespell.patch (text/plain), 2.66 KB, created by
Mark Tompsett
on 2019-02-22 18:21:31 UTC
(
hide
)
Description:
Bug 21892: Purposefully update codespell
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2019-02-22 18:21:31 UTC
Size:
2.66 KB
patch
obsolete
>From 10c6cf537f68b7abcf8220f6878cccb1676fb039 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Fri, 22 Feb 2019 18:16:15 +0000 >Subject: [PATCH] Bug 21892: Purposefully update codespell > >This detects if codespell has -L option, and if not, >it purposefully uninstalls it, and then installs the >version it needs via 'pip install'. > >It also tweaks the detection of codespell installation. >--- > QohA/File.pm | 32 +++++++++++++++++++++++++++++++- > koha-qa.pl | 7 ++++++- > 2 files changed, 37 insertions(+), 2 deletions(-) > >diff --git a/QohA/File.pm b/QohA/File.pm >index 863bb92..e37afb4 100644 >--- a/QohA/File.pm >+++ b/QohA/File.pm >@@ -96,10 +96,40 @@ sub check_forbidden_patterns { > : 1; > } > >+sub codespell_has_L_option { >+ my $cmd = q{codespell --help | grep "\-L" | wc -l}; >+ my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 ); >+ my $result = $full_buf->[0]; >+ return $result + 0; >+} >+ >+sub remove_codespell { >+ my $cmd = q{sudo apt remove -y codespell}; >+ my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 ); >+ $cmd = q{sudo -H pip uninstall -y codespell}; >+ ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 ); >+} >+ >+sub install_codespell { >+ my $cmd = q{sudo -H pip install codespell}; >+ my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 ); >+} >+ >+sub tell_bash_to_unhash_codespell { >+ my $cmd = q{hash -d codespell}; >+ my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 ); >+} >+ > sub check_spelling { > my ($self) = @_; > >- my $cmd = q{codespell -L Sheat -d } . $self->path; >+ if (! codespell_has_L_option()) { >+ print STDERR "\nCodespell missing required -L option!\n"; >+ remove_codespell; >+ install_codespell; >+ tell_bash_to_unhash_codespell; >+ } >+ my $cmd = q{codespell -L sheat -d } . $self->path; > my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 ); > > return 0 unless @$full_buf; >diff --git a/koha-qa.pl b/koha-qa.pl >index 609f922..098393a 100755 >--- a/koha-qa.pl >+++ b/koha-qa.pl >@@ -41,8 +41,13 @@ BEGIN { > } > > our @tests_to_skip = (); >+# Check for codespell >+my $have_codespell = 0; >+if ( -f '/usr/bin/codespell' || -f '/usr/local/bin/codespell' ) { >+ $have_codespell = 1; >+} > # Assuming codespell is in /usr/bin >-unless ( -f '/usr/bin/codespell' ) { >+if (! $have_codespell ) { > warn "You should install codespell\n"; > push @tests_to_skip, 'spelling'; > } >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21892
:
82680
|
82681
|
82682
| 85571 |
86572