Show More
@@ -1,201 +1,230 b'' | |||||
1 | # encoding: utf-8 |
|
1 | # encoding: utf-8 | |
2 |
|
2 | |||
|
3 | """ | |||
|
4 | This module defines the things that are used in setup.py for building IPython | |||
|
5 | ||||
|
6 | This includes: | |||
|
7 | ||||
|
8 | * The basic arguments to setup | |||
|
9 | * Functions for finding things like packages, package data, etc. | |||
|
10 | * A function for checking dependencies. | |||
|
11 | """ | |||
|
12 | ||||
3 | __docformat__ = "restructuredtext en" |
|
13 | __docformat__ = "restructuredtext en" | |
4 |
|
14 | |||
5 | #------------------------------------------------------------------------------- |
|
15 | #------------------------------------------------------------------------------- | |
6 | # Copyright (C) 2008 The IPython Development Team |
|
16 | # Copyright (C) 2008 The IPython Development Team | |
7 | # |
|
17 | # | |
8 | # 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 | |
9 | # the file COPYING, distributed as part of this software. |
|
19 | # the file COPYING, distributed as part of this software. | |
10 | #------------------------------------------------------------------------------- |
|
20 | #------------------------------------------------------------------------------- | |
11 |
|
21 | |||
12 | #------------------------------------------------------------------------------- |
|
22 | #------------------------------------------------------------------------------- | |
13 | # Imports |
|
23 | # Imports | |
14 | #------------------------------------------------------------------------------- |
|
24 | #------------------------------------------------------------------------------- | |
15 |
|
25 | |||
16 | import os, sys |
|
26 | import os, sys | |
17 |
|
27 | |||
18 | from glob import glob |
|
28 | from glob import glob | |
19 |
|
29 | |||
20 | from setupext import install_data_ext |
|
30 | from setupext import install_data_ext | |
21 |
|
31 | |||
22 | #------------------------------------------------------------------------------- |
|
32 | #------------------------------------------------------------------------------- | |
23 | # Useful globals and utility functions |
|
33 | # Useful globals and utility functions | |
24 | #------------------------------------------------------------------------------- |
|
34 | #------------------------------------------------------------------------------- | |
25 |
|
35 | |||
26 | # A few handy globals |
|
36 | # A few handy globals | |
27 | isfile = os.path.isfile |
|
37 | isfile = os.path.isfile | |
28 | pjoin = os.path.join |
|
38 | pjoin = os.path.join | |
29 |
|
39 | |||
30 | def oscmd(s): |
|
40 | def oscmd(s): | |
31 | print ">", s |
|
41 | print ">", s | |
32 | os.system(s) |
|
42 | os.system(s) | |
33 |
|
43 | |||
34 | # 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 | |
35 | # exclusion on multiple endings! |
|
45 | # exclusion on multiple endings! | |
36 | def file_doesnt_endwith(test,endings): |
|
46 | def file_doesnt_endwith(test,endings): | |
37 | """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 | |
38 | of the strings listed in endings.""" |
|
48 | of the strings listed in endings.""" | |
39 | if not isfile(test): |
|
49 | if not isfile(test): | |
40 | return False |
|
50 | return False | |
41 | for e in endings: |
|
51 | for e in endings: | |
42 | if test.endswith(e): |
|
52 | if test.endswith(e): | |
43 | return False |
|
53 | return False | |
44 | return True |
|
54 | return True | |
45 |
|
55 | |||
46 | #--------------------------------------------------------------------------- |
|
56 | #--------------------------------------------------------------------------- | |
47 | # Basic project information |
|
57 | # Basic project information | |
48 | #--------------------------------------------------------------------------- |
|
58 | #--------------------------------------------------------------------------- | |
49 |
|
59 | |||
50 | # Release.py contains version, authors, license, url, keywords, etc. |
|
60 | # Release.py contains version, authors, license, url, keywords, etc. | |
51 | execfile(pjoin('IPython','Release.py')) |
|
61 | execfile(pjoin('IPython','Release.py')) | |
52 |
|
62 | |||
53 | # Create a dict with the basic information |
|
63 | # Create a dict with the basic information | |
54 | # 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. | |
55 | setup_args = dict( |
|
65 | setup_args = dict( | |
56 | name = name, |
|
66 | name = name, | |
57 | version = version, |
|
67 | version = version, | |
58 | description = description, |
|
68 | description = description, | |
59 | long_description = long_description, |
|
69 | long_description = long_description, | |
60 | author = author, |
|
70 | author = author, | |
61 | author_email = author_email, |
|
71 | author_email = author_email, | |
62 | url = url, |
|
72 | url = url, | |
63 | download_url = download_url, |
|
73 | download_url = download_url, | |
64 | license = license, |
|
74 | license = license, | |
65 | platforms = platforms, |
|
75 | platforms = platforms, | |
66 | keywords = keywords, |
|
76 | keywords = keywords, | |
67 | cmdclass = {'install_data': install_data_ext}, |
|
77 | cmdclass = {'install_data': install_data_ext}, | |
68 | ) |
|
78 | ) | |
69 |
|
79 | |||
70 |
|
80 | |||
71 | #--------------------------------------------------------------------------- |
|
81 | #--------------------------------------------------------------------------- | |
72 | # Find packages |
|
82 | # Find packages | |
73 | #--------------------------------------------------------------------------- |
|
83 | #--------------------------------------------------------------------------- | |
74 |
|
84 | |||
75 | def add_package(packages, pname, config=False, tests=False, scripts=False, others=None): |
|
85 | def add_package(packages, pname, config=False, tests=False, scripts=False, others=None): | |
|
86 | """ | |||
|
87 | Add a package to the list of packages, including certain subpackages. | |||
|
88 | """ | |||
76 | packages.append('.'.join(['ipython1',pname])) |
|
89 | packages.append('.'.join(['ipython1',pname])) | |
77 | if config: |
|
90 | if config: | |
78 | packages.append('.'.join(['ipython1',pname,'config'])) |
|
91 | packages.append('.'.join(['ipython1',pname,'config'])) | |
79 | if tests: |
|
92 | if tests: | |
80 | packages.append('.'.join(['ipython1',pname,'tests'])) |
|
93 | packages.append('.'.join(['ipython1',pname,'tests'])) | |
81 | if scripts: |
|
94 | if scripts: | |
82 | packages.append('.'.join(['ipython1',pname,'scripts'])) |
|
95 | packages.append('.'.join(['ipython1',pname,'scripts'])) | |
83 | if others is not None: |
|
96 | if others is not None: | |
84 | for o in others: |
|
97 | for o in others: | |
85 | packages.append('.'.join(['ipython1',pname,o])) |
|
98 | packages.append('.'.join(['ipython1',pname,o])) | |
86 |
|
99 | |||
87 | def find_packages(): |
|
100 | def find_packages(): | |
|
101 | """ | |||
|
102 | Find all of IPython's packages. | |||
|
103 | """ | |||
88 | packages = ['ipython'] |
|
104 | packages = ['ipython'] | |
89 | add_package(packages, 'config', tests=True) |
|
105 | add_package(packages, 'config', tests=True) | |
90 | add_package(packages , 'Extensions') |
|
106 | add_package(packages , 'Extensions') | |
91 | add_package(packages, 'external') |
|
107 | add_package(packages, 'external') | |
92 | add_package(packages, 'gui') |
|
108 | add_package(packages, 'gui') | |
93 | add_package(packages, 'gui.wx') |
|
109 | add_package(packages, 'gui.wx') | |
94 | add_package(packages, 'kernel', config=True, tests=True, scripts=True) |
|
110 | add_package(packages, 'kernel', config=True, tests=True, scripts=True) | |
95 | add_package(packages, 'kernel.core', config=True, tests=True) |
|
111 | add_package(packages, 'kernel.core', config=True, tests=True) | |
96 | add_package(packages, 'testing', tests=True) |
|
112 | add_package(packages, 'testing', tests=True) | |
97 | add_package(packages, 'tools', tests=True) |
|
113 | add_package(packages, 'tools', tests=True) | |
98 | add_package(packages, 'UserConfig') |
|
114 | add_package(packages, 'UserConfig') | |
99 | return packages |
|
115 | return packages | |
100 |
|
116 | |||
101 | #--------------------------------------------------------------------------- |
|
117 | #--------------------------------------------------------------------------- | |
102 | # Find package data |
|
118 | # Find package data | |
103 | #--------------------------------------------------------------------------- |
|
119 | #--------------------------------------------------------------------------- | |
104 |
|
120 | |||
105 | def find_package_data(): |
|
121 | def find_package_data(): | |
|
122 | """ | |||
|
123 | Find IPython's package_data. | |||
|
124 | """ | |||
106 | # This is not enough for these things to appear in an sdist. |
|
125 | # This is not enough for these things to appear in an sdist. | |
107 | # We need to muck with the MANIFEST to get this to work |
|
126 | # We need to muck with the MANIFEST to get this to work | |
108 | package_data = {'IPython.UserConfig' : ['*'] } |
|
127 | package_data = {'IPython.UserConfig' : ['*'] } | |
109 | return package_data |
|
128 | return package_data | |
110 |
|
129 | |||
111 |
|
130 | |||
112 | #--------------------------------------------------------------------------- |
|
131 | #--------------------------------------------------------------------------- | |
113 | # Find data files |
|
132 | # Find data files | |
114 | #--------------------------------------------------------------------------- |
|
133 | #--------------------------------------------------------------------------- | |
115 |
|
134 | |||
116 | def find_data_files(): |
|
135 | def find_data_files(): | |
|
136 | """ | |||
|
137 | Find IPython's data_files. | |||
|
138 | """ | |||
117 |
|
139 | |||
118 | # I can't find how to make distutils create a nested dir. structure, so |
|
140 | # I can't find how to make distutils create a nested dir. structure, so | |
119 | # in the meantime do it manually. Butt ugly. |
|
141 | # in the meantime do it manually. Butt ugly. | |
120 | # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain |
|
142 | # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain | |
121 | # information on how to do this more cleanly once python 2.4 can be assumed. |
|
143 | # information on how to do this more cleanly once python 2.4 can be assumed. | |
122 | # Thanks to Noel for the tip. |
|
144 | # Thanks to Noel for the tip. | |
123 | docdirbase = 'share/doc/ipython' |
|
145 | docdirbase = 'share/doc/ipython' | |
124 | manpagebase = 'share/man/man1' |
|
146 | manpagebase = 'share/man/man1' | |
125 |
|
147 | |||
126 | # We only need to exclude from this things NOT already excluded in the |
|
148 | # We only need to exclude from this things NOT already excluded in the | |
127 | # MANIFEST.in file. |
|
149 | # MANIFEST.in file. | |
128 | exclude = ('.sh','.1.gz') |
|
150 | exclude = ('.sh','.1.gz') | |
129 | docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*')) |
|
151 | docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*')) | |
130 | examfiles = filter(isfile, glob('doc/examples/*.py')) |
|
152 | examfiles = filter(isfile, glob('doc/examples/*.py')) | |
131 | manfiles = filter(isfile, glob('doc/manual/*')) |
|
153 | manfiles = filter(isfile, glob('doc/manual/*')) | |
132 | manstatic = filter(isfile, glob('doc/manual/_static/*')) |
|
154 | manstatic = filter(isfile, glob('doc/manual/_static/*')) | |
133 | manpages = filter(isfile, glob('doc/*.1.gz')) |
|
155 | manpages = filter(isfile, glob('doc/*.1.gz')) | |
134 | scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor', |
|
156 | scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor', | |
135 | 'scripts/irunner']) |
|
157 | 'scripts/irunner']) | |
136 | igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*')) |
|
158 | igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*')) | |
137 |
|
159 | |||
138 | data_files = [('data', docdirbase, docfiles), |
|
160 | data_files = [('data', docdirbase, docfiles), | |
139 | ('data', pjoin(docdirbase, 'examples'),examfiles), |
|
161 | ('data', pjoin(docdirbase, 'examples'),examfiles), | |
140 | ('data', pjoin(docdirbase, 'manual'),manfiles), |
|
162 | ('data', pjoin(docdirbase, 'manual'),manfiles), | |
141 | ('data', pjoin(docdirbase, 'manual/_static'),manstatic), |
|
163 | ('data', pjoin(docdirbase, 'manual/_static'),manstatic), | |
142 | ('data', manpagebase, manpages), |
|
164 | ('data', manpagebase, manpages), | |
143 | ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), |
|
165 | ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), | |
144 | ] |
|
166 | ] | |
145 | return data_files |
|
167 | return data_files | |
146 |
|
168 | |||
147 | #--------------------------------------------------------------------------- |
|
169 | #--------------------------------------------------------------------------- | |
148 | # Find scripts |
|
170 | # Find scripts | |
149 | #--------------------------------------------------------------------------- |
|
171 | #--------------------------------------------------------------------------- | |
150 |
|
172 | |||
151 | def find_scripts(): |
|
173 | def find_scripts(): | |
|
174 | """ | |||
|
175 | Find IPython's scripts. | |||
|
176 | """ | |||
152 | scripts = [] |
|
177 | scripts = [] | |
153 | scripts.append('ipython1/kernel/scripts/ipengine') |
|
178 | scripts.append('ipython1/kernel/scripts/ipengine') | |
154 | scripts.append('ipython1/kernel/scripts/ipcontroller') |
|
179 | scripts.append('ipython1/kernel/scripts/ipcontroller') | |
155 | scripts.append('ipython1/kernel/scripts/ipcluster') |
|
180 | scripts.append('ipython1/kernel/scripts/ipcluster') | |
156 | scripts.append('scripts/ipython') |
|
181 | scripts.append('scripts/ipython') | |
157 | scripts.append('scripts/pycolor') |
|
182 | scripts.append('scripts/pycolor') | |
158 | scripts.append('scripts/irunner') |
|
183 | scripts.append('scripts/irunner') | |
159 |
|
184 | |||
160 | # Script to be run by the windows binary installer after the default setup |
|
185 | # Script to be run by the windows binary installer after the default setup | |
161 | # routine, to add shortcuts and similar windows-only things. Windows |
|
186 | # routine, to add shortcuts and similar windows-only things. Windows | |
162 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils |
|
187 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils | |
163 | # doesn't find them. |
|
188 | # doesn't find them. | |
164 | if 'bdist_wininst' in sys.argv: |
|
189 | if 'bdist_wininst' in sys.argv: | |
165 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): |
|
190 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): | |
166 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." |
|
191 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." | |
167 | sys.exit(1) |
|
192 | sys.exit(1) | |
168 | scripts.append('scripts/ipython_win_post_install.py') |
|
193 | scripts.append('scripts/ipython_win_post_install.py') | |
169 |
|
194 | |||
170 | return scripts |
|
195 | return scripts | |
171 |
|
196 | |||
172 | #--------------------------------------------------------------------------- |
|
197 | #--------------------------------------------------------------------------- | |
173 | # Find scripts |
|
198 | # Find scripts | |
174 | #--------------------------------------------------------------------------- |
|
199 | #--------------------------------------------------------------------------- | |
175 |
|
200 | |||
176 | def check_for_dependencies(): |
|
201 | def check_for_dependencies(): | |
|
202 | """Check for IPython's dependencies. | |||
|
203 | ||||
|
204 | This function should NOT be called if running under setuptools! | |||
|
205 | """ | |||
177 | from setupext.setupext import ( |
|
206 | from setupext.setupext import ( | |
178 | print_line, print_raw, print_status, print_message, |
|
207 | print_line, print_raw, print_status, print_message, | |
179 | check_for_zopeinterface, check_for_twisted, |
|
208 | check_for_zopeinterface, check_for_twisted, | |
180 | check_for_foolscap, check_for_pyopenssl, |
|
209 | check_for_foolscap, check_for_pyopenssl, | |
181 | check_for_sphinx, check_for_pygments, |
|
210 | check_for_sphinx, check_for_pygments, | |
182 | check_for_nose, check_for_pexpect |
|
211 | check_for_nose, check_for_pexpect | |
183 | ) |
|
212 | ) | |
184 | print_line() |
|
213 | print_line() | |
185 | print_raw("BUILDING IPYTHON") |
|
214 | print_raw("BUILDING IPYTHON") | |
186 | print_status('python', sys.version) |
|
215 | print_status('python', sys.version) | |
187 | print_status('platform', sys.platform) |
|
216 | print_status('platform', sys.platform) | |
188 | if sys.platform == 'win32': |
|
217 | if sys.platform == 'win32': | |
189 | print_status('Windows version', sys.getwindowsversion()) |
|
218 | print_status('Windows version', sys.getwindowsversion()) | |
190 |
|
219 | |||
191 | print_raw("") |
|
220 | print_raw("") | |
192 | print_raw("OPTIONAL DEPENDENCIES") |
|
221 | print_raw("OPTIONAL DEPENDENCIES") | |
193 |
|
222 | |||
194 | check_for_zopeinterface() |
|
223 | check_for_zopeinterface() | |
195 | check_for_twisted() |
|
224 | check_for_twisted() | |
196 | check_for_foolscap() |
|
225 | check_for_foolscap() | |
197 | check_for_pyopenssl() |
|
226 | check_for_pyopenssl() | |
198 | check_for_sphinx() |
|
227 | check_for_sphinx() | |
199 | check_for_pygments() |
|
228 | check_for_pygments() | |
200 | check_for_nose() |
|
229 | check_for_nose() | |
201 | check_for_pexpect() No newline at end of file |
|
230 | check_for_pexpect() |
@@ -1,20 +1,20 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 |
"""Wrapper to |
|
2 | """Wrapper to run setup.py using setuptools.""" | |
3 |
|
3 | |||
4 | import os |
|
4 | import os | |
5 | import sys |
|
5 | import sys | |
6 |
|
6 | |||
7 | # Add my local path to sys.path |
|
7 | # Add my local path to sys.path | |
8 | home = os.environ['HOME'] |
|
8 | home = os.environ['HOME'] | |
9 | sys.path.insert(0,'%s/usr/local/lib/python%s/site-packages' % |
|
9 | sys.path.insert(0,'%s/usr/local/lib/python%s/site-packages' % | |
10 | (home,sys.version[:3])) |
|
10 | (home,sys.version[:3])) | |
11 |
|
11 | |||
12 | # now, import setuptools and call the actual setup |
|
12 | # now, import setuptools and call the actual setup | |
13 | import setuptools |
|
13 | import setuptools | |
14 | print sys.argv |
|
14 | print sys.argv | |
15 | #sys.argv=['','bdist_egg'] |
|
15 | #sys.argv=['','bdist_egg'] | |
16 | execfile('setup.py') |
|
16 | execfile('setup.py') | |
17 |
|
17 | |||
18 | # clean up the junk left around by setuptools |
|
18 | # clean up the junk left around by setuptools | |
19 | if "develop" not in sys.argv: |
|
19 | if "develop" not in sys.argv: | |
20 | os.system('rm -rf ipython.egg-info build') |
|
20 | os.system('rm -rf ipython.egg-info build') |
General Comments 0
You need to be logged in to leave comments.
Login now