File: LocaleTextDomainBuild.pm

package info (click to toggle)
libdist-zilla-localetextdomain-perl 0.91-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 320 kB
  • sloc: perl: 1,229; ansic: 6; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 1,068 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package Dist::Zilla::LocaleTextDomainBuild;

use strict;
use warnings;
use Module::Build 0.35;
use base 'Module::Build';

sub new {
    my $self = shift->SUPER::new(@_);
    my $gettext = 'gettext' . ($^O eq 'MSWin32' ? '.exe' : '');
    my $version = $self->_backticks($gettext, '--version');
    if (!$version || $version =~ /--version/) {
        print STDERR '#' x 64, "\n",
        "# Cannot find compatible GNU gettext in PATH. Download it from:\n",
        "#     http://www.gnu.org/software/gettext/gettext.html\n",
        "# Aborting build.\n",
        '#' x 64, "\n\n";
        exit 255;
    }

    my ($maj, $min, $patch) = $version =~ /(\d+)[.](\d+)(?:[.](\d+))?$/ms;
    if (!($maj || $min) || !($maj > 0 || $min >= 17)) {
        print STDERR '#' x 64, "\n",
        "# Need GNU gettext v0.17.0 or higher; found $maj.$min.$patch in PATH.\n",
        "# Download latest from:\n",
        "#     http://www.gnu.org/software/gettext/gettext.html\n",
        "# Aborting build.\n",
        '#' x 64, "\n\n";
        exit 255;
    }

    return $self;
}

1;