##// END OF EJS Templates
Update setup and support tools to include new man pages.
Fernando Perez -
Show More
@@ -1,189 +1,213 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 The IPython Development Team
11 #
11 #
12 # Distributed under the terms of the BSD License. The full license is in
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
13 # the file COPYING, distributed as part of this software.
14 #-------------------------------------------------------------------------------
14 #-------------------------------------------------------------------------------
15
15
16 #-------------------------------------------------------------------------------
16 #-------------------------------------------------------------------------------
17 # Imports
17 # Imports
18 #-------------------------------------------------------------------------------
18 #-------------------------------------------------------------------------------
19
19
20 # Stdlib imports
20 # Stdlib imports
21 import os
21 import os
22 import sys
22 import sys
23
23
24 from glob import glob
24 from glob import glob
25
25
26 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
26 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
27 # update it when the contents of directories change.
27 # update it when the contents of directories change.
28 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
28 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
29
29
30 from distutils.core import setup
30 from distutils.core import setup
31
31
32 # Local imports
32 # Local imports
33 from IPython.genutils import target_update
33 from IPython.genutils import target_update
34
34
35 from setupbase import (
35 from setupbase import (
36 setup_args,
36 setup_args,
37 find_packages,
37 find_packages,
38 find_package_data,
38 find_package_data,
39 find_scripts,
39 find_scripts,
40 find_data_files,
40 find_data_files,
41 check_for_dependencies
41 check_for_dependencies
42 )
42 )
43
43
44 isfile = os.path.isfile
44 isfile = os.path.isfile
45
45
46 #-------------------------------------------------------------------------------
46 #-------------------------------------------------------------------------------
47 # Handle OS specific things
47 # Handle OS specific things
48 #-------------------------------------------------------------------------------
48 #-------------------------------------------------------------------------------
49
49
50 if os.name == 'posix':
50 if os.name == 'posix':
51 os_name = 'posix'
51 os_name = 'posix'
52 elif os.name in ['nt','dos']:
52 elif os.name in ['nt','dos']:
53 os_name = 'windows'
53 os_name = 'windows'
54 else:
54 else:
55 print 'Unsupported operating system:',os.name
55 print 'Unsupported operating system:',os.name
56 sys.exit(1)
56 sys.exit(1)
57
57
58 # Under Windows, 'sdist' has not been supported. Now that the docs build with
58 # Under Windows, 'sdist' has not been supported. Now that the docs build with
59 # Sphinx it might work, but let's not turn it on until someone confirms that it
59 # Sphinx it might work, but let's not turn it on until someone confirms that it
60 # actually works.
60 # actually works.
61 if os_name == 'windows' and 'sdist' in sys.argv:
61 if os_name == 'windows' and 'sdist' in sys.argv:
62 print 'The sdist command is not available under Windows. Exiting.'
62 print 'The sdist command is not available under Windows. Exiting.'
63 sys.exit(1)
63 sys.exit(1)
64
64
65 #-------------------------------------------------------------------------------
65 #-------------------------------------------------------------------------------
66 # Things related to the IPython documentation
66 # Things related to the IPython documentation
67 #-------------------------------------------------------------------------------
67 #-------------------------------------------------------------------------------
68
68
69 # update the manuals when building a source dist
69 # update the manuals when building a source dist
70 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
70 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
71 import textwrap
71 import textwrap
72
72
73 # List of things to be updated. Each entry is a triplet of args for
73 # List of things to be updated. Each entry is a triplet of args for
74 # target_update()
74 # target_update()
75 to_update = [
75 to_update = [
76 # FIXME - Disabled for now: we need to redo an automatic way
76 # FIXME - Disabled for now: we need to redo an automatic way
77 # of generating the magic info inside the rst.
77 # of generating the magic info inside the rst.
78 #('docs/magic.tex',
78 #('docs/magic.tex',
79 #['IPython/Magic.py'],
79 #['IPython/Magic.py'],
80 #"cd doc && ./update_magic.sh" ),
80 #"cd doc && ./update_magic.sh" ),
81
81
82 ('docs/man/ipcluster.1.gz',
83 ['docs/man/ipcluster.1'],
84 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
85
86 ('docs/man/ipcontroller.1.gz',
87 ['docs/man/ipcontroller.1'],
88 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
89
90 ('docs/man/ipengine.1.gz',
91 ['docs/man/ipengine.1'],
92 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
93
82 ('docs/man/ipython.1.gz',
94 ('docs/man/ipython.1.gz',
83 ['docs/man/ipython.1'],
95 ['docs/man/ipython.1'],
84 "cd docs/man && gzip -9c ipython.1 > ipython.1.gz"),
96 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
97
98 ('docs/man/ipython-wx.1.gz',
99 ['docs/man/ipython-wx.1'],
100 'cd docs/man && gzip -9c ipython-wx.1 > ipython-wx.1.gz'),
101
102 ('docs/man/ipythonx.1.gz',
103 ['docs/man/ipythonx.1'],
104 'cd docs/man && gzip -9c ipythonx.1 > ipythonx.1.gz'),
105
106 ('docs/man/irunner.1.gz',
107 ['docs/man/irunner.1'],
108 'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'),
85
109
86 ('docs/man/pycolor.1.gz',
110 ('docs/man/pycolor.1.gz',
87 ['docs/man/pycolor.1'],
111 ['docs/man/pycolor.1'],
88 "cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz"),
112 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'),
89 ]
113 ]
90
114
91 # Only build the docs if sphinx is present
115 # Only build the docs if sphinx is present
92 try:
116 try:
93 import sphinx
117 import sphinx
94 except ImportError:
118 except ImportError:
95 pass
119 pass
96 else:
120 else:
97 # The Makefile calls the do_sphinx scripts to build html and pdf, so
121 # The Makefile calls the do_sphinx scripts to build html and pdf, so
98 # just one target is enough to cover all manual generation
122 # just one target is enough to cover all manual generation
99
123
100 # First, compute all the dependencies that can force us to rebuild the
124 # First, compute all the dependencies that can force us to rebuild the
101 # docs. Start with the main release file that contains metadata
125 # docs. Start with the main release file that contains metadata
102 docdeps = ['IPython/Release.py']
126 docdeps = ['IPython/Release.py']
103 # Inculde all the reST sources
127 # Inculde all the reST sources
104 pjoin = os.path.join
128 pjoin = os.path.join
105 for dirpath,dirnames,filenames in os.walk('docs/source'):
129 for dirpath,dirnames,filenames in os.walk('docs/source'):
106 if dirpath in ['_static','_templates']:
130 if dirpath in ['_static','_templates']:
107 continue
131 continue
108 docdeps += [ pjoin(dirpath,f) for f in filenames
132 docdeps += [ pjoin(dirpath,f) for f in filenames
109 if f.endswith('.txt') ]
133 if f.endswith('.txt') ]
110 # and the examples
134 # and the examples
111 for dirpath,dirnames,filenames in os.walk('docs/example'):
135 for dirpath,dirnames,filenames in os.walk('docs/example'):
112 docdeps += [ pjoin(dirpath,f) for f in filenames
136 docdeps += [ pjoin(dirpath,f) for f in filenames
113 if not f.endswith('~') ]
137 if not f.endswith('~') ]
114 # then, make them all dependencies for the main PDF (the html will get
138 # then, make them all dependencies for the main PDF (the html will get
115 # auto-generated as well).
139 # auto-generated as well).
116 to_update.append(
140 to_update.append(
117 ('docs/dist/ipython.pdf',
141 ('docs/dist/ipython.pdf',
118 docdeps,
142 docdeps,
119 "cd docs && make dist")
143 "cd docs && make dist")
120 )
144 )
121
145
122 [ target_update(*t) for t in to_update ]
146 [ target_update(*t) for t in to_update ]
123
147
124
148
125 #---------------------------------------------------------------------------
149 #---------------------------------------------------------------------------
126 # Find all the packages, package data, scripts and data_files
150 # Find all the packages, package data, scripts and data_files
127 #---------------------------------------------------------------------------
151 #---------------------------------------------------------------------------
128
152
129 packages = find_packages()
153 packages = find_packages()
130 package_data = find_package_data()
154 package_data = find_package_data()
131 scripts = find_scripts()
155 scripts = find_scripts()
132 data_files = find_data_files()
156 data_files = find_data_files()
133
157
134 #---------------------------------------------------------------------------
158 #---------------------------------------------------------------------------
135 # Handle dependencies and setuptools specific things
159 # Handle dependencies and setuptools specific things
136 #---------------------------------------------------------------------------
160 #---------------------------------------------------------------------------
137
161
138 # This dict is used for passing extra arguments that are setuptools
162 # This dict is used for passing extra arguments that are setuptools
139 # specific to setup
163 # specific to setup
140 setuptools_extra_args = {}
164 setuptools_extra_args = {}
141
165
142 if 'setuptools' in sys.modules:
166 if 'setuptools' in sys.modules:
143 setuptools_extra_args['zip_safe'] = False
167 setuptools_extra_args['zip_safe'] = False
144 setuptools_extra_args['entry_points'] = {
168 setuptools_extra_args['entry_points'] = {
145 'console_scripts': [
169 'console_scripts': [
146 'ipython = IPython.ipapi:launch_new_instance',
170 'ipython = IPython.ipapi:launch_new_instance',
147 'pycolor = IPython.PyColorize:main',
171 'pycolor = IPython.PyColorize:main',
148 'ipcontroller = IPython.kernel.scripts.ipcontroller:main',
172 'ipcontroller = IPython.kernel.scripts.ipcontroller:main',
149 'ipengine = IPython.kernel.scripts.ipengine:main',
173 'ipengine = IPython.kernel.scripts.ipengine:main',
150 'ipcluster = IPython.kernel.scripts.ipcluster:main',
174 'ipcluster = IPython.kernel.scripts.ipcluster:main',
151 'ipythonx = IPython.frontend.wx.ipythonx:main',
175 'ipythonx = IPython.frontend.wx.ipythonx:main',
152 'iptest = IPython.testing.iptest:main',
176 'iptest = IPython.testing.iptest:main',
153 ]
177 ]
154 }
178 }
155 setup_args['extras_require'] = dict(
179 setup_args['extras_require'] = dict(
156 kernel = [
180 kernel = [
157 'zope.interface>=3.4.1',
181 'zope.interface>=3.4.1',
158 'Twisted>=8.0.1',
182 'Twisted>=8.0.1',
159 'foolscap>=0.2.6'
183 'foolscap>=0.2.6'
160 ],
184 ],
161 doc='Sphinx>=0.3',
185 doc='Sphinx>=0.3',
162 test='nose>=0.10.1',
186 test='nose>=0.10.1',
163 security='pyOpenSSL>=0.6'
187 security='pyOpenSSL>=0.6'
164 )
188 )
165 # Allow setuptools to handle the scripts
189 # Allow setuptools to handle the scripts
166 scripts = []
190 scripts = []
167 else:
191 else:
168 # package_data of setuptools was introduced to distutils in 2.4
192 # package_data of setuptools was introduced to distutils in 2.4
169 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
193 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
170 if sys.version_info < (2,4):
194 if sys.version_info < (2,4):
171 data_files.append(('lib', 'IPython/UserConfig', cfgfiles))
195 data_files.append(('lib', 'IPython/UserConfig', cfgfiles))
172 # If we are running without setuptools, call this function which will
196 # If we are running without setuptools, call this function which will
173 # check for dependencies an inform the user what is needed. This is
197 # check for dependencies an inform the user what is needed. This is
174 # just to make life easy for users.
198 # just to make life easy for users.
175 check_for_dependencies()
199 check_for_dependencies()
176
200
177
201
178 #---------------------------------------------------------------------------
202 #---------------------------------------------------------------------------
179 # Do the actual setup now
203 # Do the actual setup now
180 #---------------------------------------------------------------------------
204 #---------------------------------------------------------------------------
181
205
182 setup_args['packages'] = packages
206 setup_args['packages'] = packages
183 setup_args['package_data'] = package_data
207 setup_args['package_data'] = package_data
184 setup_args['scripts'] = scripts
208 setup_args['scripts'] = scripts
185 setup_args['data_files'] = data_files
209 setup_args['data_files'] = data_files
186 setup_args.update(setuptools_extra_args)
210 setup_args.update(setuptools_extra_args)
187
211
188 if __name__ == '__main__':
212 if __name__ == '__main__':
189 setup(**setup_args)
213 setup(**setup_args)
@@ -1,279 +1,304 b''
1 # encoding: utf-8
1 # encoding: utf-8
2
2
3 """
3 """
4 This module defines the things that are used in setup.py for building IPython
4 This module defines the things that are used in setup.py for building IPython
5
5
6 This includes:
6 This includes:
7
7
8 * The basic arguments to setup
8 * The basic arguments to setup
9 * Functions for finding things like packages, package data, etc.
9 * Functions for finding things like packages, package data, etc.
10 * A function for checking dependencies.
10 * A function for checking dependencies.
11 """
11 """
12
12
13 __docformat__ = "restructuredtext en"
13 __docformat__ = "restructuredtext en"
14
14
15 #-------------------------------------------------------------------------------
15 #-------------------------------------------------------------------------------
16 # Copyright (C) 2008 The IPython Development Team
16 # Copyright (C) 2008 The IPython Development Team
17 #
17 #
18 # Distributed under the terms of the BSD License. The full license is in
18 # Distributed under the terms of the BSD License. The full license is in
19 # the file COPYING, distributed as part of this software.
19 # the file COPYING, distributed as part of this software.
20 #-------------------------------------------------------------------------------
20 #-------------------------------------------------------------------------------
21
21
22 #-------------------------------------------------------------------------------
22 #-------------------------------------------------------------------------------
23 # Imports
23 # Imports
24 #-------------------------------------------------------------------------------
24 #-------------------------------------------------------------------------------
25
25
26 import os, sys
26 import os, sys
27
27
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','Release.py'))
61 execfile(pjoin('IPython','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)
106 add_package(packages, 'config', tests=True)
107 add_package(packages , 'Extensions')
107 add_package(packages , 'Extensions')
108 add_package(packages, 'external')
108 add_package(packages, 'external')
109 add_package(packages, 'gui')
109 add_package(packages, 'gui')
110 add_package(packages, 'gui.wx')
110 add_package(packages, 'gui.wx')
111 add_package(packages, 'frontend', tests=True)
111 add_package(packages, 'frontend', tests=True)
112 add_package(packages, 'frontend.process')
112 add_package(packages, 'frontend.process')
113 add_package(packages, 'frontend.wx')
113 add_package(packages, 'frontend.wx')
114 add_package(packages, 'frontend.cocoa', tests=True)
114 add_package(packages, 'frontend.cocoa', tests=True)
115 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
115 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
116 add_package(packages, 'kernel.core', config=True, tests=True)
116 add_package(packages, 'kernel.core', config=True, tests=True)
117 add_package(packages, 'testing', tests=True)
117 add_package(packages, 'testing', tests=True)
118 add_package(packages, 'tests')
118 add_package(packages, 'tests')
119 add_package(packages, 'testing.plugin', tests=False)
119 add_package(packages, 'testing.plugin', tests=False)
120 add_package(packages, 'tools', tests=True)
120 add_package(packages, 'tools', tests=True)
121 add_package(packages, 'UserConfig')
121 add_package(packages, 'UserConfig')
122 return packages
122 return packages
123
123
124 #---------------------------------------------------------------------------
124 #---------------------------------------------------------------------------
125 # Find package data
125 # Find package data
126 #---------------------------------------------------------------------------
126 #---------------------------------------------------------------------------
127
127
128 def find_package_data():
128 def find_package_data():
129 """
129 """
130 Find IPython's package_data.
130 Find IPython's package_data.
131 """
131 """
132 # This is not enough for these things to appear in an sdist.
132 # This is not enough for these things to appear in an sdist.
133 # We need to muck with the MANIFEST to get this to work
133 # We need to muck with the MANIFEST to get this to work
134 package_data = {
134 package_data = {
135 'IPython.UserConfig' : ['*'],
135 'IPython.UserConfig' : ['*'],
136 'IPython.tools.tests' : ['*.txt'],
136 'IPython.tools.tests' : ['*.txt'],
137 'IPython.testing' : ['*.txt']
137 'IPython.testing' : ['*.txt']
138 }
138 }
139 return package_data
139 return package_data
140
140
141
141
142 #---------------------------------------------------------------------------
142 #---------------------------------------------------------------------------
143 # Find data files
143 # Find data files
144 #---------------------------------------------------------------------------
144 #---------------------------------------------------------------------------
145
145
146 def make_dir_struct(tag,base,out_base):
146 def make_dir_struct(tag,base,out_base):
147 """Make the directory structure of all files below a starting dir.
147 """Make the directory structure of all files below a starting dir.
148
148
149 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
150 hierarchy because distutils is too stupid to do this by itself.
150 hierarchy because distutils is too stupid to do this by itself.
151
151
152 XXX - this needs a proper docstring!
152 XXX - this needs a proper docstring!
153 """
153 """
154
154
155 # we'll use these a lot below
155 # we'll use these a lot below
156 lbase = len(base)
156 lbase = len(base)
157 pathsep = os.path.sep
157 pathsep = os.path.sep
158 lpathsep = len(pathsep)
158 lpathsep = len(pathsep)
159
159
160 out = []
160 out = []
161 for (dirpath,dirnames,filenames) in os.walk(base):
161 for (dirpath,dirnames,filenames) in os.walk(base):
162 # 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
163 # output (installation) path. This requires possibly stripping the
163 # output (installation) path. This requires possibly stripping the
164 # path separator, because otherwise pjoin will not work correctly
164 # path separator, because otherwise pjoin will not work correctly
165 # (pjoin('foo/','/bar') returns '/bar').
165 # (pjoin('foo/','/bar') returns '/bar').
166
166
167 dp_eff = dirpath[lbase:]
167 dp_eff = dirpath[lbase:]
168 if dp_eff.startswith(pathsep):
168 if dp_eff.startswith(pathsep):
169 dp_eff = dp_eff[lpathsep:]
169 dp_eff = dp_eff[lpathsep:]
170 # The output path must be anchored at the out_base marker
170 # The output path must be anchored at the out_base marker
171 out_path = pjoin(out_base,dp_eff)
171 out_path = pjoin(out_base,dp_eff)
172 # 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
173 # 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
174 # paths:
174 # paths:
175 pfiles = [pjoin(dirpath,f) for f in filenames]
175 pfiles = [pjoin(dirpath,f) for f in filenames]
176 # Finally, generate the entry we need, which is a triple of (tag,output
176 # Finally, generate the entry we need, which is a triple of (tag,output
177 # 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.
178 out.append((tag,out_path,pfiles))
178 out.append((tag,out_path,pfiles))
179
179
180 return out
180 return out
181
181
182
182
183 def find_data_files():
183 def find_data_files():
184 """
184 """
185 Find IPython's data_files.
185 Find IPython's data_files.
186
186
187 Most of these are docs.
187 Most of these are docs.
188 """
188 """
189
189
190 docdirbase = 'share/doc/ipython'
190 docdirbase = 'share/doc/ipython'
191 manpagebase = 'share/man/man1'
191 manpagebase = 'share/man/man1'
192
192
193 # Simple file lists can be made by hand
193 # Simple file lists can be made by hand
194 manpages = filter(isfile, glob('docs/man/*.1.gz'))
194 manpages = filter(isfile, glob('docs/man/*.1.gz'))
195 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
195 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
196
196
197 # For nested structures, use the utility above
197 # For nested structures, use the utility above
198 example_files = make_dir_struct('data','docs/examples',
198 example_files = make_dir_struct('data','docs/examples',
199 pjoin(docdirbase,'examples'))
199 pjoin(docdirbase,'examples'))
200 manual_files = make_dir_struct('data','docs/dist',pjoin(docdirbase,'manual'))
200 manual_files = make_dir_struct('data','docs/dist',pjoin(docdirbase,'manual'))
201
201
202 # And assemble the entire output list
202 # And assemble the entire output list
203 data_files = [ ('data',manpagebase, manpages),
203 data_files = [ ('data',manpagebase, manpages),
204 ('data',pjoin(docdirbase,'extensions'),igridhelpfiles),
204 ('data',pjoin(docdirbase,'extensions'),igridhelpfiles),
205 ] + manual_files + example_files
205 ] + manual_files + example_files
206
206
207 ## import pprint # dbg
207 ## import pprint # dbg
208 ## print '*'*80
208 ## print '*'*80
209 ## print 'data files'
209 ## print 'data files'
210 ## pprint.pprint(data_files)
210 ## pprint.pprint(data_files)
211 ## print '*'*80
211 ## print '*'*80
212
212
213 return data_files
213 return data_files
214
214
215
216 def make_man_update_target(manpage):
217 """Return a target_update-compliant tuple for the given manpage.
218
219 Parameters
220 ----------
221 manpage : string
222 Name of the manpage, must include the section number (trailing number).
223
224 Example
225 -------
226
227 >>> make_man_update_target('ipython.1') #doctest: +NORMALIZE_WHITESPACE
228 ('docs/man/ipython.1.gz',
229 ['docs/man/ipython.1'],
230 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz')
231 """
232 man_dir = pjoin('docs', 'man')
233 manpage_gz = manpage + '.gz'
234 manpath = pjoin(man_dir, manpage)
235 manpath_gz = pjoin(man_dir, manpage_gz)
236 gz_cmd = ( "cd %(man_dir)s && gzip -9c %(manpage)s > %(manpage_gz)s" %
237 locals() )
238 return (manpath_gz, [manpath], gz_cmd)
239
215 #---------------------------------------------------------------------------
240 #---------------------------------------------------------------------------
216 # Find scripts
241 # Find scripts
217 #---------------------------------------------------------------------------
242 #---------------------------------------------------------------------------
218
243
219 def find_scripts():
244 def find_scripts():
220 """
245 """
221 Find IPython's scripts.
246 Find IPython's scripts.
222 """
247 """
223 scripts = ['IPython/kernel/scripts/ipengine',
248 scripts = ['IPython/kernel/scripts/ipengine',
224 'IPython/kernel/scripts/ipcontroller',
249 'IPython/kernel/scripts/ipcontroller',
225 'IPython/kernel/scripts/ipcluster',
250 'IPython/kernel/scripts/ipcluster',
226 'scripts/ipython',
251 'scripts/ipython',
227 'scripts/ipythonx',
252 'scripts/ipythonx',
228 'scripts/ipython-wx',
253 'scripts/ipython-wx',
229 'scripts/pycolor',
254 'scripts/pycolor',
230 'scripts/irunner',
255 'scripts/irunner',
231 'scripts/iptest',
256 'scripts/iptest',
232 ]
257 ]
233
258
234 # Script to be run by the windows binary installer after the default setup
259 # Script to be run by the windows binary installer after the default setup
235 # routine, to add shortcuts and similar windows-only things. Windows
260 # routine, to add shortcuts and similar windows-only things. Windows
236 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
261 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
237 # doesn't find them.
262 # doesn't find them.
238 if 'bdist_wininst' in sys.argv:
263 if 'bdist_wininst' in sys.argv:
239 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
264 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
240 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
265 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
241 sys.exit(1)
266 sys.exit(1)
242 scripts.append('scripts/ipython_win_post_install.py')
267 scripts.append('scripts/ipython_win_post_install.py')
243
268
244 return scripts
269 return scripts
245
270
246 #---------------------------------------------------------------------------
271 #---------------------------------------------------------------------------
247 # Verify all dependencies
272 # Verify all dependencies
248 #---------------------------------------------------------------------------
273 #---------------------------------------------------------------------------
249
274
250 def check_for_dependencies():
275 def check_for_dependencies():
251 """Check for IPython's dependencies.
276 """Check for IPython's dependencies.
252
277
253 This function should NOT be called if running under setuptools!
278 This function should NOT be called if running under setuptools!
254 """
279 """
255 from setupext.setupext import (
280 from setupext.setupext import (
256 print_line, print_raw, print_status, print_message,
281 print_line, print_raw, print_status, print_message,
257 check_for_zopeinterface, check_for_twisted,
282 check_for_zopeinterface, check_for_twisted,
258 check_for_foolscap, check_for_pyopenssl,
283 check_for_foolscap, check_for_pyopenssl,
259 check_for_sphinx, check_for_pygments,
284 check_for_sphinx, check_for_pygments,
260 check_for_nose, check_for_pexpect
285 check_for_nose, check_for_pexpect
261 )
286 )
262 print_line()
287 print_line()
263 print_raw("BUILDING IPYTHON")
288 print_raw("BUILDING IPYTHON")
264 print_status('python', sys.version)
289 print_status('python', sys.version)
265 print_status('platform', sys.platform)
290 print_status('platform', sys.platform)
266 if sys.platform == 'win32':
291 if sys.platform == 'win32':
267 print_status('Windows version', sys.getwindowsversion())
292 print_status('Windows version', sys.getwindowsversion())
268
293
269 print_raw("")
294 print_raw("")
270 print_raw("OPTIONAL DEPENDENCIES")
295 print_raw("OPTIONAL DEPENDENCIES")
271
296
272 check_for_zopeinterface()
297 check_for_zopeinterface()
273 check_for_twisted()
298 check_for_twisted()
274 check_for_foolscap()
299 check_for_foolscap()
275 check_for_pyopenssl()
300 check_for_pyopenssl()
276 check_for_sphinx()
301 check_for_sphinx()
277 check_for_pygments()
302 check_for_pygments()
278 check_for_nose()
303 check_for_nose()
279 check_for_pexpect()
304 check_for_pexpect()
General Comments 0
You need to be logged in to leave comments. Login now