Skip to content

Commit

Permalink
Remove some unnecessary prints from setup.py.
Browse files Browse the repository at this point in the history
- Instead of populating required_failed, we can just immediately fail
  when a component fails to build.  (Actually there is no case where
  this can happen -- no required package ever throws CheckFailed --
  but I'll further unravel that code in a later PR...)
- Then print_line becomes used in a single place (at the top of the
  build); using an empty line works just as well.
- Then print_message and print_line becomes no longer used and can be
  deleted.
  • Loading branch information
anntzer committed Jun 29, 2019
1 parent 1126912 commit 6e73fbf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
15 changes: 3 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
from distutils.dist import Distribution

import setupext
from setupext import (print_line, print_raw, print_message, print_status,
download_or_cache)
from setupext import print_raw, print_status, download_or_cache

# Get the version from versioneer
import versioneer
Expand Down Expand Up @@ -176,11 +175,10 @@ def run(self):
or 'clean' in sys.argv):
# Go through all of the packages and figure out which ones we are
# going to build/install.
print_line()
print_raw()
print_raw("Edit setup.cfg to change the build options; "
"suppress output with --quiet.")

required_failed = []
good_packages = []
for package in mpl_packages:
if isinstance(package, str):
Expand All @@ -199,18 +197,11 @@ def run(self):
else:
print_status(package.name, 'no')
if not package.optional:
required_failed.append(package)
sys.exit("Failed to build %s" % package.name)
else:
good_packages.append(package)
print_raw('')

# Abort if any of the required packages can not be built.
if required_failed:
print_line()
print_message("The following required packages can not be built: "
"%s" % ", ".join(x.name for x in required_failed))
sys.exit(1)

# Now collect all of the information we need to build all of the
# packages.
for package in good_packages:
Expand Down
11 changes: 0 additions & 11 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ def print_raw(*args, **kwargs): pass # Suppress our own output.
print_raw = print


def print_line(char='='):
print_raw(char * 80)


def print_status(package, status):
initial_indent = "%12s: " % package
indent = ' ' * 18
Expand All @@ -191,13 +187,6 @@ def print_status(package, status):
subsequent_indent=indent))


def print_message(message):
indent = ' ' * 18 + "* "
print_raw(textwrap.fill(str(message), width=80,
initial_indent=indent,
subsequent_indent=indent))


def get_buffer_hash(fd):
BLOCKSIZE = 1 << 16
hasher = hashlib.sha256()
Expand Down

0 comments on commit 6e73fbf

Please sign in to comment.