On Mon, 29 Sep 2014 12:23:00 +0200
Alexander Berntsen <berna...@gentoo.org> wrote:

> Turn off news-reading by default when --ask, and instead make it an
> option --read-news.
> 
> Apparently making --ask a bit more interactive was "goddamn stupid"
> and ruined the lives of several Gentoo developers. Props to MichaƂ who
> predicted this all along.
> 
> Signed-off-by: Alexander Berntsen <berna...@gentoo.org>
> ---
>  man/emerge.1           |  3 +++
>  pym/_emerge/actions.py |  2 +-
>  pym/_emerge/main.py    | 13 +++++++++++++
>  3 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/man/emerge.1 b/man/emerge.1
> index a2cb3f6..2264b58 100644
> --- a/man/emerge.1
> +++ b/man/emerge.1
> @@ -716,6 +716,9 @@ Disable the warning message that's shown prior to
>  to be set in the \fBmake.conf\fR(5)
>  \fBEMERGE_DEFAULT_OPTS\fR variable.
>  .TP
> +.BR "\-\-read-news [ y | n ]"
> +Offer to read news via eselect if there are unread news.
> +.TP
>  .BR "\-\-rebuild\-if\-new\-slot [ y | n ]"
>  Automatically rebuild or reinstall packages when slot/sub\-slot :=
>  operator dependencies can be satisfied by a newer slot, so that
> diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
> index 9036810..4e8b83b 100644
> --- a/pym/_emerge/actions.py
> +++ b/pym/_emerge/actions.py
> @@ -4064,7 +4064,7 @@ def run_action(emerge_config):
>                       uq = UserQuery(emerge_config.opts)
>                       if
> display_news_notification(emerge_config.target_config,
> emerge_config.opts) \
> -                             and "--ask" in emerge_config.opts \
> +                             and "--read-news" in
> emerge_config.opts \ and uq.query("Would you like to read the news
> items while " \ "calculating dependencies?",
>                                               '--ask-enter-invalid'
> in emerge_config.opts) == "Yes": diff --git a/pym/_emerge/main.py
> b/pym/_emerge/main.py index 52aa9c5..3883f72 100644
> --- a/pym/_emerge/main.py
> +++ b/pym/_emerge/main.py
> @@ -146,6 +146,7 @@ def insert_optional_args(args):
>               '--quiet'                : y_or_n,
>               '--quiet-build'          : y_or_n,
>               '--quiet-fail'           : y_or_n,
> +             '--read-news'            : y_or_n,
>               '--rebuild-if-new-slot': y_or_n,
>               '--rebuild-if-new-rev'   : y_or_n,
>               '--rebuild-if-new-ver'   : y_or_n,
> @@ -557,6 +558,12 @@ def parse_opts(tmpcmdline, silent=False):
>                       "choices"  : true_y_or_n,
>               },
>  
> +             "--read-news": {
> +                     "help"    : "offer to read unread news via
> eselect",
> +                     "choices" : true_y_or_n
> +             },
> +
> +
>               "--rebuild-if-new-slot": {
>                       "help"     : ("Automatically rebuild or
> reinstall packages when slot/sub-slot := " "operator dependencies can
> be satisfied by a newer slot, so that " @@ -803,6 +810,12 @@ def
> parse_opts(tmpcmdline, silent=False): if myoptions.quiet_fail in
> true_y: myoptions.quiet_fail = 'y'
>  
> +     if myoptions.read_news in true_y:
> +             myoptions.read_news = True
> +     else:
> +             myoptions.read_news = None
> +
> +
>       if myoptions.rebuild_if_new_slot in true_y:
>               myoptions.rebuild_if_new_slot = 'y'
>  

LGTM, merge please :)

-- 
Brian Dolbec <dolsen>


Reply via email to