Lines 32-37
Link Here
|
32 |
from portage import digraph |
32 |
from portage import digraph |
33 |
|
33 |
|
34 |
import emergehelp, xpak, commands, errno, re, socket, string, time, types |
34 |
import emergehelp, xpak, commands, errno, re, socket, string, time, types |
|
|
35 |
import output |
35 |
from output import blue, bold, colorize, darkblue, darkgreen, darkred, green, \ |
36 |
from output import blue, bold, colorize, darkblue, darkgreen, darkred, green, \ |
36 |
havecolor, nc_len, nocolor, red, teal, turquoise, white, xtermTitle, \ |
37 |
havecolor, nc_len, nocolor, red, teal, turquoise, white, xtermTitle, \ |
37 |
xtermTitleReset, yellow |
38 |
xtermTitleReset, yellow |
Lines 4063-4068
Link Here
|
4063 |
|
4064 |
|
4064 |
longopt_aliases = {"--cols":"--columns", "--skip-first":"--skipfirst"} |
4065 |
longopt_aliases = {"--cols":"--columns", "--skip-first":"--skipfirst"} |
4065 |
argument_options = { |
4066 |
argument_options = { |
|
|
4067 |
"--color": { |
4068 |
"help":"enable or disable color output", |
4069 |
"type":"choice", |
4070 |
"choices":("y", "n") |
4071 |
}, |
4066 |
"--with-bdeps": { |
4072 |
"--with-bdeps": { |
4067 |
"help":"include unnecessary build time dependencies", |
4073 |
"help":"include unnecessary build time dependencies", |
4068 |
"type":"choice", |
4074 |
"type":"choice", |
Lines 4123-4128
Link Here
|
4123 |
else: |
4129 |
else: |
4124 |
myfiles.append(x) |
4130 |
myfiles.append(x) |
4125 |
|
4131 |
|
|
|
4132 |
if "--nocolor" in myopts: |
4133 |
print "*** Deprecated use of '--nocolor', use '--color=n' instead." |
4134 |
del myopts["--nocolor"] |
4135 |
myopts["--color"] = "n" |
4136 |
|
4126 |
return myaction, myopts, myfiles |
4137 |
return myaction, myopts, myfiles |
4127 |
|
4138 |
|
4128 |
def validate_ebuild_environment(trees): |
4139 |
def validate_ebuild_environment(trees): |
Lines 4222-4229
Link Here
|
4222 |
settings["PORTAGE_DEBUG"] = str(PORTAGE_DEBUG) |
4233 |
settings["PORTAGE_DEBUG"] = str(PORTAGE_DEBUG) |
4223 |
settings.backup_changes("PORTAGE_DEBUG") |
4234 |
settings.backup_changes("PORTAGE_DEBUG") |
4224 |
|
4235 |
|
4225 |
# Set color output |
4236 |
"""The explicit --color < y | n > option overrides the NOCOLOR environment |
4226 |
if "--nocolor" in myopts: |
4237 |
variable and stdout auto-detection.""" |
|
|
4238 |
if "--color" in myopts: |
4239 |
if "y" == myopts["--color"]: |
4240 |
output.havecolor = 1 |
4241 |
settings["NOCOLOR"] = "false" |
4242 |
else: |
4243 |
output.havecolor = 0 |
4244 |
settings["NOCOLOR"] = "true" |
4245 |
settings.backup_changes("NOCOLOR") |
4246 |
elif not sys.stdout.isatty(): |
4247 |
output.havecolor = 0 |
4227 |
settings["NOCOLOR"] = "true" |
4248 |
settings["NOCOLOR"] = "true" |
4228 |
settings.backup_changes("NOCOLOR") |
4249 |
settings.backup_changes("NOCOLOR") |
4229 |
|
4250 |
|
Lines 4241-4246
Link Here
|
4241 |
ldpath_mtimes = mtimedb["ldpath"] |
4262 |
ldpath_mtimes = mtimedb["ldpath"] |
4242 |
xterm_titles = "notitles" not in settings.features |
4263 |
xterm_titles = "notitles" not in settings.features |
4243 |
|
4264 |
|
|
|
4265 |
"""Disable color as early as possible via NOCOLOR and stdout |
4266 |
auto-detection. This initial setting may later be overridden via the |
4267 |
--color < yes | no > option.""" |
4244 |
if settings.get("NOCOLOR","").lower() in ("yes","true"): |
4268 |
if settings.get("NOCOLOR","").lower() in ("yes","true"): |
4245 |
nocolor() |
4269 |
nocolor() |
4246 |
elif (not sys.stdout.isatty()) and \ |
4270 |
elif (not sys.stdout.isatty()) and \ |
Lines 4380-4390
Link Here
|
4380 |
print "* --tree is currently broken with --resume. Disabling..." |
4404 |
print "* --tree is currently broken with --resume. Disabling..." |
4381 |
del myopts["--tree"] |
4405 |
del myopts["--tree"] |
4382 |
|
4406 |
|
4383 |
# Set color output |
|
|
4384 |
if "--nocolor" in myopts or \ |
4385 |
settings["NOCOLOR"] in ("yes","true"): |
4386 |
nocolor() |
4387 |
|
4388 |
if not ("--quiet" in myopts): |
4407 |
if not ("--quiet" in myopts): |
4389 |
if not sys.stdout.isatty() or ("--nospinner" in myopts): |
4408 |
if not sys.stdout.isatty() or ("--nospinner" in myopts): |
4390 |
spinner.update = spinner.update_basic |
4409 |
spinner.update = spinner.update_basic |
Lines 4395-4401
Link Here
|
4395 |
trees[settings["ROOT"]]["vartree"].dbapi) |
4414 |
trees[settings["ROOT"]]["vartree"].dbapi) |
4396 |
sys.exit(0) |
4415 |
sys.exit(0) |
4397 |
elif "--help" in myopts: |
4416 |
elif "--help" in myopts: |
4398 |
emergehelp.help(myaction, myopts, havecolor) |
4417 |
emergehelp.help(myaction, myopts, output.havecolor) |
4399 |
sys.exit(0) |
4418 |
sys.exit(0) |
4400 |
|
4419 |
|
4401 |
if portage.wheelgid == portage.portage_gid: |
4420 |
if portage.wheelgid == portage.portage_gid: |
Lines 4407-4413
Link Here
|
4407 |
print "myopts", myopts |
4426 |
print "myopts", myopts |
4408 |
|
4427 |
|
4409 |
if not myaction and not myfiles and "--resume" not in myopts: |
4428 |
if not myaction and not myfiles and "--resume" not in myopts: |
4410 |
emergehelp.help(myaction, myopts, havecolor) |
4429 |
emergehelp.help(myaction, myopts, output.havecolor) |
4411 |
sys.exit(1) |
4430 |
sys.exit(1) |
4412 |
|
4431 |
|
4413 |
# check if root user is the current user for the actions where emerge needs this |
4432 |
# check if root user is the current user for the actions where emerge needs this |