Commit aa7fcf46 authored by Christoph Groth's avatar Christoph Groth
Browse files make warning and error messages easier to recognize

parent 91a16c18
......@@ -69,18 +69,21 @@ else:
distr_root = os.path.dirname(os.path.abspath(__file__))
def header(title=''):
return, '*')
def banner(title=''):
starred =, '*')
return '\n' + starred if title else starred
error_msg = """{sep}
error_msg = """{header}
The compilation of Kwant has failed. Please examine the error message
above and consult the installation instructions in README.rst.
You might have to customize {{file}}.
Build configuration was:
error_msg = error_msg.format(sep=header())
error_msg = error_msg.format(header=banner(' Error '), sep=banner())
class kwant_build_ext(build_ext):
def run(self):
......@@ -98,8 +101,9 @@ class kwant_build_ext(build_ext):
print(error_msg.format(file=CONFIG_FILE, summary=build_summary),
print(header(' Build summary '))
print(banner(' Build summary '))
class build_tut(Command):
......@@ -151,7 +155,7 @@ class test(Command):
major, minor = sys.version_info[:2]
lib_dir = "build/lib.{0}-{1}.{2}".format(get_platform(), major, minor)
print(header(' Tests '))
if not run(argv=[__file__, '-v', lib_dir]):
raise DistutilsError('at least one of the tests failed')
......@@ -188,7 +192,7 @@ class kwant_sdist(distutils_sdist):
with open(distr_root + '/MANIFEST', 'r') as f:
line =
except IOError:
print("error: MANIFEST file is missing and Git is not"
print("Error: MANIFEST file is missing and Git is not"
" available to regenerate it.", file=sys.stderr)
trustworthy = not line.strip().startswith('#')
......@@ -209,15 +213,17 @@ class kwant_sdist(distutils_sdist):
if names is None:
print(header(' Warning '),
print(banner(' Warning '),
"""Git was not available for re-generating the MANIFEST file (the list of file
names to be included in the source distribution). The old MANIFEST was used.""",
sep='\n', file=sys.stderr)
if not trustworthy:
print(header(' Warning '),
print(banner(' Warning '),
"""The existing MANIFEST file seems to have been generated by distutils (it begins
with a comment). It may well be incomplete.""",
sep='\n', file=sys.stderr)
# Other than the "if not use_git" clause in the beginning, this is an exact copy
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment