mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-08 19:34:18 +00:00
setup: format the output of show-tool-versions for better human-readability
This commit is contained in:
parent
41cee8a868
commit
76594cb955
@ -14,8 +14,9 @@ def print_platform():
|
||||
if hasattr(platform, 'linux_distribution'):
|
||||
print "linux_distribution:", repr(platform.linux_distribution())
|
||||
except EnvironmentError:
|
||||
sys.stderr.write("Got exception using 'platform'. Exception follows\n")
|
||||
sys.stderr.write("\nGot exception using 'platform'. Exception follows\n")
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
pass
|
||||
|
||||
def print_python_ver():
|
||||
@ -42,8 +43,9 @@ def print_stdout(cmdlist, label=None):
|
||||
label = cmdlist[0]
|
||||
print label + ': ' + foldlines(res)
|
||||
except EnvironmentError:
|
||||
sys.stderr.write("Got exception invoking '%s'. Exception follows.\n" % (cmdlist[0],))
|
||||
sys.stderr.write("\nGot exception invoking '%s'. Exception follows.\n" % (cmdlist[0],))
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
pass
|
||||
|
||||
def print_stderr(cmdlist, label=None):
|
||||
@ -55,8 +57,9 @@ def print_stderr(cmdlist, label=None):
|
||||
label = cmdlist[0]
|
||||
print label + ': ' + foldlines(res)
|
||||
except EnvironmentError:
|
||||
sys.stderr.write("Got exception invoking '%s'. Exception follows\n" % (cmdlist[0],))
|
||||
sys.stderr.write("\nGot exception invoking '%s'. Exception follows\n" % (cmdlist[0],))
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
pass
|
||||
|
||||
def print_as_ver():
|
||||
@ -71,8 +74,9 @@ def print_as_ver():
|
||||
if os.path.exists('a.out'):
|
||||
os.remove('a.out')
|
||||
except EnvironmentError:
|
||||
sys.stderr.write("Got exception invoking '%s'. Exception follows.\n" % ('as',))
|
||||
sys.stderr.write("\nGot exception invoking '%s'. Exception follows.\n" % ('as',))
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
pass
|
||||
|
||||
def print_setuptools_ver():
|
||||
@ -82,8 +86,9 @@ def print_setuptools_ver():
|
||||
out = str(pkg_resources.require("setuptools"))
|
||||
print "setuptools:", foldlines(out)
|
||||
except (ImportError, EnvironmentError):
|
||||
sys.stderr.write("Got exception using 'pkg_resources' to get the version of setuptools. Exception follows\n")
|
||||
sys.stderr.write("\nGot exception using 'pkg_resources' to get the version of setuptools. Exception follows\n")
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
pass
|
||||
|
||||
def print_py_pkg_ver(pkgname):
|
||||
@ -93,12 +98,14 @@ def print_py_pkg_ver(pkgname):
|
||||
out = str(pkg_resources.require(pkgname))
|
||||
print pkgname + ': ' + foldlines(out)
|
||||
except (ImportError, EnvironmentError):
|
||||
sys.stderr.write("Got exception using 'pkg_resources' to get the version of %s. Exception follows.\n" % (pkgname,))
|
||||
sys.stderr.write("\nGot exception using 'pkg_resources' to get the version of %s. Exception follows.\n" % (pkgname,))
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
pass
|
||||
except pkg_resources.DistributionNotFound:
|
||||
sys.stderr.write("pkg_resources reported no %s package installed. Exception follows.\n" % (pkgname,))
|
||||
sys.stderr.write("\npkg_resources reported no %s package installed. Exception follows.\n" % (pkgname,))
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
pass
|
||||
|
||||
print_platform()
|
||||
|
Loading…
x
Reference in New Issue
Block a user