# HG changeset patch # User Dan Buch # Date 1323263320 18000 # Node ID 2c61743a0c5e6d40a50b322b01bcf02f2dcf75e8 # Parent 8506a84ece82de884742715df31fba92781b2fe7 Renaming scripts for clarity, cross-platform-y-ness and importability diff -r 8506a84ece82de884742715df31fba92781b2fe7 -r 2c61743a0c5e6d40a50b322b01bcf02f2dcf75e8 devscripts/download_reindent.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devscripts/download_reindent.py Wed Dec 07 08:08:40 2011 -0500 @@ -0,0 +1,44 @@ +#!/usr/bin/env python +from __future__ import print_function + +import sys +from os.path import dirname, abspath, join as pathjoin +from urllib2 import urlopen + +TOP = dirname(dirname(abspath(__file__))) +REPO_BASE = "http://hg.python.org/cpython-fullhistory" +TAGS_VERSIONS = { + '2.3.7': '23', + '2.4.6': '24', + '2.5.5': '25', + '2.6.6': '26', + '2.7.1': '27', + '3.0.1': '30', + '3.1.3': '31', + '3.2': '32' +} + + +def main(): + for tag, vnum in TAGS_VERSIONS.items(): + try: + dest = "{TOP}/reindent/v{vnum}/reindent.py".format(TOP=TOP, vnum=vnum) + dl_url = \ + "{REPO_BASE}/raw-file/v{tag}/Tools/scripts/reindent.py".format( + REPO_BASE=REPO_BASE, + tag=tag + ) + print("Downloading {dl_url} to {dest}".format( + dl_url=dl_url, dest=dest) + ) + + with open(dest, 'w') as outfile: + outfile.write(urlopen(dl_url).read()) + except Exception: + return 1 + + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff -r 8506a84ece82de884742715df31fba92781b2fe7 -r 2c61743a0c5e6d40a50b322b01bcf02f2dcf75e8 devscripts/fetch-reindent-versions --- a/devscripts/fetch-reindent-versions Wed Dec 07 00:35:30 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function - -import sys -from os.path import dirname, abspath, join as pathjoin -from urllib2 import urlopen - -TOP = dirname(dirname(abspath(__file__))) -REPO_BASE = "http://hg.python.org/cpython-fullhistory" -TAGS_VERSIONS = { - '2.3.7': '23', - '2.4.6': '24', - '2.5.5': '25', - '2.6.6': '26', - '2.7.1': '27', - '3.0.1': '30', - '3.1.3': '31', - '3.2': '32' -} - - -def main(): - for tag, vnum in TAGS_VERSIONS.items(): - try: - dest = "{TOP}/reindent/v{vnum}/reindent.py".format(TOP=TOP, vnum=vnum) - dl_url = \ - "{REPO_BASE}/raw-file/v{tag}/Tools/scripts/reindent.py".format( - REPO_BASE=REPO_BASE, - tag=tag - ) - print("Downloading {dl_url} to {dest}".format( - dl_url=dl_url, dest=dest) - ) - - with open(dest, 'w') as outfile: - outfile.write(urlopen(dl_url).read()) - except Exception: - return 1 - - return 0 - - -if __name__ == '__main__': - sys.exit(main()) diff -r 8506a84ece82de884742715df31fba92781b2fe7 -r 2c61743a0c5e6d40a50b322b01bcf02f2dcf75e8 devscripts/smoketest.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devscripts/smoketest.py Wed Dec 07 08:08:40 2011 -0500 @@ -0,0 +1,58 @@ +#!/usr/bin/env python +""" +This is a very crude version compatibility script that cycles through a bunch +of python versions likely (???) to still be in use. The script itself has only +been tested on linux, so any feedback from users on other platforms is much +appreciated. +""" +from __future__ import print_function + +import sys +from os.path import dirname, abspath, join as pathjoin +from subprocess import check_call, PIPE + + +VERSIONS = ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2'] +REINDENT_SCRIPT = pathjoin( + dirname(dirname(abspath(__file__))), 'scripts', 'reindent' +) + + +def main(): + had_failure = False + passes = 0 + + for version in VERSIONS: + exe = 'python{0}'.format(version) + + try: + check_call([exe, '-c', 'import sys'], stdout=PIPE, stderr=PIPE) + print('+ Testing {0}'.format(exe), end='') + + try: + check_call([exe, REINDENT_SCRIPT, '-h'], + stdout=PIPE, stderr=PIPE) + # yes, it is *hilarious* that I'm using tabs in a script to + # test `reindent` + print('\t\tPASS') + passes += 1 + + except OSError: + had_failure = True + print('\t\tFAIL') + + except OSError: + print('- {0} not detected\tSKIP'.format(exe)) + + print('=' * 36) + print('Summary: ', end='') + + if had_failure: + print('FAIL') + else: + print('PASS ({0}% awesomeness)'.format( + int(100 * (float(passes) / float(len(VERSIONS)))))) + + +if __name__ == '__main__': + sys.exit(main()) diff -r 8506a84ece82de884742715df31fba92781b2fe7 -r 2c61743a0c5e6d40a50b322b01bcf02f2dcf75e8 devscripts/test-python-versions --- a/devscripts/test-python-versions Wed Dec 07 00:35:30 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -#!/usr/bin/env python -""" -This is a very crude version compatibility script that cycles through a bunch -of python versions likely (???) to still be in use. The script itself has only -been tested on linux, so any feedback from users on other platforms is much -appreciated. -""" -from __future__ import print_function - -import sys -from os.path import dirname, abspath, join as pathjoin -from subprocess import check_call, PIPE - - -VERSIONS = ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2'] -REINDENT_SCRIPT = pathjoin( - dirname(dirname(abspath(__file__))), 'scripts', 'reindent' -) - - -def main(): - had_failure = False - passes = 0 - - for version in VERSIONS: - exe = 'python{0}'.format(version) - - try: - check_call([exe, '-c', 'import sys'], stdout=PIPE, stderr=PIPE) - print('+ Testing {0}'.format(exe), end='') - - try: - check_call([exe, REINDENT_SCRIPT, '-h'], - stdout=PIPE, stderr=PIPE) - # yes, it is *hilarious* that I'm using tabs in a script to - # test `reindent` - print('\t\tPASS') - passes += 1 - - except OSError: - had_failure = True - print('\t\tFAIL') - - except OSError: - print('- {0} not detected\tSKIP'.format(exe)) - - print('=' * 36) - print('Summary: ', end='') - - if had_failure: - print('FAIL') - else: - print('PASS ({0}% awesomeness)'.format( - int(100 * (float(passes) / float(len(VERSIONS)))))) - - -if __name__ == '__main__': - sys.exit(main())