Gentoo Archives: gentoo-dev

From: Ulrich Mueller <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] eutils.eclass: In EAPI conditionals, replace "has" by case statements.
Date: Mon, 30 Nov 2015 06:53:10
Message-Id: 22107.62027.57796.708914@a1i15.kph.uni-mainz.de
In Reply to: Re: [gentoo-dev] [PATCH] eutils.eclass: In EAPI conditionals, replace "has" by case statements. by Davide Pesavento
1 >>>>> On Mon, 30 Nov 2015, Davide Pesavento wrote:
2
3 >> The patch below replaces them by case statements. (Unfortunately we
4 >> cannot use fall-through (&;) because it is a bash 4 feature.)
5
6 > Sounds reasonable, although I'd find an 'if' clause slightly more
7 > readable, since there wouldn't be an 'else' branch in 2 out of 3
8 > cases.
9
10 It is slightly more complicated to match multiple patterns with [[ ]]
11 because it requires multiple conditions, regexps, or extglob. We could
12 of course use a bracket expression like [[ ${EAPI:-0} = [012345] ]]
13 but I find it ugly in this context (and it won't be able to check for
14 EAPI 10 ;) ).
15
16 Besides, case seems to be the command most used for EAPI checking in
17 eclasses.
18
19 Ulrich

Replies