[PATCH] Add an optional conditional to progress_report.
David Shea
dshea at redhat.com
Fri Jun 26 15:19:30 UTC 2015
On 06/25/2015 05:03 PM, David Shea wrote:
> On 06/25/2015 11:10 AM, Chris Lumens wrote:
>> This is to get rid of a little of the indentation in install.py and
>> make it look
>> a bit neater.
>> ---
>> pyanaconda/install.py | 20 ++++++++------------
>> pyanaconda/progress.py | 11 +++++++----
>> 2 files changed, 15 insertions(+), 16 deletions(-)
>
> As much as I like how it looks, it doesn't work. progress_report now
> raises an exception if cond() is False since the generator doesn't
> yield, and there's the greater problem that the conditional needs to
> skip the statements inside the with when the condition is false and
> not just skip the progress portion.
>
> But it's already pushed and you're out tomorrow so I guess I just
> volunteered to try to figure out something better.
To follow up a bit, there was an idea allow contextmanagers to skip the
with statement body in PEP 0377, but it was rejected. I thought about
converting progress_report into a decorator and just making all the with
bodies separate functions, but the "Joining realm: %s" message makes
that difficult.
I think the best thing to do to avoid making install.py more complicated
is to just revert this commit.
More information about the anaconda-patches
mailing list