SConstruct (8878:ac6eb417e7b4) SConstruct (8879:347fc850752c)
1# -*- mode:python -*-
2
3# Copyright (c) 2011 Advanced Micro Devices, Inc.
4# Copyright (c) 2009 The Hewlett-Packard Development Company
5# Copyright (c) 2004-2005 The Regents of The University of Michigan
6# All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without

--- 115 unchanged lines hidden (view full) ---

124help_texts = {
125 "options" : "",
126 "global_vars" : "",
127 "local_vars" : ""
128}
129
130Export("help_texts")
131
1# -*- mode:python -*-
2
3# Copyright (c) 2011 Advanced Micro Devices, Inc.
4# Copyright (c) 2009 The Hewlett-Packard Development Company
5# Copyright (c) 2004-2005 The Regents of The University of Michigan
6# All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without

--- 115 unchanged lines hidden (view full) ---

124help_texts = {
125 "options" : "",
126 "global_vars" : "",
127 "local_vars" : ""
128}
129
130Export("help_texts")
131
132def AddM5Option(*args, **kwargs):
132
133# There's a bug in scons in that (1) by default, the help texts from
134# AddOption() are supposed to be displayed when you type 'scons -h'
135# and (2) you can override the help displayed by 'scons -h' using the
136# Help() function, but these two features are incompatible: once
137# you've overridden the help text using Help(), there's no way to get
138# at the help texts from AddOptions. See:
139# http://scons.tigris.org/issues/show_bug.cgi?id=2356
140# http://scons.tigris.org/issues/show_bug.cgi?id=2611
141# This hack lets us extract the help text from AddOptions and
142# re-inject it via Help(). Ideally someday this bug will be fixed and
143# we can just use AddOption directly.
144def AddLocalOption(*args, **kwargs):
133 col_width = 30
134
135 help = " " + ", ".join(args)
136 if "help" in kwargs:
137 length = len(help)
138 if length >= col_width:
139 help += "\n" + " " * col_width
140 else:
141 help += " " * (col_width - length)
142 help += kwargs["help"]
143 help_texts["options"] += help + "\n"
144
145 AddOption(*args, **kwargs)
146
145 col_width = 30
146
147 help = " " + ", ".join(args)
148 if "help" in kwargs:
149 length = len(help)
150 if length >= col_width:
151 help += "\n" + " " * col_width
152 else:
153 help += " " * (col_width - length)
154 help += kwargs["help"]
155 help_texts["options"] += help + "\n"
156
157 AddOption(*args, **kwargs)
158
147AddM5Option('--colors', dest='use_colors', action='store_true',
148 help="Add color to abbreviated scons output")
149AddM5Option('--no-colors', dest='use_colors', action='store_false',
150 help="Don't add color to abbreviated scons output")
151AddM5Option('--default', dest='default', type='string', action='store',
152 help='Override which build_opts file to use for defaults')
153AddM5Option('--ignore-style', dest='ignore_style', action='store_true',
154 help='Disable style checking hooks')
155AddM5Option('--update-ref', dest='update_ref', action='store_true',
156 help='Update test reference outputs')
157AddM5Option('--verbose', dest='verbose', action='store_true',
158 help='Print full tool command lines')
159AddLocalOption('--colors', dest='use_colors', action='store_true',
160 help="Add color to abbreviated scons output")
161AddLocalOption('--no-colors', dest='use_colors', action='store_false',
162 help="Don't add color to abbreviated scons output")
163AddLocalOption('--default', dest='default', type='string', action='store',
164 help='Override which build_opts file to use for defaults')
165AddLocalOption('--ignore-style', dest='ignore_style', action='store_true',
166 help='Disable style checking hooks')
167AddLocalOption('--update-ref', dest='update_ref', action='store_true',
168 help='Update test reference outputs')
169AddLocalOption('--verbose', dest='verbose', action='store_true',
170 help='Print full tool command lines')
159
160use_colors = GetOption('use_colors')
161if use_colors:
162 from m5.util.terminal import termcap
163elif use_colors is None:
164 # option unspecified; default behavior is to use colors iff isatty
165 from m5.util.terminal import tty_termcap as termcap
166else:

--- 861 unchanged lines hidden ---
171
172use_colors = GetOption('use_colors')
173if use_colors:
174 from m5.util.terminal import termcap
175elif use_colors is None:
176 # option unspecified; default behavior is to use colors iff isatty
177 from m5.util.terminal import tty_termcap as termcap
178else:

--- 861 unchanged lines hidden ---