Closed Bug 1520718 Opened 11 months ago Closed 11 months ago

In python configure, the when of a when is ignored

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(firefox66 fixed)

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(1 file)

option('--with-foo', help='foo')
option('--without-bar', help='bar', when='--with-foo')
set_config('BAR', True, when='--with-bar')

makes BAR set to True, which doesn't make sense.

Now, come to think of it, the equivalent, using a depends function, is actually forbidden:

option('--with-foo', help='foo')
option('--without-bar', help='bar', when='--with-foo')
@depends('--with-bar')
def bar(value):
    return value
set_config('BAR', True, when=bar)

saying that the @depends function needs the same when as the option it depends on. And it would make sense that the same restriction applies.

Actually, the equivalent would be

option('--with-foo', help='foo')
option('--without-bar', help='bar', when='--with-foo')
@depends('--with-bar', when='--with-foo')
def bar(value):
    return value
set_config('BAR', True, when=bar)

And not only is it accepted, but it doesn't do the same thing: BAR is not set.

Blocks: 1520393

In fact, set_config doesn't even need to be involved:

option('--with-foo', help='foo')
option('--without-bar', help='bar', when='--with-foo')
option('--with-qux', help='qux', when='--with-bar')

Has the same problem.

Make option(..., when='--foo') equivalent to
option(..., when=depends('--foo')(lambda x: x)).
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/6f0ec77a2d7e
In python configure, fix `when` in `option`. r=nalexander
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.