Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added --force-color flag to catkin_make and catkin_make_isolated #1127

Open
wants to merge 2 commits into
base: noetic-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions bin/catkin_make
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ def main():
apply_platform_specific_defaults(args)
cmake_args = args.cmake_args

# force --no-color if stdout is non-interactive
if not sys.stdout.isatty():
args.no_color = True
if not args.no_color:
# Use color if --force-color is set
if args.force_color:
args.no_color = False
# use --no-color as fallback if stdout is non-interactive
elif not sys.stdout.isatty():
args.no_color = True

# disable colors if asked
if args.no_color:
disable_ANSI_colors()
Expand Down Expand Up @@ -277,7 +282,9 @@ def _parse_args(args=sys.argv[1:]):
add('--use-nmake', action='store_true', help="Use 'nmake' instead of 'make'")
add('--use-gmake', action='store_true', help="Use 'gmake' instead of 'make'")
add('--force-cmake', action='store_true', help="Invoke 'cmake' even if it has been executed before")
add('--no-color', action='store_true', help='Disables colored output (only for catkin_make and CMake)')
add('--force-color', action='store_true', help='Enforces colored output (only for catkin_make and CMake)')
add('--no-color', action='store_true',
help='Disables colored output (only for catkin_make and CMake). Overrides --force-color.')
add('--pkg', nargs='+', help="Invoke 'make' on specific packages only")
add('--only-pkg-with-deps', nargs='+',
help='Whitelist only the specified packages and their dependencies by '
Expand Down
14 changes: 10 additions & 4 deletions bin/catkin_make_isolated
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ def parse_args(args=None):
help='Causes each catkin package to be installed.')
add('--force-cmake', action='store_true', default=False,
help='Runs cmake explicitly for each catkin package.')
add('--force-color', action='store_true', default=False,
help='Enforces colored output (only for catkin_make and CMake)')
add('--no-color', action='store_true', default=False,
help='Disables colored output (only for catkin_make and CMake)')
help='Disables colored output (only for catkin_make and CMake). Overrides --force-color.')
pkg = parser.add_mutually_exclusive_group(required=False)
pkg.add_argument('--pkg', nargs='+', metavar='PKGNAME', dest='packages',
help='Process only specific packages '
Expand Down Expand Up @@ -121,9 +123,13 @@ def main():
apply_platform_specific_defaults(opts)
cmake_args, opts = handle_cmake_args(opts.cmake_args, opts)

# force --no-color if stdout is non-interactive
if not sys.stdout.isatty():
opts.no_color = True
if not opts.no_color:
# Use color if --force-color is set
if opts.force_color:
opts.no_color = False
# use --no-color as fallback if stdout is non-interactive
elif not sys.stdout.isatty():
opts.no_color = True

# use PWD in order to work when being invoked in a symlinked location
cwd = os.getenv('PWD', os.curdir)
Expand Down