From 50cee65d1db9a531735eda058976a2e3b63101a6 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 20 Jun 2019 15:13:47 +0200 Subject: [PATCH] Remove [status] suppress from setup.cfg. distutils/setuptools already has a --quiet option, we can just use that instead of having to parse an option from setup.cfg. --- setup.cfg.template | 5 ----- setup.py | 3 ++- setupext.py | 39 +++++++++++++++++---------------------- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/setup.cfg.template b/setup.cfg.template index dbfdb2ada390..45f448af4d93 100644 --- a/setup.cfg.template +++ b/setup.cfg.template @@ -10,11 +10,6 @@ # ensures that test images are exactly reproducible. #local_freetype = False -[status] -# To suppress display of the dependencies and their versions -# at the top of the build log, uncomment the following line: -#suppress = True - [packages] # There are a number of subpackages of Matplotlib that are considered # optional. All except tests are installed by default, but that can diff --git a/setup.py b/setup.py index 22b8b1704151..9209856087d3 100644 --- a/setup.py +++ b/setup.py @@ -177,7 +177,8 @@ def run(self): # Go through all of the packages and figure out which ones we are # going to build/install. print_line() - print_raw("Edit setup.cfg to change the build options") + print_raw("Edit setup.cfg to change the build options; " + "suppress output with --quiet.") required_failed = [] good_packages = [] diff --git a/setupext.py b/setupext.py index e878e8873d1d..e05568581269 100644 --- a/setupext.py +++ b/setupext.py @@ -143,7 +143,6 @@ def write_cache(local_fn, data): # matplotlib build options, which can be altered using setup.cfg options = { - 'display_status': True, 'backend': None, } @@ -153,9 +152,6 @@ def write_cache(local_fn, data): config = configparser.ConfigParser() config.read(setup_cfg) - if config.has_option('status', 'suppress'): - options['display_status'] = not config.getboolean("status", "suppress") - if config.has_option('rc_options', 'backend'): options['backend'] = config.get("rc_options", "backend") @@ -168,31 +164,30 @@ def write_cache(local_fn, data): options['local_freetype'] = lft or options.get('local_freetype', False) -# Define the display functions only if display_status is True. -if options['display_status']: - def print_line(char='='): - print(char * 80) +if '-q' in sys.argv or '--quiet' in sys.argv: + def print_raw(*args, **kwargs): pass # Suppress our own output. +else: + print_raw = print + + +def print_line(char='='): + print_raw(char * 80) + - def print_status(package, status): - initial_indent = "%12s: " % package - indent = ' ' * 18 - print(textwrap.fill(str(status), width=80, +def print_status(package, status): + initial_indent = "%12s: " % package + indent = ' ' * 18 + print_raw(textwrap.fill(str(status), width=80, initial_indent=initial_indent, subsequent_indent=indent)) - def print_message(message): - indent = ' ' * 18 + "* " - print(textwrap.fill(str(message), width=80, + +def print_message(message): + indent = ' ' * 18 + "* " + print_raw(textwrap.fill(str(message), width=80, initial_indent=indent, subsequent_indent=indent)) - def print_raw(section): - print(section) -else: - def print_line(*args, **kwargs): - pass - print_status = print_message = print_raw = print_line - def get_buffer_hash(fd): BLOCKSIZE = 1 << 16