diff --git a/tools/build_release b/tools/build_release index 65efd11..3521e5f 100755 --- a/tools/build_release +++ b/tools/build_release @@ -1,28 +1,32 @@ #!/usr/bin/env python """IPython release build script. """ - import os from shutil import rmtree -from toollib import sh, pjoin, get_ipdir, cd, compile_tree, execfile, sdists, wheels +from toollib import sh, pjoin, get_ipdir, cd, compile_tree, execfile, sdists, buildwheels + +def build_release(): + + # Get main ipython dir, this will raise if it doesn't pass some checks + ipdir = get_ipdir() + cd(ipdir) -# Get main ipython dir, this will raise if it doesn't pass some checks -ipdir = get_ipdir() -cd(ipdir) + # Load release info + execfile(pjoin('IPython', 'core', 'release.py'), globals()) -# Load release info -execfile(pjoin('IPython', 'core', 'release.py'), globals()) + # Check that everything compiles + compile_tree('*') -# Check that everything compiles -compile_tree('*') + # Cleanup + for d in ['build', 'dist', pjoin('docs', 'build'), pjoin('docs', 'dist'), + pjoin('docs', 'source', 'api', 'generated')]: + if os.path.isdir(d): + rmtree(d) -# Cleanup -for d in ['build', 'dist', pjoin('docs', 'build'), pjoin('docs', 'dist'), - pjoin('docs', 'source', 'api', 'generated')]: - if os.path.isdir(d): - rmtree(d) + # Build source and binary distros + sh(sdists) + buildwheels() -# Build source and binary distros -sh(sdists) -sh(wheels) +if __name__ == '__main__': + build_release() diff --git a/tools/release b/tools/release index c6c8909..69e5123 100755 --- a/tools/release +++ b/tools/release @@ -9,7 +9,7 @@ import os import sys from toollib import (get_ipdir, pjoin, cd, execfile, sh, archive, - sdists, archive_user, archive_dir) + sdists, archive_user, archive_dir, buildwheels) from gh_api import post_download # Get main ipython dir, this will raise if it doesn't pass some checks @@ -56,8 +56,8 @@ cd(ipdir) # Upload all files sh(sdists) -for py in ('2', '3'): - sh('python%s setupegg.py bdist_wheel' % py) + +buildwheels() if 'upload' not in sys.argv: print("`./release upload` to register and release") diff --git a/tools/toollib.py b/tools/toollib.py index 7406c2b..1b390c7 100644 --- a/tools/toollib.py +++ b/tools/toollib.py @@ -20,7 +20,9 @@ archive = '%s:%s' % (archive_user, archive_dir) # Source dists sdists = './setup.py sdist --formats=gztar,zip' # Binary dists -wheels = './setupegg.py bdist_wheel' +def buildwheels(): + for py in ('2', '3'): + sh('python%s setupegg.py bdist_wheel' % py) # Utility functions def sh(cmd):