##// END OF EJS Templates
Add Trove classifiers for PyPI.
Thomas Kluyver -
Show More
@@ -1,125 +1,140 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Release data for the IPython project."""
2 """Release data for the IPython project."""
3
3
4 #-----------------------------------------------------------------------------
4 #-----------------------------------------------------------------------------
5 # Copyright (c) 2008-2011, IPython Development Team.
5 # Copyright (c) 2008-2011, IPython Development Team.
6 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
6 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
7 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
7 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
8 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
8 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
9 #
9 #
10 # Distributed under the terms of the Modified BSD License.
10 # Distributed under the terms of the Modified BSD License.
11 #
11 #
12 # The full license is in the file COPYING.txt, distributed with this software.
12 # The full license is in the file COPYING.txt, distributed with this software.
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 # Name of the package for release purposes. This is the name which labels
15 # Name of the package for release purposes. This is the name which labels
16 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
16 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
17 name = 'ipython'
17 name = 'ipython'
18
18
19 # IPython version information. An empty _version_extra corresponds to a full
19 # IPython version information. An empty _version_extra corresponds to a full
20 # release. 'dev' as a _version_extra string means this is a development
20 # release. 'dev' as a _version_extra string means this is a development
21 # version
21 # version
22 _version_major = 0
22 _version_major = 0
23 _version_minor = 12
23 _version_minor = 12
24 _version_micro = '' # use '' for first of series, number for 1 and above
24 _version_micro = '' # use '' for first of series, number for 1 and above
25 _version_extra = 'dev'
25 _version_extra = 'dev'
26 #_version_extra = '' # Uncomment this for full releases
26 #_version_extra = '' # Uncomment this for full releases
27
27
28 # Construct full version string from these.
28 # Construct full version string from these.
29 _ver = [_version_major, _version_minor]
29 _ver = [_version_major, _version_minor]
30 if _version_micro:
30 if _version_micro:
31 _ver.append(_version_micro)
31 _ver.append(_version_micro)
32 if _version_extra:
32 if _version_extra:
33 _ver.append(_version_extra)
33 _ver.append(_version_extra)
34
34
35 __version__ = '.'.join(map(str, _ver))
35 __version__ = '.'.join(map(str, _ver))
36
36
37 version = __version__ # backwards compatibility name
37 version = __version__ # backwards compatibility name
38
38
39 description = "IPython: Productive Interactive Computing"
39 description = "IPython: Productive Interactive Computing"
40
40
41 long_description = \
41 long_description = \
42 """
42 """
43 IPython provides a rich toolkit to help you make the most out of using Python
43 IPython provides a rich toolkit to help you make the most out of using Python
44 interactively. Its main components are:
44 interactively. Its main components are:
45
45
46 * Powerful interactive Python shells (terminal- and Qt-based).
46 * Powerful interactive Python shells (terminal- and Qt-based).
47 * Support for interactive data visualization and use of GUI toolkits.
47 * Support for interactive data visualization and use of GUI toolkits.
48 * Flexible, embeddable interpreters to load into your own projects.
48 * Flexible, embeddable interpreters to load into your own projects.
49 * Tools for high level and interactive parallel computing.
49 * Tools for high level and interactive parallel computing.
50
50
51 The enhanced interactive Python shells have the following main features:
51 The enhanced interactive Python shells have the following main features:
52
52
53 * Comprehensive object introspection.
53 * Comprehensive object introspection.
54
54
55 * Input history, persistent across sessions.
55 * Input history, persistent across sessions.
56
56
57 * Caching of output results during a session with automatically generated
57 * Caching of output results during a session with automatically generated
58 references.
58 references.
59
59
60 * Readline based name completion.
60 * Readline based name completion.
61
61
62 * Extensible system of 'magic' commands for controlling the environment and
62 * Extensible system of 'magic' commands for controlling the environment and
63 performing many tasks related either to IPython or the operating system.
63 performing many tasks related either to IPython or the operating system.
64
64
65 * Configuration system with easy switching between different setups (simpler
65 * Configuration system with easy switching between different setups (simpler
66 than changing $PYTHONSTARTUP environment variables every time).
66 than changing $PYTHONSTARTUP environment variables every time).
67
67
68 * Session logging and reloading.
68 * Session logging and reloading.
69
69
70 * Extensible syntax processing for special purpose situations.
70 * Extensible syntax processing for special purpose situations.
71
71
72 * Access to the system shell with user-extensible alias system.
72 * Access to the system shell with user-extensible alias system.
73
73
74 * Easily embeddable in other Python programs and wxPython GUIs.
74 * Easily embeddable in other Python programs and wxPython GUIs.
75
75
76 * Integrated access to the pdb debugger and the Python profiler.
76 * Integrated access to the pdb debugger and the Python profiler.
77
77
78 The parallel computing architecture has the following main features:
78 The parallel computing architecture has the following main features:
79
79
80 * Quickly parallelize Python code from an interactive Python/IPython session.
80 * Quickly parallelize Python code from an interactive Python/IPython session.
81
81
82 * A flexible and dynamic process model that be deployed on anything from
82 * A flexible and dynamic process model that be deployed on anything from
83 multicore workstations to supercomputers.
83 multicore workstations to supercomputers.
84
84
85 * An architecture that supports many different styles of parallelism, from
85 * An architecture that supports many different styles of parallelism, from
86 message passing to task farming.
86 message passing to task farming.
87
87
88 * Both blocking and fully asynchronous interfaces.
88 * Both blocking and fully asynchronous interfaces.
89
89
90 * High level APIs that enable many things to be parallelized in a few lines
90 * High level APIs that enable many things to be parallelized in a few lines
91 of code.
91 of code.
92
92
93 * Share live parallel jobs with other users securely.
93 * Share live parallel jobs with other users securely.
94
94
95 * Dynamically load balanced task farming system.
95 * Dynamically load balanced task farming system.
96
96
97 * Robust error handling in parallel code.
97 * Robust error handling in parallel code.
98
98
99 The latest development version is always available from IPython's `GitHub
99 The latest development version is always available from IPython's `GitHub
100 site <http://github.com/ipython>`_.
100 site <http://github.com/ipython>`_.
101 """
101 """
102
102
103 license = 'BSD'
103 license = 'BSD'
104
104
105 authors = {'Fernando' : ('Fernando Perez','fperez.net@gmail.com'),
105 authors = {'Fernando' : ('Fernando Perez','fperez.net@gmail.com'),
106 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
106 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
107 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu'),
107 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu'),
108 'Ville' : ('Ville Vainio','vivainio@gmail.com'),
108 'Ville' : ('Ville Vainio','vivainio@gmail.com'),
109 'Brian' : ('Brian E Granger', 'ellisonbg@gmail.com'),
109 'Brian' : ('Brian E Granger', 'ellisonbg@gmail.com'),
110 'Min' : ('Min Ragan-Kelley', 'benjaminrk@gmail.com')
110 'Min' : ('Min Ragan-Kelley', 'benjaminrk@gmail.com')
111 }
111 }
112
112
113 author = 'The IPython Development Team'
113 author = 'The IPython Development Team'
114
114
115 author_email = 'ipython-dev@scipy.org'
115 author_email = 'ipython-dev@scipy.org'
116
116
117 url = 'http://ipython.org'
117 url = 'http://ipython.org'
118
118
119 # This will only be valid for actual releases sent to PyPI, but that's OK since
119 # This will only be valid for actual releases sent to PyPI, but that's OK since
120 # those are the ones we want pip/easy_install to be able to find.
120 # those are the ones we want pip/easy_install to be able to find.
121 download_url = 'http://archive.ipython.org/release/%s' % version
121 download_url = 'http://archive.ipython.org/release/%s' % version
122
122
123 platforms = ['Linux','Mac OSX','Windows XP/2000/NT']
123 platforms = ['Linux','Mac OSX','Windows XP/2000/NT']
124
124
125 keywords = ['Interactive','Interpreter','Shell','Parallel','Distributed']
125 keywords = ['Interactive','Interpreter','Shell','Parallel','Distributed']
126
127 classifiers = [
128 'Intended Audience :: Developers',
129 'Intended Audience :: Science/Research'
130 'License :: OSI Approved :: BSD License',
131 'Programming Language :: Python',
132 'Programming Language :: Python :: 2',
133 'Programming Language :: Python :: 2.6',
134 'Programming Language :: Python :: 2.7',
135 'Programming Language :: Python :: 3',
136 'Programming Language :: Python :: 3.1',
137 'Programming Language :: Python :: 3.2',
138 'Topic :: System :: Distributed Computing',
139 'Topic :: System :: Shells'
140 ]
@@ -1,376 +1,377 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 try:
26 try:
27 from configparser import ConfigParser
27 from configparser import ConfigParser
28 except:
28 except:
29 from ConfigParser import ConfigParser
29 from ConfigParser import ConfigParser
30 from distutils.command.build_py import build_py
30 from distutils.command.build_py import build_py
31 from glob import glob
31 from glob import glob
32
32
33 from setupext import install_data_ext
33 from setupext import install_data_ext
34
34
35 #-------------------------------------------------------------------------------
35 #-------------------------------------------------------------------------------
36 # Useful globals and utility functions
36 # Useful globals and utility functions
37 #-------------------------------------------------------------------------------
37 #-------------------------------------------------------------------------------
38
38
39 # A few handy globals
39 # A few handy globals
40 isfile = os.path.isfile
40 isfile = os.path.isfile
41 pjoin = os.path.join
41 pjoin = os.path.join
42
42
43 def oscmd(s):
43 def oscmd(s):
44 print(">", s)
44 print(">", s)
45 os.system(s)
45 os.system(s)
46
46
47 try:
47 try:
48 execfile
48 execfile
49 except NameError:
49 except NameError:
50 def execfile(fname, globs, locs=None):
50 def execfile(fname, globs, locs=None):
51 locs = locs or globs
51 locs = locs or globs
52 exec(compile(open(fname).read(), fname, "exec"), globs, locs)
52 exec(compile(open(fname).read(), fname, "exec"), globs, locs)
53
53
54 # A little utility we'll need below, since glob() does NOT allow you to do
54 # A little utility we'll need below, since glob() does NOT allow you to do
55 # exclusion on multiple endings!
55 # exclusion on multiple endings!
56 def file_doesnt_endwith(test,endings):
56 def file_doesnt_endwith(test,endings):
57 """Return true if test is a file and its name does NOT end with any
57 """Return true if test is a file and its name does NOT end with any
58 of the strings listed in endings."""
58 of the strings listed in endings."""
59 if not isfile(test):
59 if not isfile(test):
60 return False
60 return False
61 for e in endings:
61 for e in endings:
62 if test.endswith(e):
62 if test.endswith(e):
63 return False
63 return False
64 return True
64 return True
65
65
66 #---------------------------------------------------------------------------
66 #---------------------------------------------------------------------------
67 # Basic project information
67 # Basic project information
68 #---------------------------------------------------------------------------
68 #---------------------------------------------------------------------------
69
69
70 # release.py contains version, authors, license, url, keywords, etc.
70 # release.py contains version, authors, license, url, keywords, etc.
71 execfile(pjoin('IPython','core','release.py'), globals())
71 execfile(pjoin('IPython','core','release.py'), globals())
72
72
73 # Create a dict with the basic information
73 # Create a dict with the basic information
74 # This dict is eventually passed to setup after additional keys are added.
74 # This dict is eventually passed to setup after additional keys are added.
75 setup_args = dict(
75 setup_args = dict(
76 name = name,
76 name = name,
77 version = version,
77 version = version,
78 description = description,
78 description = description,
79 long_description = long_description,
79 long_description = long_description,
80 author = author,
80 author = author,
81 author_email = author_email,
81 author_email = author_email,
82 url = url,
82 url = url,
83 download_url = download_url,
83 download_url = download_url,
84 license = license,
84 license = license,
85 platforms = platforms,
85 platforms = platforms,
86 keywords = keywords,
86 keywords = keywords,
87 classifiers = classifiers,
87 cmdclass = {'install_data': install_data_ext},
88 cmdclass = {'install_data': install_data_ext},
88 )
89 )
89
90
90
91
91 #---------------------------------------------------------------------------
92 #---------------------------------------------------------------------------
92 # Find packages
93 # Find packages
93 #---------------------------------------------------------------------------
94 #---------------------------------------------------------------------------
94
95
95 def find_packages():
96 def find_packages():
96 """
97 """
97 Find all of IPython's packages.
98 Find all of IPython's packages.
98 """
99 """
99 excludes = ['deathrow']
100 excludes = ['deathrow']
100 packages = []
101 packages = []
101 for dir,subdirs,files in os.walk('IPython'):
102 for dir,subdirs,files in os.walk('IPython'):
102 package = dir.replace(os.path.sep, '.')
103 package = dir.replace(os.path.sep, '.')
103 if any([ package.startswith('IPython.'+exc) for exc in excludes ]):
104 if any([ package.startswith('IPython.'+exc) for exc in excludes ]):
104 # package is to be excluded (e.g. deathrow)
105 # package is to be excluded (e.g. deathrow)
105 continue
106 continue
106 if '__init__.py' not in files:
107 if '__init__.py' not in files:
107 # not a package
108 # not a package
108 continue
109 continue
109 packages.append(package)
110 packages.append(package)
110 return packages
111 return packages
111
112
112 #---------------------------------------------------------------------------
113 #---------------------------------------------------------------------------
113 # Find package data
114 # Find package data
114 #---------------------------------------------------------------------------
115 #---------------------------------------------------------------------------
115
116
116 def find_package_data():
117 def find_package_data():
117 """
118 """
118 Find IPython's package_data.
119 Find IPython's package_data.
119 """
120 """
120 # This is not enough for these things to appear in an sdist.
121 # This is not enough for these things to appear in an sdist.
121 # We need to muck with the MANIFEST to get this to work
122 # We need to muck with the MANIFEST to get this to work
122
123
123 # walk notebook resources:
124 # walk notebook resources:
124 cwd = os.getcwd()
125 cwd = os.getcwd()
125 os.chdir(os.path.join('IPython', 'frontend', 'html', 'notebook'))
126 os.chdir(os.path.join('IPython', 'frontend', 'html', 'notebook'))
126 static_walk = list(os.walk('static'))
127 static_walk = list(os.walk('static'))
127 os.chdir(cwd)
128 os.chdir(cwd)
128 static_data = []
129 static_data = []
129 for parent, dirs, files in static_walk:
130 for parent, dirs, files in static_walk:
130 for f in files:
131 for f in files:
131 static_data.append(os.path.join(parent, f))
132 static_data.append(os.path.join(parent, f))
132
133
133 package_data = {
134 package_data = {
134 'IPython.config.profile' : ['README', '*/*.py'],
135 'IPython.config.profile' : ['README', '*/*.py'],
135 'IPython.testing' : ['*.txt'],
136 'IPython.testing' : ['*.txt'],
136 'IPython.frontend.html.notebook' : ['templates/*']+static_data
137 'IPython.frontend.html.notebook' : ['templates/*']+static_data
137 }
138 }
138 return package_data
139 return package_data
139
140
140
141
141 #---------------------------------------------------------------------------
142 #---------------------------------------------------------------------------
142 # Find data files
143 # Find data files
143 #---------------------------------------------------------------------------
144 #---------------------------------------------------------------------------
144
145
145 def make_dir_struct(tag,base,out_base):
146 def make_dir_struct(tag,base,out_base):
146 """Make the directory structure of all files below a starting dir.
147 """Make the directory structure of all files below a starting dir.
147
148
148 This is just a convenience routine to help build a nested directory
149 This is just a convenience routine to help build a nested directory
149 hierarchy because distutils is too stupid to do this by itself.
150 hierarchy because distutils is too stupid to do this by itself.
150
151
151 XXX - this needs a proper docstring!
152 XXX - this needs a proper docstring!
152 """
153 """
153
154
154 # we'll use these a lot below
155 # we'll use these a lot below
155 lbase = len(base)
156 lbase = len(base)
156 pathsep = os.path.sep
157 pathsep = os.path.sep
157 lpathsep = len(pathsep)
158 lpathsep = len(pathsep)
158
159
159 out = []
160 out = []
160 for (dirpath,dirnames,filenames) in os.walk(base):
161 for (dirpath,dirnames,filenames) in os.walk(base):
161 # we need to strip out the dirpath from the base to map it to the
162 # we need to strip out the dirpath from the base to map it to the
162 # output (installation) path. This requires possibly stripping the
163 # output (installation) path. This requires possibly stripping the
163 # path separator, because otherwise pjoin will not work correctly
164 # path separator, because otherwise pjoin will not work correctly
164 # (pjoin('foo/','/bar') returns '/bar').
165 # (pjoin('foo/','/bar') returns '/bar').
165
166
166 dp_eff = dirpath[lbase:]
167 dp_eff = dirpath[lbase:]
167 if dp_eff.startswith(pathsep):
168 if dp_eff.startswith(pathsep):
168 dp_eff = dp_eff[lpathsep:]
169 dp_eff = dp_eff[lpathsep:]
169 # The output path must be anchored at the out_base marker
170 # The output path must be anchored at the out_base marker
170 out_path = pjoin(out_base,dp_eff)
171 out_path = pjoin(out_base,dp_eff)
171 # Now we can generate the final filenames. Since os.walk only produces
172 # Now we can generate the final filenames. Since os.walk only produces
172 # filenames, we must join back with the dirpath to get full valid file
173 # filenames, we must join back with the dirpath to get full valid file
173 # paths:
174 # paths:
174 pfiles = [pjoin(dirpath,f) for f in filenames]
175 pfiles = [pjoin(dirpath,f) for f in filenames]
175 # Finally, generate the entry we need, which is a pari of (output
176 # Finally, generate the entry we need, which is a pari of (output
176 # path, files) for use as a data_files parameter in install_data.
177 # path, files) for use as a data_files parameter in install_data.
177 out.append((out_path, pfiles))
178 out.append((out_path, pfiles))
178
179
179 return out
180 return out
180
181
181
182
182 def find_data_files():
183 def find_data_files():
183 """
184 """
184 Find IPython's data_files.
185 Find IPython's data_files.
185
186
186 Most of these are docs.
187 Most of these are docs.
187 """
188 """
188
189
189 docdirbase = pjoin('share', 'doc', 'ipython')
190 docdirbase = pjoin('share', 'doc', 'ipython')
190 manpagebase = pjoin('share', 'man', 'man1')
191 manpagebase = pjoin('share', 'man', 'man1')
191
192
192 # Simple file lists can be made by hand
193 # Simple file lists can be made by hand
193 manpages = filter(isfile, glob(pjoin('docs','man','*.1.gz')))
194 manpages = filter(isfile, glob(pjoin('docs','man','*.1.gz')))
194 if not manpages:
195 if not manpages:
195 # When running from a source tree, the manpages aren't gzipped
196 # When running from a source tree, the manpages aren't gzipped
196 manpages = filter(isfile, glob(pjoin('docs','man','*.1')))
197 manpages = filter(isfile, glob(pjoin('docs','man','*.1')))
197 igridhelpfiles = filter(isfile,
198 igridhelpfiles = filter(isfile,
198 glob(pjoin('IPython','extensions','igrid_help.*')))
199 glob(pjoin('IPython','extensions','igrid_help.*')))
199
200
200 # For nested structures, use the utility above
201 # For nested structures, use the utility above
201 example_files = make_dir_struct(
202 example_files = make_dir_struct(
202 'data',
203 'data',
203 pjoin('docs','examples'),
204 pjoin('docs','examples'),
204 pjoin(docdirbase,'examples')
205 pjoin(docdirbase,'examples')
205 )
206 )
206 manual_files = make_dir_struct(
207 manual_files = make_dir_struct(
207 'data',
208 'data',
208 pjoin('docs','html'),
209 pjoin('docs','html'),
209 pjoin(docdirbase,'manual')
210 pjoin(docdirbase,'manual')
210 )
211 )
211
212
212 # And assemble the entire output list
213 # And assemble the entire output list
213 data_files = [ (manpagebase, manpages),
214 data_files = [ (manpagebase, manpages),
214 (pjoin(docdirbase, 'extensions'), igridhelpfiles),
215 (pjoin(docdirbase, 'extensions'), igridhelpfiles),
215 ] + manual_files + example_files
216 ] + manual_files + example_files
216
217
217 return data_files
218 return data_files
218
219
219
220
220 def make_man_update_target(manpage):
221 def make_man_update_target(manpage):
221 """Return a target_update-compliant tuple for the given manpage.
222 """Return a target_update-compliant tuple for the given manpage.
222
223
223 Parameters
224 Parameters
224 ----------
225 ----------
225 manpage : string
226 manpage : string
226 Name of the manpage, must include the section number (trailing number).
227 Name of the manpage, must include the section number (trailing number).
227
228
228 Example
229 Example
229 -------
230 -------
230
231
231 >>> make_man_update_target('ipython.1') #doctest: +NORMALIZE_WHITESPACE
232 >>> make_man_update_target('ipython.1') #doctest: +NORMALIZE_WHITESPACE
232 ('docs/man/ipython.1.gz',
233 ('docs/man/ipython.1.gz',
233 ['docs/man/ipython.1'],
234 ['docs/man/ipython.1'],
234 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz')
235 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz')
235 """
236 """
236 man_dir = pjoin('docs', 'man')
237 man_dir = pjoin('docs', 'man')
237 manpage_gz = manpage + '.gz'
238 manpage_gz = manpage + '.gz'
238 manpath = pjoin(man_dir, manpage)
239 manpath = pjoin(man_dir, manpage)
239 manpath_gz = pjoin(man_dir, manpage_gz)
240 manpath_gz = pjoin(man_dir, manpage_gz)
240 gz_cmd = ( "cd %(man_dir)s && gzip -9c %(manpage)s > %(manpage_gz)s" %
241 gz_cmd = ( "cd %(man_dir)s && gzip -9c %(manpage)s > %(manpage_gz)s" %
241 locals() )
242 locals() )
242 return (manpath_gz, [manpath], gz_cmd)
243 return (manpath_gz, [manpath], gz_cmd)
243
244
244 #---------------------------------------------------------------------------
245 #---------------------------------------------------------------------------
245 # Find scripts
246 # Find scripts
246 #---------------------------------------------------------------------------
247 #---------------------------------------------------------------------------
247
248
248 def find_scripts(entry_points=False, suffix=''):
249 def find_scripts(entry_points=False, suffix=''):
249 """Find IPython's scripts.
250 """Find IPython's scripts.
250
251
251 if entry_points is True:
252 if entry_points is True:
252 return setuptools entry_point-style definitions
253 return setuptools entry_point-style definitions
253 else:
254 else:
254 return file paths of plain scripts [default]
255 return file paths of plain scripts [default]
255
256
256 suffix is appended to script names if entry_points is True, so that the
257 suffix is appended to script names if entry_points is True, so that the
257 Python 3 scripts get named "ipython3" etc.
258 Python 3 scripts get named "ipython3" etc.
258 """
259 """
259 if entry_points:
260 if entry_points:
260 console_scripts = [s % suffix for s in [
261 console_scripts = [s % suffix for s in [
261 'ipython%s = IPython.frontend.terminal.ipapp:launch_new_instance',
262 'ipython%s = IPython.frontend.terminal.ipapp:launch_new_instance',
262 'pycolor%s = IPython.utils.PyColorize:main',
263 'pycolor%s = IPython.utils.PyColorize:main',
263 'ipcontroller%s = IPython.parallel.apps.ipcontrollerapp:launch_new_instance',
264 'ipcontroller%s = IPython.parallel.apps.ipcontrollerapp:launch_new_instance',
264 'ipengine%s = IPython.parallel.apps.ipengineapp:launch_new_instance',
265 'ipengine%s = IPython.parallel.apps.ipengineapp:launch_new_instance',
265 'iplogger%s = IPython.parallel.apps.iploggerapp:launch_new_instance',
266 'iplogger%s = IPython.parallel.apps.iploggerapp:launch_new_instance',
266 'ipcluster%s = IPython.parallel.apps.ipclusterapp:launch_new_instance',
267 'ipcluster%s = IPython.parallel.apps.ipclusterapp:launch_new_instance',
267 'iptest%s = IPython.testing.iptest:main',
268 'iptest%s = IPython.testing.iptest:main',
268 'irunner%s = IPython.lib.irunner:main'
269 'irunner%s = IPython.lib.irunner:main'
269 ]]
270 ]]
270 gui_scripts = [s % suffix for s in [
271 gui_scripts = [s % suffix for s in [
271 'ipython%s-qtconsole = IPython.frontend.qt.console.qtconsoleapp:main',
272 'ipython%s-qtconsole = IPython.frontend.qt.console.qtconsoleapp:main',
272 ]]
273 ]]
273 scripts = dict(console_scripts=console_scripts, gui_scripts=gui_scripts)
274 scripts = dict(console_scripts=console_scripts, gui_scripts=gui_scripts)
274 else:
275 else:
275 parallel_scripts = pjoin('IPython','parallel','scripts')
276 parallel_scripts = pjoin('IPython','parallel','scripts')
276 main_scripts = pjoin('IPython','scripts')
277 main_scripts = pjoin('IPython','scripts')
277 scripts = [
278 scripts = [
278 pjoin(parallel_scripts, 'ipengine'),
279 pjoin(parallel_scripts, 'ipengine'),
279 pjoin(parallel_scripts, 'ipcontroller'),
280 pjoin(parallel_scripts, 'ipcontroller'),
280 pjoin(parallel_scripts, 'ipcluster'),
281 pjoin(parallel_scripts, 'ipcluster'),
281 pjoin(parallel_scripts, 'iplogger'),
282 pjoin(parallel_scripts, 'iplogger'),
282 pjoin(main_scripts, 'ipython'),
283 pjoin(main_scripts, 'ipython'),
283 pjoin(main_scripts, 'pycolor'),
284 pjoin(main_scripts, 'pycolor'),
284 pjoin(main_scripts, 'irunner'),
285 pjoin(main_scripts, 'irunner'),
285 pjoin(main_scripts, 'iptest')
286 pjoin(main_scripts, 'iptest')
286 ]
287 ]
287 return scripts
288 return scripts
288
289
289 #---------------------------------------------------------------------------
290 #---------------------------------------------------------------------------
290 # Verify all dependencies
291 # Verify all dependencies
291 #---------------------------------------------------------------------------
292 #---------------------------------------------------------------------------
292
293
293 def check_for_dependencies():
294 def check_for_dependencies():
294 """Check for IPython's dependencies.
295 """Check for IPython's dependencies.
295
296
296 This function should NOT be called if running under setuptools!
297 This function should NOT be called if running under setuptools!
297 """
298 """
298 from setupext.setupext import (
299 from setupext.setupext import (
299 print_line, print_raw, print_status,
300 print_line, print_raw, print_status,
300 check_for_sphinx, check_for_pygments,
301 check_for_sphinx, check_for_pygments,
301 check_for_nose, check_for_pexpect,
302 check_for_nose, check_for_pexpect,
302 check_for_pyzmq, check_for_readline
303 check_for_pyzmq, check_for_readline
303 )
304 )
304 print_line()
305 print_line()
305 print_raw("BUILDING IPYTHON")
306 print_raw("BUILDING IPYTHON")
306 print_status('python', sys.version)
307 print_status('python', sys.version)
307 print_status('platform', sys.platform)
308 print_status('platform', sys.platform)
308 if sys.platform == 'win32':
309 if sys.platform == 'win32':
309 print_status('Windows version', sys.getwindowsversion())
310 print_status('Windows version', sys.getwindowsversion())
310
311
311 print_raw("")
312 print_raw("")
312 print_raw("OPTIONAL DEPENDENCIES")
313 print_raw("OPTIONAL DEPENDENCIES")
313
314
314 check_for_sphinx()
315 check_for_sphinx()
315 check_for_pygments()
316 check_for_pygments()
316 check_for_nose()
317 check_for_nose()
317 check_for_pexpect()
318 check_for_pexpect()
318 check_for_pyzmq()
319 check_for_pyzmq()
319 check_for_readline()
320 check_for_readline()
320
321
321 def record_commit_info(pkg_dir, build_cmd=build_py):
322 def record_commit_info(pkg_dir, build_cmd=build_py):
322 """ Return extended build command class for recording commit
323 """ Return extended build command class for recording commit
323
324
324 The extended command tries to run git to find the current commit, getting
325 The extended command tries to run git to find the current commit, getting
325 the empty string if it fails. It then writes the commit hash into a file
326 the empty string if it fails. It then writes the commit hash into a file
326 in the `pkg_dir` path, named ``.git_commit_info.ini``.
327 in the `pkg_dir` path, named ``.git_commit_info.ini``.
327
328
328 In due course this information can be used by the package after it is
329 In due course this information can be used by the package after it is
329 installed, to tell you what commit it was installed from if known.
330 installed, to tell you what commit it was installed from if known.
330
331
331 To make use of this system, you need a package with a .git_commit_info.ini
332 To make use of this system, you need a package with a .git_commit_info.ini
332 file - e.g. ``myproject/.git_commit_info.ini`` - that might well look like
333 file - e.g. ``myproject/.git_commit_info.ini`` - that might well look like
333 this::
334 this::
334
335
335 # This is an ini file that may contain information about the code state
336 # This is an ini file that may contain information about the code state
336 [commit hash]
337 [commit hash]
337 # The line below may contain a valid hash if it has been substituted
338 # The line below may contain a valid hash if it has been substituted
338 # during 'git archive'
339 # during 'git archive'
339 archive_subst_hash=$Format:%h$
340 archive_subst_hash=$Format:%h$
340 # This line may be modified by the install process
341 # This line may be modified by the install process
341 install_hash=
342 install_hash=
342
343
343 The .git_commit_info file above is also designed to be used with git
344 The .git_commit_info file above is also designed to be used with git
344 substitution - so you probably also want a ``.gitattributes`` file in the
345 substitution - so you probably also want a ``.gitattributes`` file in the
345 root directory of your working tree that contains something like this::
346 root directory of your working tree that contains something like this::
346
347
347 myproject/.git_commit_info.ini export-subst
348 myproject/.git_commit_info.ini export-subst
348
349
349 That will cause the ``.git_commit_info.ini`` file to get filled in by ``git
350 That will cause the ``.git_commit_info.ini`` file to get filled in by ``git
350 archive`` - useful in case someone makes such an archive - for example with
351 archive`` - useful in case someone makes such an archive - for example with
351 via the github 'download source' button.
352 via the github 'download source' button.
352
353
353 Although all the above will work as is, you might consider having something
354 Although all the above will work as is, you might consider having something
354 like a ``get_info()`` function in your package to display the commit
355 like a ``get_info()`` function in your package to display the commit
355 information at the terminal. See the ``pkg_info.py`` module in the nipy
356 information at the terminal. See the ``pkg_info.py`` module in the nipy
356 package for an example.
357 package for an example.
357 """
358 """
358 class MyBuildPy(build_cmd):
359 class MyBuildPy(build_cmd):
359 ''' Subclass to write commit data into installation tree '''
360 ''' Subclass to write commit data into installation tree '''
360 def run(self):
361 def run(self):
361 build_py.run(self)
362 build_py.run(self)
362 import subprocess
363 import subprocess
363 proc = subprocess.Popen('git rev-parse --short HEAD',
364 proc = subprocess.Popen('git rev-parse --short HEAD',
364 stdout=subprocess.PIPE,
365 stdout=subprocess.PIPE,
365 stderr=subprocess.PIPE,
366 stderr=subprocess.PIPE,
366 shell=True)
367 shell=True)
367 repo_commit, _ = proc.communicate()
368 repo_commit, _ = proc.communicate()
368 # We write the installation commit even if it's empty
369 # We write the installation commit even if it's empty
369 cfg_parser = ConfigParser()
370 cfg_parser = ConfigParser()
370 cfg_parser.read(pjoin(pkg_dir, '.git_commit_info.ini'))
371 cfg_parser.read(pjoin(pkg_dir, '.git_commit_info.ini'))
371 cfg_parser.set('commit hash', 'install_hash', repo_commit)
372 cfg_parser.set('commit hash', 'install_hash', repo_commit)
372 out_pth = pjoin(self.build_lib, pkg_dir, '.git_commit_info.ini')
373 out_pth = pjoin(self.build_lib, pkg_dir, '.git_commit_info.ini')
373 out_file = open(out_pth, 'wt')
374 out_file = open(out_pth, 'wt')
374 cfg_parser.write(out_file)
375 cfg_parser.write(out_file)
375 out_file.close()
376 out_file.close()
376 return MyBuildPy
377 return MyBuildPy
General Comments 0
You need to be logged in to leave comments. Login now