##// END OF EJS Templates
add scripts for non-setuptools install of zmq.parallel
MinRK -
Show More
@@ -0,0 +1,16 b''
1 # encoding: utf-8
2
3 """"""
4
5 __docformat__ = "restructuredtext en"
6
7 #-------------------------------------------------------------------------------
8 # Copyright (C) 2008 The IPython Development Team
9 #
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
12 #-------------------------------------------------------------------------------
13
14 #-------------------------------------------------------------------------------
15 # Imports
16 #------------------------------------------------------------------------------- No newline at end of file
@@ -0,0 +1,18 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3
4 #-----------------------------------------------------------------------------
5 # Copyright (C) 2008-2009 The IPython Development Team
6 #
7 # Distributed under the terms of the BSD License. The full license is in
8 # the file COPYING, distributed as part of this software.
9 #-----------------------------------------------------------------------------
10
11 #-----------------------------------------------------------------------------
12 # Imports
13 #-----------------------------------------------------------------------------
14
15
16 from IPython.zmq.parallel.ipclusterapp import launch_new_instance
17
18 launch_new_instance()
@@ -0,0 +1,18 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3
4 #-----------------------------------------------------------------------------
5 # Copyright (C) 2008-2009 The IPython Development Team
6 #
7 # Distributed under the terms of the BSD License. The full license is in
8 # the file COPYING, distributed as part of this software.
9 #-----------------------------------------------------------------------------
10
11 #-----------------------------------------------------------------------------
12 # Imports
13 #-----------------------------------------------------------------------------
14
15
16 from IPython.zmq.parallel.ipcontrollerapp import launch_new_instance
17
18 launch_new_instance()
@@ -0,0 +1,20 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3
4 #-----------------------------------------------------------------------------
5 # Copyright (C) 2008-2009 The IPython Development Team
6 #
7 # Distributed under the terms of the BSD License. The full license is in
8 # the file COPYING, distributed as part of this software.
9 #-----------------------------------------------------------------------------
10
11 #-----------------------------------------------------------------------------
12 # Imports
13 #-----------------------------------------------------------------------------
14
15
16 from IPython.zmq.parallel.ipengineapp import launch_new_instance
17
18 launch_new_instance()
19
20
@@ -0,0 +1,20 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3
4 #-----------------------------------------------------------------------------
5 # Copyright (C) 2008-2009 The IPython Development Team
6 #
7 # Distributed under the terms of the BSD License. The full license is in
8 # the file COPYING, distributed as part of this software.
9 #-----------------------------------------------------------------------------
10
11 #-----------------------------------------------------------------------------
12 # Imports
13 #-----------------------------------------------------------------------------
14
15
16 from IPython.zmq.parallel.iploggerapp import launch_new_instance
17
18 launch_new_instance()
19
20
@@ -1,375 +1,378 b''
1 # encoding: utf-8
1 # encoding: utf-8
2 """
2 """
3 This module defines the things that are used in setup.py for building IPython
3 This module defines the things that are used in setup.py for building IPython
4
4
5 This includes:
5 This includes:
6
6
7 * The basic arguments to setup
7 * The basic arguments to setup
8 * Functions for finding things like packages, package data, etc.
8 * Functions for finding things like packages, package data, etc.
9 * A function for checking dependencies.
9 * A function for checking dependencies.
10 """
10 """
11 from __future__ import print_function
11 from __future__ import print_function
12
12
13 #-------------------------------------------------------------------------------
13 #-------------------------------------------------------------------------------
14 # Copyright (C) 2008 The IPython Development Team
14 # Copyright (C) 2008 The IPython Development Team
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #-------------------------------------------------------------------------------
18 #-------------------------------------------------------------------------------
19
19
20 #-------------------------------------------------------------------------------
20 #-------------------------------------------------------------------------------
21 # Imports
21 # Imports
22 #-------------------------------------------------------------------------------
22 #-------------------------------------------------------------------------------
23 import os
23 import os
24 import sys
24 import sys
25
25
26 from ConfigParser import ConfigParser
26 from ConfigParser import ConfigParser
27 from distutils.command.build_py import build_py
27 from distutils.command.build_py import build_py
28 from glob import glob
28 from glob import glob
29
29
30 from setupext import install_data_ext
30 from setupext import install_data_ext
31
31
32 #-------------------------------------------------------------------------------
32 #-------------------------------------------------------------------------------
33 # Useful globals and utility functions
33 # Useful globals and utility functions
34 #-------------------------------------------------------------------------------
34 #-------------------------------------------------------------------------------
35
35
36 # A few handy globals
36 # A few handy globals
37 isfile = os.path.isfile
37 isfile = os.path.isfile
38 pjoin = os.path.join
38 pjoin = os.path.join
39
39
40 def oscmd(s):
40 def oscmd(s):
41 print(">", s)
41 print(">", s)
42 os.system(s)
42 os.system(s)
43
43
44 # A little utility we'll need below, since glob() does NOT allow you to do
44 # A little utility we'll need below, since glob() does NOT allow you to do
45 # exclusion on multiple endings!
45 # exclusion on multiple endings!
46 def file_doesnt_endwith(test,endings):
46 def file_doesnt_endwith(test,endings):
47 """Return true if test is a file and its name does NOT end with any
47 """Return true if test is a file and its name does NOT end with any
48 of the strings listed in endings."""
48 of the strings listed in endings."""
49 if not isfile(test):
49 if not isfile(test):
50 return False
50 return False
51 for e in endings:
51 for e in endings:
52 if test.endswith(e):
52 if test.endswith(e):
53 return False
53 return False
54 return True
54 return True
55
55
56 #---------------------------------------------------------------------------
56 #---------------------------------------------------------------------------
57 # Basic project information
57 # Basic project information
58 #---------------------------------------------------------------------------
58 #---------------------------------------------------------------------------
59
59
60 # release.py contains version, authors, license, url, keywords, etc.
60 # release.py contains version, authors, license, url, keywords, etc.
61 execfile(pjoin('IPython','core','release.py'))
61 execfile(pjoin('IPython','core','release.py'))
62
62
63 # Create a dict with the basic information
63 # Create a dict with the basic information
64 # This dict is eventually passed to setup after additional keys are added.
64 # This dict is eventually passed to setup after additional keys are added.
65 setup_args = dict(
65 setup_args = dict(
66 name = name,
66 name = name,
67 version = version,
67 version = version,
68 description = description,
68 description = description,
69 long_description = long_description,
69 long_description = long_description,
70 author = author,
70 author = author,
71 author_email = author_email,
71 author_email = author_email,
72 url = url,
72 url = url,
73 download_url = download_url,
73 download_url = download_url,
74 license = license,
74 license = license,
75 platforms = platforms,
75 platforms = platforms,
76 keywords = keywords,
76 keywords = keywords,
77 cmdclass = {'install_data': install_data_ext},
77 cmdclass = {'install_data': install_data_ext},
78 )
78 )
79
79
80
80
81 #---------------------------------------------------------------------------
81 #---------------------------------------------------------------------------
82 # Find packages
82 # Find packages
83 #---------------------------------------------------------------------------
83 #---------------------------------------------------------------------------
84
84
85 def add_package(packages,pname,config=False,tests=False,scripts=False,
85 def add_package(packages,pname,config=False,tests=False,scripts=False,
86 others=None):
86 others=None):
87 """
87 """
88 Add a package to the list of packages, including certain subpackages.
88 Add a package to the list of packages, including certain subpackages.
89 """
89 """
90 packages.append('.'.join(['IPython',pname]))
90 packages.append('.'.join(['IPython',pname]))
91 if config:
91 if config:
92 packages.append('.'.join(['IPython',pname,'config']))
92 packages.append('.'.join(['IPython',pname,'config']))
93 if tests:
93 if tests:
94 packages.append('.'.join(['IPython',pname,'tests']))
94 packages.append('.'.join(['IPython',pname,'tests']))
95 if scripts:
95 if scripts:
96 packages.append('.'.join(['IPython',pname,'scripts']))
96 packages.append('.'.join(['IPython',pname,'scripts']))
97 if others is not None:
97 if others is not None:
98 for o in others:
98 for o in others:
99 packages.append('.'.join(['IPython',pname,o]))
99 packages.append('.'.join(['IPython',pname,o]))
100
100
101 def find_packages():
101 def find_packages():
102 """
102 """
103 Find all of IPython's packages.
103 Find all of IPython's packages.
104 """
104 """
105 packages = ['IPython']
105 packages = ['IPython']
106 add_package(packages, 'config', tests=True, others=['default','profile'])
106 add_package(packages, 'config', tests=True, others=['default','profile'])
107 add_package(packages, 'core', tests=True)
107 add_package(packages, 'core', tests=True)
108 add_package(packages, 'deathrow', tests=True)
108 add_package(packages, 'deathrow', tests=True)
109 add_package(packages, 'extensions')
109 add_package(packages, 'extensions')
110 add_package(packages, 'external')
110 add_package(packages, 'external')
111 add_package(packages, 'external.argparse')
111 add_package(packages, 'external.argparse')
112 add_package(packages, 'external.configobj')
112 add_package(packages, 'external.configobj')
113 add_package(packages, 'external.decorator')
113 add_package(packages, 'external.decorator')
114 add_package(packages, 'external.decorators')
114 add_package(packages, 'external.decorators')
115 add_package(packages, 'external.guid')
115 add_package(packages, 'external.guid')
116 add_package(packages, 'external.Itpl')
116 add_package(packages, 'external.Itpl')
117 add_package(packages, 'external.mglob')
117 add_package(packages, 'external.mglob')
118 add_package(packages, 'external.path')
118 add_package(packages, 'external.path')
119 add_package(packages, 'external.pexpect')
119 add_package(packages, 'external.pexpect')
120 add_package(packages, 'external.pyparsing')
120 add_package(packages, 'external.pyparsing')
121 add_package(packages, 'external.simplegeneric')
121 add_package(packages, 'external.simplegeneric')
122 add_package(packages, 'external.validate')
122 add_package(packages, 'external.validate')
123 add_package(packages, 'kernel')
123 add_package(packages, 'kernel')
124 add_package(packages, 'frontend')
124 add_package(packages, 'frontend')
125 add_package(packages, 'frontend.qt')
125 add_package(packages, 'frontend.qt')
126 add_package(packages, 'frontend.qt.console', tests=True)
126 add_package(packages, 'frontend.qt.console', tests=True)
127 add_package(packages, 'frontend.terminal', tests=True)
127 add_package(packages, 'frontend.terminal', tests=True)
128 add_package(packages, 'lib', tests=True)
128 add_package(packages, 'lib', tests=True)
129 add_package(packages, 'quarantine', tests=True)
129 add_package(packages, 'quarantine', tests=True)
130 add_package(packages, 'scripts')
130 add_package(packages, 'scripts')
131 add_package(packages, 'testing', tests=True)
131 add_package(packages, 'testing', tests=True)
132 add_package(packages, 'testing.plugin', tests=False)
132 add_package(packages, 'testing.plugin', tests=False)
133 add_package(packages, 'utils', tests=True)
133 add_package(packages, 'utils', tests=True)
134 add_package(packages, 'zmq')
134 add_package(packages, 'zmq')
135 add_package(packages, 'zmq.parallel')
135 add_package(packages, 'zmq.parallel')
136 add_package(packages, 'zmq.pylab')
136 add_package(packages, 'zmq.pylab')
137 return packages
137 return packages
138
138
139 #---------------------------------------------------------------------------
139 #---------------------------------------------------------------------------
140 # Find package data
140 # Find package data
141 #---------------------------------------------------------------------------
141 #---------------------------------------------------------------------------
142
142
143 def find_package_data():
143 def find_package_data():
144 """
144 """
145 Find IPython's package_data.
145 Find IPython's package_data.
146 """
146 """
147 # This is not enough for these things to appear in an sdist.
147 # This is not enough for these things to appear in an sdist.
148 # We need to muck with the MANIFEST to get this to work
148 # We need to muck with the MANIFEST to get this to work
149 package_data = {
149 package_data = {
150 'IPython.config.userconfig' : ['*'],
150 'IPython.config.userconfig' : ['*'],
151 'IPython.testing' : ['*.txt']
151 'IPython.testing' : ['*.txt']
152 }
152 }
153 return package_data
153 return package_data
154
154
155
155
156 #---------------------------------------------------------------------------
156 #---------------------------------------------------------------------------
157 # Find data files
157 # Find data files
158 #---------------------------------------------------------------------------
158 #---------------------------------------------------------------------------
159
159
160 def make_dir_struct(tag,base,out_base):
160 def make_dir_struct(tag,base,out_base):
161 """Make the directory structure of all files below a starting dir.
161 """Make the directory structure of all files below a starting dir.
162
162
163 This is just a convenience routine to help build a nested directory
163 This is just a convenience routine to help build a nested directory
164 hierarchy because distutils is too stupid to do this by itself.
164 hierarchy because distutils is too stupid to do this by itself.
165
165
166 XXX - this needs a proper docstring!
166 XXX - this needs a proper docstring!
167 """
167 """
168
168
169 # we'll use these a lot below
169 # we'll use these a lot below
170 lbase = len(base)
170 lbase = len(base)
171 pathsep = os.path.sep
171 pathsep = os.path.sep
172 lpathsep = len(pathsep)
172 lpathsep = len(pathsep)
173
173
174 out = []
174 out = []
175 for (dirpath,dirnames,filenames) in os.walk(base):
175 for (dirpath,dirnames,filenames) in os.walk(base):
176 # we need to strip out the dirpath from the base to map it to the
176 # we need to strip out the dirpath from the base to map it to the
177 # output (installation) path. This requires possibly stripping the
177 # output (installation) path. This requires possibly stripping the
178 # path separator, because otherwise pjoin will not work correctly
178 # path separator, because otherwise pjoin will not work correctly
179 # (pjoin('foo/','/bar') returns '/bar').
179 # (pjoin('foo/','/bar') returns '/bar').
180
180
181 dp_eff = dirpath[lbase:]
181 dp_eff = dirpath[lbase:]
182 if dp_eff.startswith(pathsep):
182 if dp_eff.startswith(pathsep):
183 dp_eff = dp_eff[lpathsep:]
183 dp_eff = dp_eff[lpathsep:]
184 # The output path must be anchored at the out_base marker
184 # The output path must be anchored at the out_base marker
185 out_path = pjoin(out_base,dp_eff)
185 out_path = pjoin(out_base,dp_eff)
186 # Now we can generate the final filenames. Since os.walk only produces
186 # Now we can generate the final filenames. Since os.walk only produces
187 # filenames, we must join back with the dirpath to get full valid file
187 # filenames, we must join back with the dirpath to get full valid file
188 # paths:
188 # paths:
189 pfiles = [pjoin(dirpath,f) for f in filenames]
189 pfiles = [pjoin(dirpath,f) for f in filenames]
190 # Finally, generate the entry we need, which is a pari of (output
190 # Finally, generate the entry we need, which is a pari of (output
191 # path, files) for use as a data_files parameter in install_data.
191 # path, files) for use as a data_files parameter in install_data.
192 out.append((out_path, pfiles))
192 out.append((out_path, pfiles))
193
193
194 return out
194 return out
195
195
196
196
197 def find_data_files():
197 def find_data_files():
198 """
198 """
199 Find IPython's data_files.
199 Find IPython's data_files.
200
200
201 Most of these are docs.
201 Most of these are docs.
202 """
202 """
203
203
204 docdirbase = pjoin('share', 'doc', 'ipython')
204 docdirbase = pjoin('share', 'doc', 'ipython')
205 manpagebase = pjoin('share', 'man', 'man1')
205 manpagebase = pjoin('share', 'man', 'man1')
206
206
207 # Simple file lists can be made by hand
207 # Simple file lists can be made by hand
208 manpages = filter(isfile, glob(pjoin('docs','man','*.1.gz')))
208 manpages = filter(isfile, glob(pjoin('docs','man','*.1.gz')))
209 igridhelpfiles = filter(isfile,
209 igridhelpfiles = filter(isfile,
210 glob(pjoin('IPython','extensions','igrid_help.*')))
210 glob(pjoin('IPython','extensions','igrid_help.*')))
211
211
212 # For nested structures, use the utility above
212 # For nested structures, use the utility above
213 example_files = make_dir_struct(
213 example_files = make_dir_struct(
214 'data',
214 'data',
215 pjoin('docs','examples'),
215 pjoin('docs','examples'),
216 pjoin(docdirbase,'examples')
216 pjoin(docdirbase,'examples')
217 )
217 )
218 manual_files = make_dir_struct(
218 manual_files = make_dir_struct(
219 'data',
219 'data',
220 pjoin('docs','dist'),
220 pjoin('docs','dist'),
221 pjoin(docdirbase,'manual')
221 pjoin(docdirbase,'manual')
222 )
222 )
223
223
224 # And assemble the entire output list
224 # And assemble the entire output list
225 data_files = [ (manpagebase, manpages),
225 data_files = [ (manpagebase, manpages),
226 (pjoin(docdirbase, 'extensions'), igridhelpfiles),
226 (pjoin(docdirbase, 'extensions'), igridhelpfiles),
227 ] + manual_files + example_files
227 ] + manual_files + example_files
228
228
229 return data_files
229 return data_files
230
230
231
231
232 def make_man_update_target(manpage):
232 def make_man_update_target(manpage):
233 """Return a target_update-compliant tuple for the given manpage.
233 """Return a target_update-compliant tuple for the given manpage.
234
234
235 Parameters
235 Parameters
236 ----------
236 ----------
237 manpage : string
237 manpage : string
238 Name of the manpage, must include the section number (trailing number).
238 Name of the manpage, must include the section number (trailing number).
239
239
240 Example
240 Example
241 -------
241 -------
242
242
243 >>> make_man_update_target('ipython.1') #doctest: +NORMALIZE_WHITESPACE
243 >>> make_man_update_target('ipython.1') #doctest: +NORMALIZE_WHITESPACE
244 ('docs/man/ipython.1.gz',
244 ('docs/man/ipython.1.gz',
245 ['docs/man/ipython.1'],
245 ['docs/man/ipython.1'],
246 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz')
246 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz')
247 """
247 """
248 man_dir = pjoin('docs', 'man')
248 man_dir = pjoin('docs', 'man')
249 manpage_gz = manpage + '.gz'
249 manpage_gz = manpage + '.gz'
250 manpath = pjoin(man_dir, manpage)
250 manpath = pjoin(man_dir, manpage)
251 manpath_gz = pjoin(man_dir, manpage_gz)
251 manpath_gz = pjoin(man_dir, manpage_gz)
252 gz_cmd = ( "cd %(man_dir)s && gzip -9c %(manpage)s > %(manpage_gz)s" %
252 gz_cmd = ( "cd %(man_dir)s && gzip -9c %(manpage)s > %(manpage_gz)s" %
253 locals() )
253 locals() )
254 return (manpath_gz, [manpath], gz_cmd)
254 return (manpath_gz, [manpath], gz_cmd)
255
255
256 #---------------------------------------------------------------------------
256 #---------------------------------------------------------------------------
257 # Find scripts
257 # Find scripts
258 #---------------------------------------------------------------------------
258 #---------------------------------------------------------------------------
259
259
260 def find_scripts():
260 def find_scripts():
261 """
261 """
262 Find IPython's scripts.
262 Find IPython's scripts.
263 """
263 """
264 # kernel_scripts = pjoin('IPython','kernel','scripts')
264 zmq_scripts = pjoin('IPython','zmq','parallel','scripts')
265 main_scripts = pjoin('IPython','scripts')
265 main_scripts = pjoin('IPython','scripts')
266 scripts = [# pjoin(kernel_scripts, 'ipengine'),
266 scripts = [pjoin(zmq_scripts, 'ipenginez'),
267 # pjoin(kernel_scripts, 'ipcontroller'),
267 pjoin(zmq_scripts, 'ipcontrollerz'),
268 # pjoin(kernel_scripts, 'ipcluster'),
268 pjoin(zmq_scripts, 'ipclusterz'),
269 pjoin(zmq_scripts, 'iploggerz'),
269 pjoin(main_scripts, 'ipython'),
270 pjoin(main_scripts, 'ipython'),
270 pjoin(main_scripts, 'ipython-qtconsole'),
271 pjoin(main_scripts, 'ipython-qtconsole'),
271 pjoin(main_scripts, 'pycolor'),
272 pjoin(main_scripts, 'pycolor'),
272 pjoin(main_scripts, 'irunner'),
273 pjoin(main_scripts, 'irunner'),
273 pjoin(main_scripts, 'iptest')
274 pjoin(main_scripts, 'iptest')
274 ]
275 ]
275
276
276 # Script to be run by the windows binary installer after the default setup
277 # Script to be run by the windows binary installer after the default setup
277 # routine, to add shortcuts and similar windows-only things. Windows
278 # routine, to add shortcuts and similar windows-only things. Windows
278 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
279 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
279 # doesn't find them.
280 # doesn't find them.
280 if 'bdist_wininst' in sys.argv:
281 if 'bdist_wininst' in sys.argv:
281 if len(sys.argv) > 2 and \
282 if len(sys.argv) > 2 and \
282 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
283 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
283 print("ERROR: bdist_wininst must be run alone. Exiting.",
284 print("ERROR: bdist_wininst must be run alone. Exiting.",
284 file=sys.stderr)
285 file=sys.stderr)
285 sys.exit(1)
286 sys.exit(1)
286 scripts.append(pjoin('scripts','ipython_win_post_install.py'))
287 scripts.append(pjoin('scripts','ipython_win_post_install.py'))
287
288
288 return scripts
289 return scripts
289
290
290 #---------------------------------------------------------------------------
291 #---------------------------------------------------------------------------
291 # Verify all dependencies
292 # Verify all dependencies
292 #---------------------------------------------------------------------------
293 #---------------------------------------------------------------------------
293
294
294 def check_for_dependencies():
295 def check_for_dependencies():
295 """Check for IPython's dependencies.
296 """Check for IPython's dependencies.
296
297
297 This function should NOT be called if running under setuptools!
298 This function should NOT be called if running under setuptools!
298 """
299 """
299 from setupext.setupext import (
300 from setupext.setupext import (
300 print_line, print_raw, print_status,
301 print_line, print_raw, print_status,
301 check_for_sphinx, check_for_pygments,
302 check_for_sphinx, check_for_pygments,
302 check_for_nose, check_for_pexpect
303 check_for_nose, check_for_pexpect,
304 check_for_pyzmq
303 )
305 )
304 print_line()
306 print_line()
305 print_raw("BUILDING IPYTHON")
307 print_raw("BUILDING IPYTHON")
306 print_status('python', sys.version)
308 print_status('python', sys.version)
307 print_status('platform', sys.platform)
309 print_status('platform', sys.platform)
308 if sys.platform == 'win32':
310 if sys.platform == 'win32':
309 print_status('Windows version', sys.getwindowsversion())
311 print_status('Windows version', sys.getwindowsversion())
310
312
311 print_raw("")
313 print_raw("")
312 print_raw("OPTIONAL DEPENDENCIES")
314 print_raw("OPTIONAL DEPENDENCIES")
313
315
314 check_for_sphinx()
316 check_for_sphinx()
315 check_for_pygments()
317 check_for_pygments()
316 check_for_nose()
318 check_for_nose()
317 check_for_pexpect()
319 check_for_pexpect()
320 check_for_pyzmq()
318
321
319
322
320 def record_commit_info(pkg_dir, build_cmd=build_py):
323 def record_commit_info(pkg_dir, build_cmd=build_py):
321 """ Return extended build command class for recording commit
324 """ Return extended build command class for recording commit
322
325
323 The extended command tries to run git to find the current commit, getting
326 The extended command tries to run git to find the current commit, getting
324 the empty string if it fails. It then writes the commit hash into a file
327 the empty string if it fails. It then writes the commit hash into a file
325 in the `pkg_dir` path, named ``.git_commit_info.ini``.
328 in the `pkg_dir` path, named ``.git_commit_info.ini``.
326
329
327 In due course this information can be used by the package after it is
330 In due course this information can be used by the package after it is
328 installed, to tell you what commit it was installed from if known.
331 installed, to tell you what commit it was installed from if known.
329
332
330 To make use of this system, you need a package with a .git_commit_info.ini
333 To make use of this system, you need a package with a .git_commit_info.ini
331 file - e.g. ``myproject/.git_commit_info.ini`` - that might well look like
334 file - e.g. ``myproject/.git_commit_info.ini`` - that might well look like
332 this::
335 this::
333
336
334 # This is an ini file that may contain information about the code state
337 # This is an ini file that may contain information about the code state
335 [commit hash]
338 [commit hash]
336 # The line below may contain a valid hash if it has been substituted
339 # The line below may contain a valid hash if it has been substituted
337 # during 'git archive'
340 # during 'git archive'
338 archive_subst_hash=$Format:%h$
341 archive_subst_hash=$Format:%h$
339 # This line may be modified by the install process
342 # This line may be modified by the install process
340 install_hash=
343 install_hash=
341
344
342 The .git_commit_info file above is also designed to be used with git
345 The .git_commit_info file above is also designed to be used with git
343 substitution - so you probably also want a ``.gitattributes`` file in the
346 substitution - so you probably also want a ``.gitattributes`` file in the
344 root directory of your working tree that contains something like this::
347 root directory of your working tree that contains something like this::
345
348
346 myproject/.git_commit_info.ini export-subst
349 myproject/.git_commit_info.ini export-subst
347
350
348 That will cause the ``.git_commit_info.ini`` file to get filled in by ``git
351 That will cause the ``.git_commit_info.ini`` file to get filled in by ``git
349 archive`` - useful in case someone makes such an archive - for example with
352 archive`` - useful in case someone makes such an archive - for example with
350 via the github 'download source' button.
353 via the github 'download source' button.
351
354
352 Although all the above will work as is, you might consider having something
355 Although all the above will work as is, you might consider having something
353 like a ``get_info()`` function in your package to display the commit
356 like a ``get_info()`` function in your package to display the commit
354 information at the terminal. See the ``pkg_info.py`` module in the nipy
357 information at the terminal. See the ``pkg_info.py`` module in the nipy
355 package for an example.
358 package for an example.
356 """
359 """
357 class MyBuildPy(build_cmd):
360 class MyBuildPy(build_cmd):
358 ''' Subclass to write commit data into installation tree '''
361 ''' Subclass to write commit data into installation tree '''
359 def run(self):
362 def run(self):
360 build_py.run(self)
363 build_py.run(self)
361 import subprocess
364 import subprocess
362 proc = subprocess.Popen('git rev-parse --short HEAD',
365 proc = subprocess.Popen('git rev-parse --short HEAD',
363 stdout=subprocess.PIPE,
366 stdout=subprocess.PIPE,
364 stderr=subprocess.PIPE,
367 stderr=subprocess.PIPE,
365 shell=True)
368 shell=True)
366 repo_commit, _ = proc.communicate()
369 repo_commit, _ = proc.communicate()
367 # We write the installation commit even if it's empty
370 # We write the installation commit even if it's empty
368 cfg_parser = ConfigParser()
371 cfg_parser = ConfigParser()
369 cfg_parser.read(pjoin(pkg_dir, '.git_commit_info.ini'))
372 cfg_parser.read(pjoin(pkg_dir, '.git_commit_info.ini'))
370 cfg_parser.set('commit hash', 'install_hash', repo_commit)
373 cfg_parser.set('commit hash', 'install_hash', repo_commit)
371 out_pth = pjoin(self.build_lib, pkg_dir, '.git_commit_info.ini')
374 out_pth = pjoin(self.build_lib, pkg_dir, '.git_commit_info.ini')
372 out_file = open(out_pth, 'wt')
375 out_file = open(out_pth, 'wt')
373 cfg_parser.write(out_file)
376 cfg_parser.write(out_file)
374 out_file.close()
377 out_file.close()
375 return MyBuildPy
378 return MyBuildPy
@@ -1,139 +1,142 b''
1 # encoding: utf-8
1 # encoding: utf-8
2
2
3 __docformat__ = "restructuredtext en"
3 __docformat__ = "restructuredtext en"
4
4
5 #-------------------------------------------------------------------------------
5 #-------------------------------------------------------------------------------
6 # Copyright (C) 2008 The IPython Development Team
6 # Copyright (C) 2008 The IPython Development Team
7 #
7 #
8 # Distributed under the terms of the BSD License. The full license is in
8 # Distributed under the terms of the BSD License. The full license is in
9 # the file COPYING, distributed as part of this software.
9 # the file COPYING, distributed as part of this software.
10 #-------------------------------------------------------------------------------
10 #-------------------------------------------------------------------------------
11
11
12 #-------------------------------------------------------------------------------
12 #-------------------------------------------------------------------------------
13 # Imports
13 # Imports
14 #-------------------------------------------------------------------------------
14 #-------------------------------------------------------------------------------
15
15
16 import sys, os
16 import sys, os
17 from textwrap import fill
17 from textwrap import fill
18
18
19 display_status=True
19 display_status=True
20
20
21 if display_status:
21 if display_status:
22 def print_line(char='='):
22 def print_line(char='='):
23 print char * 76
23 print char * 76
24
24
25 def print_status(package, status):
25 def print_status(package, status):
26 initial_indent = "%22s: " % package
26 initial_indent = "%22s: " % package
27 indent = ' ' * 24
27 indent = ' ' * 24
28 print fill(str(status), width=76,
28 print fill(str(status), width=76,
29 initial_indent=initial_indent,
29 initial_indent=initial_indent,
30 subsequent_indent=indent)
30 subsequent_indent=indent)
31
31
32 def print_message(message):
32 def print_message(message):
33 indent = ' ' * 24 + "* "
33 indent = ' ' * 24 + "* "
34 print fill(str(message), width=76,
34 print fill(str(message), width=76,
35 initial_indent=indent,
35 initial_indent=indent,
36 subsequent_indent=indent)
36 subsequent_indent=indent)
37
37
38 def print_raw(section):
38 def print_raw(section):
39 print section
39 print section
40 else:
40 else:
41 def print_line(*args, **kwargs):
41 def print_line(*args, **kwargs):
42 pass
42 pass
43 print_status = print_message = print_raw = print_line
43 print_status = print_message = print_raw = print_line
44
44
45 #-------------------------------------------------------------------------------
45 #-------------------------------------------------------------------------------
46 # Tests for specific packages
46 # Tests for specific packages
47 #-------------------------------------------------------------------------------
47 #-------------------------------------------------------------------------------
48
48
49 def check_for_ipython():
49 def check_for_ipython():
50 try:
50 try:
51 import IPython
51 import IPython
52 except ImportError:
52 except ImportError:
53 print_status("IPython", "Not found")
53 print_status("IPython", "Not found")
54 return False
54 return False
55 else:
55 else:
56 print_status("IPython", IPython.__version__)
56 print_status("IPython", IPython.__version__)
57 return True
57 return True
58
58
59 def check_for_pyopenssl():
60 try:
61 import OpenSSL
62 except ImportError:
63 print_status('OpenSSL', "Not found (required if you want security in the parallel computing capabilities)")
64 return False
65 else:
66 print_status('OpenSSL', OpenSSL.__version__)
67 return True
68
69 def check_for_sphinx():
59 def check_for_sphinx():
70 try:
60 try:
71 import sphinx
61 import sphinx
72 except ImportError:
62 except ImportError:
73 print_status('sphinx', "Not found (required for building documentation)")
63 print_status('sphinx', "Not found (required for building documentation)")
74 return False
64 return False
75 else:
65 else:
76 print_status('sphinx', sphinx.__version__)
66 print_status('sphinx', sphinx.__version__)
77 return True
67 return True
78
68
79 def check_for_pygments():
69 def check_for_pygments():
80 try:
70 try:
81 import pygments
71 import pygments
82 except ImportError:
72 except ImportError:
83 print_status('pygments', "Not found (required for syntax highlighting documentation)")
73 print_status('pygments', "Not found (required for syntax highlighting documentation)")
84 return False
74 return False
85 else:
75 else:
86 print_status('pygments', pygments.__version__)
76 print_status('pygments', pygments.__version__)
87 return True
77 return True
88
78
89 def check_for_nose():
79 def check_for_nose():
90 try:
80 try:
91 import nose
81 import nose
92 except ImportError:
82 except ImportError:
93 print_status('nose', "Not found (required for running the test suite)")
83 print_status('nose', "Not found (required for running the test suite)")
94 return False
84 return False
95 else:
85 else:
96 print_status('nose', nose.__version__)
86 print_status('nose', nose.__version__)
97 return True
87 return True
98
88
99 def check_for_pexpect():
89 def check_for_pexpect():
100 try:
90 try:
101 import pexpect
91 import pexpect
102 except ImportError:
92 except ImportError:
103 print_status("pexpect", "no (required for running standalone doctests)")
93 print_status("pexpect", "no (required for running standalone doctests)")
104 return False
94 return False
105 else:
95 else:
106 print_status("pexpect", pexpect.__version__)
96 print_status("pexpect", pexpect.__version__)
107 return True
97 return True
108
98
109 def check_for_httplib2():
99 def check_for_httplib2():
110 try:
100 try:
111 import httplib2
101 import httplib2
112 except ImportError:
102 except ImportError:
113 print_status("httplib2", "no (required for blocking http clients)")
103 print_status("httplib2", "no (required for blocking http clients)")
114 return False
104 return False
115 else:
105 else:
116 print_status("httplib2","yes")
106 print_status("httplib2","yes")
117 return True
107 return True
118
108
119 def check_for_sqlalchemy():
109 def check_for_sqlalchemy():
120 try:
110 try:
121 import sqlalchemy
111 import sqlalchemy
122 except ImportError:
112 except ImportError:
123 print_status("sqlalchemy", "no (required for the ipython1 notebook)")
113 print_status("sqlalchemy", "no (required for the ipython1 notebook)")
124 return False
114 return False
125 else:
115 else:
126 print_status("sqlalchemy","yes")
116 print_status("sqlalchemy","yes")
127 return True
117 return True
128
118
129 def check_for_simplejson():
119 def check_for_simplejson():
130 try:
120 try:
131 import simplejson
121 import simplejson
132 except ImportError:
122 except ImportError:
133 print_status("simplejson", "no (required for the ipython1 notebook)")
123 print_status("simplejson", "no (required for the ipython1 notebook)")
134 return False
124 return False
135 else:
125 else:
136 print_status("simplejson","yes")
126 print_status("simplejson","yes")
137 return True
127 return True
138
128
139 No newline at end of file
129 def check_for_pyzmq():
130 try:
131 import zmq
132 except ImportError:
133 print_status('pyzmq', "no (required for qtconsole and parallel computing capabilities)")
134 return False
135 else:
136 if zmq.__version__ < '2.0.10':
137 print_status('pyzmq', "no (require >= 2.0.10 for qtconsole and parallel computing capabilities)")
138
139 else:
140 print_status("pyzmq", zmq.__version__)
141 return True
142
General Comments 0
You need to be logged in to leave comments. Login now