From: zooko Date: Mon, 7 Jun 2010 06:32:05 +0000 (+0530) Subject: setup: reorganize misc/ to match Tahoe-LAFS's misc/ so that the same buildmaster... X-Git-Url: https://git.rkrishnan.org/%5B/frontends/%22file:/flags/(%5B%5E?a=commitdiff_plain;h=d5bf4daa389bb9125eaaef2699e95e9f34ce6e64;p=tahoe-lafs%2Fzfec.git setup: reorganize misc/ to match Tahoe-LAFS's misc/ so that the same buildmaster config can use zfec's and Tahoe-LAFS's Ignore-this: c844927aead8b6dcbb8d567c8d900a33 darcs-hash:75c95ca691b42ae32e8d8b514258a8a091b68f06 --- diff --git a/misc/build_helpers/show-tool-versions.py b/misc/build_helpers/show-tool-versions.py new file mode 100755 index 0000000..df586c4 --- /dev/null +++ b/misc/build_helpers/show-tool-versions.py @@ -0,0 +1,83 @@ +#! /usr/bin/env python + +import os, subprocess, sys + +def print_platform(): + try: + import platform + out = platform.platform() + print + print "platform:", out.replace("\n", " ") + except EnvironmentError, le: + sys.stderr.write("Got exception using 'platform': %s\n" % (le,)) + pass + +def print_python_ver(): + print "python:", sys.version.replace("\n", " ") + ', maxunicode: ' + str(sys.maxunicode) + +def print_cmd_ver(cmdlist, label=None): + try: + res = subprocess.Popen(cmdlist, stdin=open(os.devnull), + stdout=subprocess.PIPE).communicate()[0] + if label is None: + label = cmdlist[0] + print + print label + ': ' + res.replace("\n", " ") + except EnvironmentError, le: + sys.stderr.write("Got exception invoking '%s': %s\n" % (cmdlist[0], le,)) + pass + +def print_as_ver(): + if os.path.exists('a.out'): + print + print "WARNING: a file named a.out exists, and getting the version of the 'as' assembler writes to that filename, so I'm not attempting to get the version of 'as'." + return + try: + res = subprocess.Popen(['as', '-version'], stdin=open(os.devnull), + stderr=subprocess.PIPE).communicate()[1] + print + print 'as: ' + res.replace("\n", " ") + os.remove('a.out') + except EnvironmentError, le: + sys.stderr.write("Got exception invoking '%s': %s\n" % ('as', le,)) + pass + +def print_setuptools_ver(): + try: + import pkg_resources + out = str(pkg_resources.require("setuptools")) + print + print "setuptools:", out.replace("\n", " ") + except (ImportError, EnvironmentError), le: + sys.stderr.write("Got exception using 'pkg_resources' to get the version of setuptools: %s\n" % (le,)) + pass + +def print_py_pkg_ver(pkgname): + try: + import pkg_resources + out = str(pkg_resources.require(pkgname)) + print + print pkgname + ': ' + out.replace("\n", " ") + except (ImportError, EnvironmentError), le: + sys.stderr.write("Got exception using 'pkg_resources' to get the version of %s: %s\n" % (pkgname, le,)) + pass + except pkg_resources.DistributionNotFound, le: + sys.stderr.write("pkg_resources reported no %s package installed: %s\n" % (pkgname, le,)) + pass + +print_platform() + +print_python_ver() + +print_cmd_ver(['buildbot', '--version']) +print_cmd_ver(['cl']) +print_cmd_ver(['gcc', '--version']) +print_cmd_ver(['darcs', '--version']) +print_cmd_ver(['darcs', '--exact-version'], label='darcs-exact-version') +print_cmd_ver(['7za']) + +print_setuptools_ver() + +print_py_pkg_ver('coverage') +print_py_pkg_ver('trialcoverage') +print_py_pkg_ver('setuptools_trial') diff --git a/misc/show-tool-versions.py b/misc/show-tool-versions.py deleted file mode 100755 index df586c4..0000000 --- a/misc/show-tool-versions.py +++ /dev/null @@ -1,83 +0,0 @@ -#! /usr/bin/env python - -import os, subprocess, sys - -def print_platform(): - try: - import platform - out = platform.platform() - print - print "platform:", out.replace("\n", " ") - except EnvironmentError, le: - sys.stderr.write("Got exception using 'platform': %s\n" % (le,)) - pass - -def print_python_ver(): - print "python:", sys.version.replace("\n", " ") + ', maxunicode: ' + str(sys.maxunicode) - -def print_cmd_ver(cmdlist, label=None): - try: - res = subprocess.Popen(cmdlist, stdin=open(os.devnull), - stdout=subprocess.PIPE).communicate()[0] - if label is None: - label = cmdlist[0] - print - print label + ': ' + res.replace("\n", " ") - except EnvironmentError, le: - sys.stderr.write("Got exception invoking '%s': %s\n" % (cmdlist[0], le,)) - pass - -def print_as_ver(): - if os.path.exists('a.out'): - print - print "WARNING: a file named a.out exists, and getting the version of the 'as' assembler writes to that filename, so I'm not attempting to get the version of 'as'." - return - try: - res = subprocess.Popen(['as', '-version'], stdin=open(os.devnull), - stderr=subprocess.PIPE).communicate()[1] - print - print 'as: ' + res.replace("\n", " ") - os.remove('a.out') - except EnvironmentError, le: - sys.stderr.write("Got exception invoking '%s': %s\n" % ('as', le,)) - pass - -def print_setuptools_ver(): - try: - import pkg_resources - out = str(pkg_resources.require("setuptools")) - print - print "setuptools:", out.replace("\n", " ") - except (ImportError, EnvironmentError), le: - sys.stderr.write("Got exception using 'pkg_resources' to get the version of setuptools: %s\n" % (le,)) - pass - -def print_py_pkg_ver(pkgname): - try: - import pkg_resources - out = str(pkg_resources.require(pkgname)) - print - print pkgname + ': ' + out.replace("\n", " ") - except (ImportError, EnvironmentError), le: - sys.stderr.write("Got exception using 'pkg_resources' to get the version of %s: %s\n" % (pkgname, le,)) - pass - except pkg_resources.DistributionNotFound, le: - sys.stderr.write("pkg_resources reported no %s package installed: %s\n" % (pkgname, le,)) - pass - -print_platform() - -print_python_ver() - -print_cmd_ver(['buildbot', '--version']) -print_cmd_ver(['cl']) -print_cmd_ver(['gcc', '--version']) -print_cmd_ver(['darcs', '--version']) -print_cmd_ver(['darcs', '--exact-version'], label='darcs-exact-version') -print_cmd_ver(['7za']) - -print_setuptools_ver() - -print_py_pkg_ver('coverage') -print_py_pkg_ver('trialcoverage') -print_py_pkg_ver('setuptools_trial')