On Tue, 2020-10-06 at 08:42 +0200, Mauro Carvalho Chehab wrote:
> Em Mon, 5 Oct 2020 10:17:36 -0600
> Jonathan Corbet <cor...@lwn.net> escreveu:
[]
> Sure. It should be easy to make the third argument optional, although
> the regex will be a little more harder to understand.
> 
> Something like this should do the trick:
> 
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
[]
> @@ -466,12 +466,16 @@ while ($ARGV[0] =~ m/^--?(.*)/) {
>       $show_not_found = 1;  # A no-op but don't fail
>      } elsif ($cmd eq "sphinx-version") {
>       my $ver_string = shift @ARGV;
> -     if ($ver_string =~ m/^(\d+)\.(\d+)\.(\d+)/) {
> +     if ($ver_string =~ m/^(\d+)\.(\d+)(?:\.?(\d+)?)/) {

trivia: perhaps more readable as

        if ($ver_string =~ m/^(\d+)\.(\d+)(\.\d+)?/) {
            $sphinx_major = $1;
            $sphinx_minor = $2;
            if (defined($3)) {
                $sphinx_patch = substr($3,1);
            } else {
                $sphinx_patch = 0;
            }


Reply via email to