From 7d03350dc545a97585ca49ec79a4525f20d13812 2010-10-27 06:19:35 From: Fernando Perez Date: 2010-10-27 06:19:35 Subject: [PATCH] Add support for commit information in auto-generated archives. This uses the tool to record the commit data from our previous commit, and ensures that auto-generated archives from Github, for example, always carry identifying information. Ideas and code taken from Matthew Brett's tools in nibabel. --- diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7a56bcb --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +IPython/.git_commit_info.ini export-subst diff --git a/IPython/.git_commit_info.ini b/IPython/.git_commit_info.ini new file mode 100644 index 0000000..19c2a55 --- /dev/null +++ b/IPython/.git_commit_info.ini @@ -0,0 +1,9 @@ +# This is an ini file that may contain information about the code state +[commit hash] + +# The line below may contain a valid hash if it has been substituted during +# 'git archive' +archive_subst_hash=$Format:%h$ + +# This line may be modified by the install process +install_hash= diff --git a/MANIFEST.in b/MANIFEST.in index 765367a..124c74b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -18,6 +18,7 @@ graft IPython/scripts graft IPython/testing graft IPython/utils +include IPython/.git_commit_info.ini graft docs exclude docs/\#* diff --git a/setup.py b/setup.py index 834cb5f..e4d8e4f 100755 --- a/setup.py +++ b/setup.py @@ -6,12 +6,16 @@ Under Posix environments it works like a typical setup.py script. Under Windows, the command sdist is not supported, since IPython requires utilities which are not available under Windows.""" -#------------------------------------------------------------------------------- -# Copyright (C) 2008 The IPython Development Team +#----------------------------------------------------------------------------- +# Copyright (c) 2008-2010, IPython Development Team. +# Copyright (c) 2001-2007, Fernando Perez +# Copyright (c) 2001, Janko Hauser +# Copyright (c) 2001, Nathaniel Gray # -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#------------------------------------------------------------------------------- +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Minimal Python version sanity check @@ -55,7 +59,8 @@ from setupbase import ( find_package_data, find_scripts, find_data_files, - check_for_dependencies + check_for_dependencies, + record_commit_info, ) isfile = os.path.isfile @@ -239,6 +244,7 @@ else: # Do the actual setup now #--------------------------------------------------------------------------- +setup_args['cmdclass'] = {'build_py': record_commit_info('IPython')} setup_args['packages'] = packages setup_args['package_data'] = package_data setup_args['scripts'] = scripts diff --git a/tools/make_tarball.py b/tools/make_tarball.py index f5203e9..11738be 100755 --- a/tools/make_tarball.py +++ b/tools/make_tarball.py @@ -9,7 +9,7 @@ import shutil from toollib import * -tag = commands.getoutput('git describe') +tag = commands.getoutput('git describe --tags') base_name = 'ipython-%s' % tag tar_name = '%s.tgz' % base_name