1 |
On Fri, Jun 10, 2016 at 12:52:34PM -0400, NP-Hardass wrote: |
2 |
> On 06/09/2016 11:54 PM, Jason Zaman wrote: |
3 |
> > On Thu, Jun 09, 2016 at 08:19:43AM -0400, NP-Hardass wrote: |
4 |
> >> # @FUNCTION: python_cond_func_wrap |
5 |
> >> # @DESCRIPTION: Wraps a function for conditional python use, to run for each |
6 |
> >> # python implementation in the build directory. |
7 |
> >> python_cond_func_wrap() { |
8 |
> >> if use python; then |
9 |
> >> python_foreach_impl run_in_build_dir "$@" |
10 |
> >> else |
11 |
> >> $@ |
12 |
> >> fi |
13 |
> >> } |
14 |
> > |
15 |
> > I dont see where you inherited the python eclasses? You also probably |
16 |
> > need to use use_if_iuse (from eutils.eclass) instead since it seems like |
17 |
> > python might not be in all the ebuilds. Afaik, you're not allowed to |
18 |
> > call use foo if foo is not in IUSE already |
19 |
> I forgot to include a comment in the ebuild, but the intention was that |
20 |
> the eclass would not inherit python, by design, those wanting to use |
21 |
> that should inherit python themselves. Although, if I should check that |
22 |
> explicitly, I am unaware of how to do so, and would appreciate advice |
23 |
> from someone, if it is possible. I am aware of INHERITED, but the PMS |
24 |
> says it shouldn't be exported to ebuilds, so I'm unsure if/how it could |
25 |
> be used. |
26 |
> |
27 |
> My hope was that since this is used several times (though, not too |
28 |
> many), that I could move this logic into the eclass, but if it would be |
29 |
> more appropriate to just keep that in each of those ebuilds, I can do |
30 |
> that too. |
31 |
|
32 |
Yeah sounds like keeping this in the eclass is right. Moving duplicated |
33 |
code into the ebuilds would be a waste. You are defining the API so |
34 |
requiring the ebuild to inherit itself is completely okay. I would add a |
35 |
little more to the doc above to make it super obvious tho. |
36 |
|
37 |
I don't know how to check if the python eclasses specifically are |
38 |
inherited. I think "python" being in IUSE would be sufficient to check |
39 |
tho. so all you'd need to do is inherit eutils and replace the "if use |
40 |
python" with "if use_if_iuse python". |
41 |
|
42 |
If you *really* wanted to check you could perhaps do |
43 |
if [[ $(type python_foreach_impl) == function ]]. Seems overkill and I |
44 |
wouldn't bother. Having python in iuse is probably enough of a sanity |
45 |
check. |
46 |
|
47 |
-- Jason |