From 4050155b76d846d4adaf2e5efc2a37bf12236b89 2010-10-27 06:19:35 From: Fernando Perez Date: 2010-10-27 06:19:35 Subject: [PATCH] Clean up version info tools and remove bzr references. --- diff --git a/tools/build_release b/tools/build_release index 494452c..1a9c830 100755 --- a/tools/build_release +++ b/tools/build_release @@ -20,16 +20,16 @@ for d in ['build','dist',pjoin('docs','build'),pjoin('docs','dist'), remove_tree(d) # Build source and binary distros -c('./setup.py sdist --formats=gztar,zip') +sh('./setup.py sdist --formats=gztar,zip') # Build eggs -c('python2.6 ./setupegg.py bdist_egg') +sh('python2.6 ./setupegg.py bdist_egg') # Call the windows build separately, so that the extra Windows scripts don't # get pulled into Unix builds (setup.py has code which checks for # bdist_wininst) -c("python setup.py bdist_wininst --install-script=ipython_win_post_install.py") +sh("python setup.py bdist_wininst --install-script=ipython_win_post_install.py") # Change name so retarded Vista runs the installer correctly -c("rename 's/linux-i686/win32-setup/' dist/*.exe") -c("rename 's/linux-x86_64/win32-setup/' dist/*.exe") +sh("rename 's/linux-i686/win32-setup/' dist/*.exe") +sh("rename 's/linux-x86_64/win32-setup/' dist/*.exe") diff --git a/tools/compile.py b/tools/compile.py deleted file mode 100755 index be34c42..0000000 --- a/tools/compile.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python -"""Script to check that all code in a directory compiles correctly. - -Usage: - - compile.py - -This script verifies that all Python files in the directory where run, and all -of its subdirectories, compile correctly. - -Before a release, call this script from the top-level directory. -""" - -import sys - -from toollib import compile_tree - -if __name__ == '__main__': - compile_tree() diff --git a/tools/make_tarball.py b/tools/make_tarball.py index 87acda3..f5203e9 100755 --- a/tools/make_tarball.py +++ b/tools/make_tarball.py @@ -21,5 +21,5 @@ tar_name = '%s.tgz' % base_name start_dir = os.getcwd() cd('..') git_tpl = 'git archive --format=tar --prefix={0}/ HEAD | gzip > {1}' -c(git_tpl.format(base_name, tar_name)) -c('mv {0} tools/'.format(tar_name)) +sh(git_tpl.format(base_name, tar_name)) +sh('mv {0} tools/'.format(tar_name)) diff --git a/tools/toollib.py b/tools/toollib.py index 206bd7a..b0fa830 100644 --- a/tools/toollib.py +++ b/tools/toollib.py @@ -11,14 +11,16 @@ pjoin = os.path.join cd = os.chdir # Utility functions -def c(cmd): - """Run system command, raise SystemExit if it returns an error.""" +def sh(cmd): + """Run system command in shell, raise SystemExit if it returns an error.""" print "$",cmd stat = os.system(cmd) #stat = 0 # Uncomment this and comment previous to run in debug mode if stat: raise SystemExit("Command %s failed with code: %s" % (cmd, stat)) +# Backwards compatibility +c = sh def get_ipdir(): """Get IPython directory from command line, or assume it's the one above.""" @@ -39,17 +41,8 @@ def get_ipdir(): def compile_tree(): """Compile all Python files below current directory.""" - vstr = '.'.join(map(str,sys.version_info[:2])) - stat = os.system('python %s/lib/python%s/compileall.py .' % - (sys.prefix,vstr)) + stat = os.system('python -m compileall .') if stat: msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n' msg += 'See messages above for the actual file that produced it.\n' raise SystemExit(msg) - - -def version_info(): - """Return bzr version info as a dict.""" - out = os.popen('bzr version-info') - pairs = (l.split(':',1) for l in out) - return dict(((k,v.strip()) for (k,v) in pairs)) diff --git a/tools/update_revnum.py b/tools/update_revnum.py deleted file mode 100755 index 7e03e74..0000000 --- a/tools/update_revnum.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -"""Change the revision number in release.py - -This edits in-place release.py to update the revision number from bzr info. - -Usage: - -./update_revnum.py""" - -import os -import pprint -import re - -from toollib import * - -if __name__ == '__main__': - ver = version_info() - - pprint.pprint(ver) - - rfile = open('../IPython/core/release.py','rb').read() - newcont = re.sub(r'revision\s*=.*', - "revision = '%s'" % ver['revno'], - rfile) - - newcont = re.sub(r'^branch\s*=[^=].*', - "branch = '%s'" % ver['branch-nick'], - newcont) - - f = open('../IPython/core/release.py','wb') - f.write(newcont) - f.close()