Skip to content

Commit

Permalink
Remove [status] suppress from setup.cfg.
Browse files Browse the repository at this point in the history
distutils/setuptools already has a --quiet option, we can just use that
instead of having to parse an option from setup.cfg.
  • Loading branch information
anntzer committed Jun 20, 2019
1 parent 63d96d2 commit 50cee65
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 28 deletions.
5 changes: 0 additions & 5 deletions setup.cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
39 changes: 17 additions & 22 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand All @@ -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")

Expand All @@ -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
Expand Down

0 comments on commit 50cee65

Please sign in to comment.