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