Skip to content

Commit

Permalink
Issue #344 | fix version parsing of X.Y Y>=10
Browse files Browse the repository at this point in the history
  • Loading branch information
tseemann committed Feb 21, 2020
1 parent 0451df1 commit 63ce440
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions bin/snippy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use 5.18.0; # for Time::Seconds
use strict;
use warnings;
use version;
use FindBin;
use lib "$FindBin::RealBin/../perl5";
###LINE_FOR_BREW_CONDA###
Expand Down Expand Up @@ -93,16 +94,16 @@ sub parse_version {
#msg("parse=[$blob]");
$blob =~ $re;
my $ver = defined $1 ? $1 : 0;
err("Need $cmd >= $min but you have $ver - please upgrade it.") if $ver < $min;
err("Need $cmd >= $min but you have $ver - please upgrade it.")
if version->parse("v$ver") < version->parse("v$min");
msg("Checking version: $cmd is >= $min - ok, have $ver");
return $ver;
}
parse_version( 'samtools --version', 1.7, qr/samtools\s(\d+\.\d+)/ms );
parse_version( 'bcftools --version', 1.7, qr/bcftools\s(\d+\.\d+)/ms );
parse_version( 'freebayes --version', 1.1, qr/\sv(\d+\.\d+)/ms );
parse_version( 'java -version', 1.8, qr/version\D+(\d+\.\d+)/ms );
parse_version( 'snpEff -version', 4.3, qr/(\d+\.\d+)/ms );
parse_version( 'bwa', 7.12, qr/Version:\s+0.(\d+\.\d+)/ms );
parse_version( 'samtools --version', '1.7', qr/samtools\s(\d+\.\d+)/ms );
parse_version( 'bcftools --version', '1.7', qr/bcftools\s(\d+\.\d+)/ms );
parse_version( 'freebayes --version', '1.1', qr/\sv(\d+\.\d+.\d+)/ms );
parse_version( 'snpEff -version', '4.3', qr/(\d+\.\d+)/ms );
parse_version( 'bwa', '0.7.12', qr/Version:\s+(\d+.\d+\.\d+)/ms );

# quit now if --check was provided
if ($check) {
Expand Down

0 comments on commit 63ce440

Please sign in to comment.