emerge_main: disable color earlier
authorZac Medico <zmedico@gentoo.org>
Mon, 15 Oct 2012 15:02:20 +0000 (08:02 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 15 Oct 2012 15:02:20 +0000 (08:02 -0700)
Since commit 2ca487f929962154488999a125a7387eeb44be88, --help has not
respected --color=n and related options, since it's been optimized to
bypass options and config parsing. Now it's fixed to show without
colors in this optimized case (help with colors may be shown in some
other cases, like when emerge is called with zero arguments).

pym/_emerge/main.py

index dc45f8f75e3efa1d8160ba7a1f86dad0f754e0d4..bba10b7043794e0afc2170e6c2acfa12a133b7ec 100644 (file)
@@ -1424,6 +1424,10 @@ def emerge_main(args=None):
        if args is None:
                args = sys.argv[1:]
 
+       # Disable color until we're sure that it should be enabled (after
+       # EMERGE_DEFAULT_OPTS has been parsed).
+       portage.output.havecolor = 0
+
        # optimize --help (no need to load config / EMERGE_DEFAULT_OPTS)
        if "--help" in args or "-h" in args:
                emerge_help()
@@ -1431,9 +1435,7 @@ def emerge_main(args=None):
 
        portage._disable_legacy_globals()
        portage.dep._internal_warnings = True
-       # Disable color until we're sure that it should be enabled (after
-       # EMERGE_DEFAULT_OPTS has been parsed).
-       portage.output.havecolor = 0
+
        # This first pass is just for options that need to be known as early as
        # possible, such as --config-root.  They will be parsed again later,
        # together with EMERGE_DEFAULT_OPTS (which may vary depending on the