##// END OF EJS Templates
Add support for commit information in auto-generated archives....
Fernando Perez -
Show More
@@ -0,0 +1,1 b''
1 IPython/.git_commit_info.ini export-subst
@@ -0,0 +1,9 b''
1 # This is an ini file that may contain information about the code state
2 [commit hash]
3
4 # The line below may contain a valid hash if it has been substituted during
5 # 'git archive'
6 archive_subst_hash=$Format:%h$
7
8 # This line may be modified by the install process
9 install_hash=
@@ -1,36 +1,37 b''
1 include ipython.py
1 include ipython.py
2 include setupbase.py
2 include setupbase.py
3 include setupegg.py
3 include setupegg.py
4
4
5 graft setupext
5 graft setupext
6
6
7 graft scripts
7 graft scripts
8 graft IPython/kernel
8 graft IPython/kernel
9 graft IPython/config
9 graft IPython/config
10 graft IPython/core
10 graft IPython/core
11 # graft IPython/deathrow
11 # graft IPython/deathrow
12 graft IPython/external
12 graft IPython/external
13 graft IPython/frontend
13 graft IPython/frontend
14 graft IPython/gui
14 graft IPython/gui
15 graft IPython/lib
15 graft IPython/lib
16 graft IPython/quarantine
16 graft IPython/quarantine
17 graft IPython/scripts
17 graft IPython/scripts
18 graft IPython/testing
18 graft IPython/testing
19 graft IPython/utils
19 graft IPython/utils
20
20
21 include IPython/.git_commit_info.ini
21
22
22 graft docs
23 graft docs
23 exclude docs/\#*
24 exclude docs/\#*
24 exclude docs/man/*.1
25 exclude docs/man/*.1
25
26
26 # docs subdirs we want to skip
27 # docs subdirs we want to skip
27 prune docs/attic
28 prune docs/attic
28 prune docs/build
29 prune docs/build
29
30
30 global-exclude *~
31 global-exclude *~
31 global-exclude *.flc
32 global-exclude *.flc
32 global-exclude *.pyc
33 global-exclude *.pyc
33 global-exclude .dircopy.log
34 global-exclude .dircopy.log
34 global-exclude .svn
35 global-exclude .svn
35 global-exclude .bzr
36 global-exclude .bzr
36 global-exclude .hgignore
37 global-exclude .hgignore
@@ -1,251 +1,257 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
2 # -*- coding: utf-8 -*-
3 """Setup script for IPython.
3 """Setup script for IPython.
4
4
5 Under Posix environments it works like a typical setup.py script.
5 Under Posix environments it works like a typical setup.py script.
6 Under Windows, the command sdist is not supported, since IPython
6 Under Windows, the command sdist is not supported, since IPython
7 requires utilities which are not available under Windows."""
7 requires utilities which are not available under Windows."""
8
8
9 #-------------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10 # Copyright (C) 2008 The IPython Development Team
10 # Copyright (c) 2008-2010, IPython Development Team.
11 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
12 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
13 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
11 #
14 #
12 # Distributed under the terms of the BSD License. The full license is in
15 # Distributed under the terms of the Modified BSD License.
13 # the file COPYING, distributed as part of this software.
16 #
14 #-------------------------------------------------------------------------------
17 # The full license is in the file COPYING.txt, distributed with this software.
18 #-----------------------------------------------------------------------------
15
19
16 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
17 # Minimal Python version sanity check
21 # Minimal Python version sanity check
18 #-----------------------------------------------------------------------------
22 #-----------------------------------------------------------------------------
19
23
20 import sys
24 import sys
21
25
22 # This check is also made in IPython/__init__, don't forget to update both when
26 # This check is also made in IPython/__init__, don't forget to update both when
23 # changing Python version requirements.
27 # changing Python version requirements.
24 if sys.version[0:3] < '2.6':
28 if sys.version[0:3] < '2.6':
25 error = """\
29 error = """\
26 ERROR: 'IPython requires Python Version 2.6 or above.'
30 ERROR: 'IPython requires Python Version 2.6 or above.'
27 Exiting."""
31 Exiting."""
28 print >> sys.stderr, error
32 print >> sys.stderr, error
29 sys.exit(1)
33 sys.exit(1)
30
34
31 # At least we're on the python version we need, move on.
35 # At least we're on the python version we need, move on.
32
36
33 #-------------------------------------------------------------------------------
37 #-------------------------------------------------------------------------------
34 # Imports
38 # Imports
35 #-------------------------------------------------------------------------------
39 #-------------------------------------------------------------------------------
36
40
37 # Stdlib imports
41 # Stdlib imports
38 import os
42 import os
39 import shutil
43 import shutil
40
44
41 from glob import glob
45 from glob import glob
42
46
43 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
47 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
44 # update it when the contents of directories change.
48 # update it when the contents of directories change.
45 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
49 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
46
50
47 from distutils.core import setup
51 from distutils.core import setup
48
52
49 # Our own imports
53 # Our own imports
50 from IPython.utils.path import target_update
54 from IPython.utils.path import target_update
51
55
52 from setupbase import (
56 from setupbase import (
53 setup_args,
57 setup_args,
54 find_packages,
58 find_packages,
55 find_package_data,
59 find_package_data,
56 find_scripts,
60 find_scripts,
57 find_data_files,
61 find_data_files,
58 check_for_dependencies
62 check_for_dependencies,
63 record_commit_info,
59 )
64 )
60
65
61 isfile = os.path.isfile
66 isfile = os.path.isfile
62 pjoin = os.path.join
67 pjoin = os.path.join
63
68
64 #-----------------------------------------------------------------------------
69 #-----------------------------------------------------------------------------
65 # Function definitions
70 # Function definitions
66 #-----------------------------------------------------------------------------
71 #-----------------------------------------------------------------------------
67
72
68 def cleanup():
73 def cleanup():
69 """Clean up the junk left around by the build process"""
74 """Clean up the junk left around by the build process"""
70 if "develop" not in sys.argv:
75 if "develop" not in sys.argv:
71 try:
76 try:
72 shutil.rmtree('ipython.egg-info')
77 shutil.rmtree('ipython.egg-info')
73 except:
78 except:
74 try:
79 try:
75 os.unlink('ipython.egg-info')
80 os.unlink('ipython.egg-info')
76 except:
81 except:
77 pass
82 pass
78
83
79 #-------------------------------------------------------------------------------
84 #-------------------------------------------------------------------------------
80 # Handle OS specific things
85 # Handle OS specific things
81 #-------------------------------------------------------------------------------
86 #-------------------------------------------------------------------------------
82
87
83 if os.name == 'posix':
88 if os.name == 'posix':
84 os_name = 'posix'
89 os_name = 'posix'
85 elif os.name in ['nt','dos']:
90 elif os.name in ['nt','dos']:
86 os_name = 'windows'
91 os_name = 'windows'
87 else:
92 else:
88 print 'Unsupported operating system:',os.name
93 print 'Unsupported operating system:',os.name
89 sys.exit(1)
94 sys.exit(1)
90
95
91 # Under Windows, 'sdist' has not been supported. Now that the docs build with
96 # Under Windows, 'sdist' has not been supported. Now that the docs build with
92 # Sphinx it might work, but let's not turn it on until someone confirms that it
97 # Sphinx it might work, but let's not turn it on until someone confirms that it
93 # actually works.
98 # actually works.
94 if os_name == 'windows' and 'sdist' in sys.argv:
99 if os_name == 'windows' and 'sdist' in sys.argv:
95 print 'The sdist command is not available under Windows. Exiting.'
100 print 'The sdist command is not available under Windows. Exiting.'
96 sys.exit(1)
101 sys.exit(1)
97
102
98 #-------------------------------------------------------------------------------
103 #-------------------------------------------------------------------------------
99 # Things related to the IPython documentation
104 # Things related to the IPython documentation
100 #-------------------------------------------------------------------------------
105 #-------------------------------------------------------------------------------
101
106
102 # update the manuals when building a source dist
107 # update the manuals when building a source dist
103 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
108 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
104 import textwrap
109 import textwrap
105
110
106 # List of things to be updated. Each entry is a triplet of args for
111 # List of things to be updated. Each entry is a triplet of args for
107 # target_update()
112 # target_update()
108 to_update = [
113 to_update = [
109 # FIXME - Disabled for now: we need to redo an automatic way
114 # FIXME - Disabled for now: we need to redo an automatic way
110 # of generating the magic info inside the rst.
115 # of generating the magic info inside the rst.
111 #('docs/magic.tex',
116 #('docs/magic.tex',
112 #['IPython/Magic.py'],
117 #['IPython/Magic.py'],
113 #"cd doc && ./update_magic.sh" ),
118 #"cd doc && ./update_magic.sh" ),
114
119
115 ('docs/man/ipcluster.1.gz',
120 ('docs/man/ipcluster.1.gz',
116 ['docs/man/ipcluster.1'],
121 ['docs/man/ipcluster.1'],
117 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
122 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
118
123
119 ('docs/man/ipcontroller.1.gz',
124 ('docs/man/ipcontroller.1.gz',
120 ['docs/man/ipcontroller.1'],
125 ['docs/man/ipcontroller.1'],
121 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
126 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
122
127
123 ('docs/man/ipengine.1.gz',
128 ('docs/man/ipengine.1.gz',
124 ['docs/man/ipengine.1'],
129 ['docs/man/ipengine.1'],
125 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
130 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
126
131
127 ('docs/man/ipython.1.gz',
132 ('docs/man/ipython.1.gz',
128 ['docs/man/ipython.1'],
133 ['docs/man/ipython.1'],
129 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
134 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
130
135
131 ('docs/man/ipython-wx.1.gz',
136 ('docs/man/ipython-wx.1.gz',
132 ['docs/man/ipython-wx.1'],
137 ['docs/man/ipython-wx.1'],
133 'cd docs/man && gzip -9c ipython-wx.1 > ipython-wx.1.gz'),
138 'cd docs/man && gzip -9c ipython-wx.1 > ipython-wx.1.gz'),
134
139
135 ('docs/man/ipythonx.1.gz',
140 ('docs/man/ipythonx.1.gz',
136 ['docs/man/ipythonx.1'],
141 ['docs/man/ipythonx.1'],
137 'cd docs/man && gzip -9c ipythonx.1 > ipythonx.1.gz'),
142 'cd docs/man && gzip -9c ipythonx.1 > ipythonx.1.gz'),
138
143
139 ('docs/man/irunner.1.gz',
144 ('docs/man/irunner.1.gz',
140 ['docs/man/irunner.1'],
145 ['docs/man/irunner.1'],
141 'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'),
146 'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'),
142
147
143 ('docs/man/pycolor.1.gz',
148 ('docs/man/pycolor.1.gz',
144 ['docs/man/pycolor.1'],
149 ['docs/man/pycolor.1'],
145 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'),
150 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'),
146 ]
151 ]
147
152
148 # Only build the docs if sphinx is present
153 # Only build the docs if sphinx is present
149 try:
154 try:
150 import sphinx
155 import sphinx
151 except ImportError:
156 except ImportError:
152 pass
157 pass
153 else:
158 else:
154 # The Makefile calls the do_sphinx scripts to build html and pdf, so
159 # The Makefile calls the do_sphinx scripts to build html and pdf, so
155 # just one target is enough to cover all manual generation
160 # just one target is enough to cover all manual generation
156
161
157 # First, compute all the dependencies that can force us to rebuild the
162 # First, compute all the dependencies that can force us to rebuild the
158 # docs. Start with the main release file that contains metadata
163 # docs. Start with the main release file that contains metadata
159 docdeps = ['IPython/core/release.py']
164 docdeps = ['IPython/core/release.py']
160 # Inculde all the reST sources
165 # Inculde all the reST sources
161 pjoin = os.path.join
166 pjoin = os.path.join
162 for dirpath,dirnames,filenames in os.walk('docs/source'):
167 for dirpath,dirnames,filenames in os.walk('docs/source'):
163 if dirpath in ['_static','_templates']:
168 if dirpath in ['_static','_templates']:
164 continue
169 continue
165 docdeps += [ pjoin(dirpath,f) for f in filenames
170 docdeps += [ pjoin(dirpath,f) for f in filenames
166 if f.endswith('.txt') ]
171 if f.endswith('.txt') ]
167 # and the examples
172 # and the examples
168 for dirpath,dirnames,filenames in os.walk('docs/example'):
173 for dirpath,dirnames,filenames in os.walk('docs/example'):
169 docdeps += [ pjoin(dirpath,f) for f in filenames
174 docdeps += [ pjoin(dirpath,f) for f in filenames
170 if not f.endswith('~') ]
175 if not f.endswith('~') ]
171 # then, make them all dependencies for the main PDF (the html will get
176 # then, make them all dependencies for the main PDF (the html will get
172 # auto-generated as well).
177 # auto-generated as well).
173 to_update.append(
178 to_update.append(
174 ('docs/dist/ipython.pdf',
179 ('docs/dist/ipython.pdf',
175 docdeps,
180 docdeps,
176 "cd docs && make dist")
181 "cd docs && make dist")
177 )
182 )
178
183
179 [ target_update(*t) for t in to_update ]
184 [ target_update(*t) for t in to_update ]
180
185
181 #---------------------------------------------------------------------------
186 #---------------------------------------------------------------------------
182 # Find all the packages, package data, scripts and data_files
187 # Find all the packages, package data, scripts and data_files
183 #---------------------------------------------------------------------------
188 #---------------------------------------------------------------------------
184
189
185 packages = find_packages()
190 packages = find_packages()
186 package_data = find_package_data()
191 package_data = find_package_data()
187 scripts = find_scripts()
192 scripts = find_scripts()
188 data_files = find_data_files()
193 data_files = find_data_files()
189
194
190 #---------------------------------------------------------------------------
195 #---------------------------------------------------------------------------
191 # Handle dependencies and setuptools specific things
196 # Handle dependencies and setuptools specific things
192 #---------------------------------------------------------------------------
197 #---------------------------------------------------------------------------
193
198
194 # For some commands, use setuptools. Note that we do NOT list install here!
199 # For some commands, use setuptools. Note that we do NOT list install here!
195 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
200 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
196 if len(set(('develop', 'sdist', 'release', 'bdist_egg', 'bdist_rpm',
201 if len(set(('develop', 'sdist', 'release', 'bdist_egg', 'bdist_rpm',
197 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info',
202 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info',
198 'build_sphinx', 'egg_info', 'easy_install', 'upload',
203 'build_sphinx', 'egg_info', 'easy_install', 'upload',
199 )).intersection(sys.argv)) > 0:
204 )).intersection(sys.argv)) > 0:
200 import setuptools
205 import setuptools
201
206
202 # This dict is used for passing extra arguments that are setuptools
207 # This dict is used for passing extra arguments that are setuptools
203 # specific to setup
208 # specific to setup
204 setuptools_extra_args = {}
209 setuptools_extra_args = {}
205
210
206 if 'setuptools' in sys.modules:
211 if 'setuptools' in sys.modules:
207 setuptools_extra_args['zip_safe'] = False
212 setuptools_extra_args['zip_safe'] = False
208 setuptools_extra_args['entry_points'] = {
213 setuptools_extra_args['entry_points'] = {
209 'console_scripts': [
214 'console_scripts': [
210 'ipython = IPython.frontend.terminal.ipapp:launch_new_instance',
215 'ipython = IPython.frontend.terminal.ipapp:launch_new_instance',
211 'ipython-qtconsole = IPython.frontend.qt.console.ipythonqt:main',
216 'ipython-qtconsole = IPython.frontend.qt.console.ipythonqt:main',
212 'pycolor = IPython.utils.PyColorize:main',
217 'pycolor = IPython.utils.PyColorize:main',
213 'ipcontroller = IPython.kernel.ipcontrollerapp:launch_new_instance',
218 'ipcontroller = IPython.kernel.ipcontrollerapp:launch_new_instance',
214 'ipengine = IPython.kernel.ipengineapp:launch_new_instance',
219 'ipengine = IPython.kernel.ipengineapp:launch_new_instance',
215 'ipcluster = IPython.kernel.ipclusterapp:launch_new_instance',
220 'ipcluster = IPython.kernel.ipclusterapp:launch_new_instance',
216 'iptest = IPython.testing.iptest:main',
221 'iptest = IPython.testing.iptest:main',
217 'irunner = IPython.lib.irunner:main'
222 'irunner = IPython.lib.irunner:main'
218 ]
223 ]
219 }
224 }
220 setup_args['extras_require'] = dict(
225 setup_args['extras_require'] = dict(
221 kernel = [
226 kernel = [
222 'zope.interface>=3.4.1',
227 'zope.interface>=3.4.1',
223 'Twisted>=8.0.1',
228 'Twisted>=8.0.1',
224 'foolscap>=0.2.6'
229 'foolscap>=0.2.6'
225 ],
230 ],
226 doc='Sphinx>=0.3',
231 doc='Sphinx>=0.3',
227 test='nose>=0.10.1',
232 test='nose>=0.10.1',
228 security='pyOpenSSL>=0.6'
233 security='pyOpenSSL>=0.6'
229 )
234 )
230 # Allow setuptools to handle the scripts
235 # Allow setuptools to handle the scripts
231 scripts = []
236 scripts = []
232 else:
237 else:
233 # If we are running without setuptools, call this function which will
238 # If we are running without setuptools, call this function which will
234 # check for dependencies an inform the user what is needed. This is
239 # check for dependencies an inform the user what is needed. This is
235 # just to make life easy for users.
240 # just to make life easy for users.
236 check_for_dependencies()
241 check_for_dependencies()
237
242
238 #---------------------------------------------------------------------------
243 #---------------------------------------------------------------------------
239 # Do the actual setup now
244 # Do the actual setup now
240 #---------------------------------------------------------------------------
245 #---------------------------------------------------------------------------
241
246
247 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython')}
242 setup_args['packages'] = packages
248 setup_args['packages'] = packages
243 setup_args['package_data'] = package_data
249 setup_args['package_data'] = package_data
244 setup_args['scripts'] = scripts
250 setup_args['scripts'] = scripts
245 setup_args['data_files'] = data_files
251 setup_args['data_files'] = data_files
246 setup_args.update(setuptools_extra_args)
252 setup_args.update(setuptools_extra_args)
247
253
248
254
249 if __name__ == '__main__':
255 if __name__ == '__main__':
250 setup(**setup_args)
256 setup(**setup_args)
251 cleanup()
257 cleanup()
@@ -1,25 +1,25 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """Simple script to create a tarball with proper git info.
2 """Simple script to create a tarball with proper git info.
3 """
3 """
4
4
5 import commands
5 import commands
6 import os
6 import os
7 import sys
7 import sys
8 import shutil
8 import shutil
9
9
10 from toollib import *
10 from toollib import *
11
11
12 tag = commands.getoutput('git describe')
12 tag = commands.getoutput('git describe --tags')
13 base_name = 'ipython-%s' % tag
13 base_name = 'ipython-%s' % tag
14 tar_name = '%s.tgz' % base_name
14 tar_name = '%s.tgz' % base_name
15
15
16 # git archive is weird: Even if I give it a specific path, it still won't
16 # git archive is weird: Even if I give it a specific path, it still won't
17 # archive the whole tree. It seems the only way to get the whole tree is to cd
17 # archive the whole tree. It seems the only way to get the whole tree is to cd
18 # to the top of the tree. There are long threads (since 2007) on the git list
18 # to the top of the tree. There are long threads (since 2007) on the git list
19 # about this and it still doesn't work in a sensible way...
19 # about this and it still doesn't work in a sensible way...
20
20
21 start_dir = os.getcwd()
21 start_dir = os.getcwd()
22 cd('..')
22 cd('..')
23 git_tpl = 'git archive --format=tar --prefix={0}/ HEAD | gzip > {1}'
23 git_tpl = 'git archive --format=tar --prefix={0}/ HEAD | gzip > {1}'
24 sh(git_tpl.format(base_name, tar_name))
24 sh(git_tpl.format(base_name, tar_name))
25 sh('mv {0} tools/'.format(tar_name))
25 sh('mv {0} tools/'.format(tar_name))
General Comments 0
You need to be logged in to leave comments. Login now