From 2b1f09a0323d13de0c601fa528d739b1a9bba048 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 28 Nov 2009 16:01:27 +0000 Subject: [PATCH] Add --nocolor option to forcibly disable output coloring --- makepanda/makepanda.py | 3 ++- makepanda/makepandacore.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 3c4cb32fda..c9cfb6fa8a 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -103,7 +103,7 @@ def parseopts(args): global VERSION,COMPRESSOR,THREADCOUNT,OSXTARGET longopts = [ "help","distributor=","verbose","runtime","osxtarget=", - "optimize=","everything","nothing","installer","rtdist", + "optimize=","everything","nothing","installer","rtdist","nocolor", "version=","lzma","no-python","threads=","outputdir=","override="] anything = 0 optimize = "" @@ -125,6 +125,7 @@ def parseopts(args): elif (option=="--threads"): THREADCOUNT=int(value) elif (option=="--outputdir"): SetOutputDir(value.strip()) elif (option=="--osxtarget"): OSXTARGET=value.strip() + elif (option=="--nocolor"): DisableColors() elif (option=="--version"): VERSION=value if (len(VERSION.split(".")) != 3): raise "usage" diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index a6cb19c78b..b3dc8dea70 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -120,6 +120,10 @@ try: HAVE_COLORS=sys.stdout.isatty() except: pass +def DisableColors(): + global HAVE_COLORS + HAVE_COLORS = False + def GetColor(color = None): if not HAVE_COLORS: return "" if color != None: color = color.lower()