Show More
@@ -1,36 +1,31 b'' | |||
|
1 | 1 | include README_Windows.txt |
|
2 | 2 | include win32_manual_post_install.py |
|
3 | 3 | include ipython.py |
|
4 | 4 | |
|
5 | 5 | graft scripts |
|
6 | 6 | |
|
7 | 7 | graft setupext |
|
8 | 8 | |
|
9 | 9 | graft IPython/UserConfig |
|
10 | 10 | |
|
11 | 11 | graft IPython/kernel |
|
12 | 12 | graft IPython/config |
|
13 | 13 | graft IPython/testing |
|
14 | 14 | graft IPython/tools |
|
15 | 15 | |
|
16 | graft doc | |
|
17 | exclude doc/\#* | |
|
18 | exclude doc/*.1 | |
|
19 | exclude doc/ChangeLog.* | |
|
20 | exclude doc/update_version.sh | |
|
16 | graft docs | |
|
17 | exclude docs/\#* | |
|
18 | exclude docs/man/*.1 | |
|
19 | exclude docs/ChangeLog.* | |
|
21 | 20 | |
|
22 | 21 | # There seems to be no way of excluding whole subdirectories, other than |
|
23 | 22 | # manually excluding all their subdirs. distutils really is horrible... |
|
24 | exclude doc/attic/* | |
|
25 |
exclude doc/build |
|
|
26 | exclude doc/build/html/_sources/* | |
|
27 | exclude doc/build/html/_static/* | |
|
28 | exclude doc/build/html/* | |
|
29 | exclude doc/build/latex/* | |
|
23 | exclude docs/attic/* | |
|
24 | exclude docs/build/* | |
|
30 | 25 | |
|
31 | 26 | global-exclude *~ |
|
32 | 27 | global-exclude *.flc |
|
33 | 28 | global-exclude *.pyc |
|
34 | 29 | global-exclude .dircopy.log |
|
35 | 30 | global-exclude .svn |
|
36 | 31 | global-exclude .bzr |
@@ -1,169 +1,173 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # -*- coding: utf-8 -*- |
|
3 | 3 | """Setup script for IPython. |
|
4 | 4 | |
|
5 | 5 | Under Posix environments it works like a typical setup.py script. |
|
6 | 6 | Under Windows, the command sdist is not supported, since IPython |
|
7 | 7 | requires utilities which are not available under Windows.""" |
|
8 | 8 | |
|
9 | 9 | #------------------------------------------------------------------------------- |
|
10 | 10 | # Copyright (C) 2008 The IPython Development Team |
|
11 | 11 | # |
|
12 | 12 | # Distributed under the terms of the BSD License. The full license is in |
|
13 | 13 | # the file COPYING, distributed as part of this software. |
|
14 | 14 | #------------------------------------------------------------------------------- |
|
15 | 15 | |
|
16 | 16 | #------------------------------------------------------------------------------- |
|
17 | 17 | # Imports |
|
18 | 18 | #------------------------------------------------------------------------------- |
|
19 | 19 | |
|
20 | 20 | # Stdlib imports |
|
21 | 21 | import os |
|
22 | 22 | import sys |
|
23 | 23 | |
|
24 | 24 | from glob import glob |
|
25 | 25 | |
|
26 | 26 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly |
|
27 | 27 | # update it when the contents of directories change. |
|
28 | 28 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') |
|
29 | 29 | |
|
30 | 30 | from distutils.core import setup |
|
31 | 31 | |
|
32 | 32 | # Local imports |
|
33 | 33 | from IPython.genutils import target_update |
|
34 | 34 | |
|
35 | 35 | from setupbase import ( |
|
36 | 36 | setup_args, |
|
37 | 37 | find_packages, |
|
38 | 38 | find_package_data, |
|
39 | 39 | find_scripts, |
|
40 | 40 | find_data_files, |
|
41 | 41 | check_for_dependencies |
|
42 | 42 | ) |
|
43 | 43 | |
|
44 | 44 | isfile = os.path.isfile |
|
45 | 45 | |
|
46 | 46 | #------------------------------------------------------------------------------- |
|
47 | 47 | # Handle OS specific things |
|
48 | 48 | #------------------------------------------------------------------------------- |
|
49 | 49 | |
|
50 | 50 | if os.name == 'posix': |
|
51 | 51 | os_name = 'posix' |
|
52 | 52 | elif os.name in ['nt','dos']: |
|
53 | 53 | os_name = 'windows' |
|
54 | 54 | else: |
|
55 | 55 | print 'Unsupported operating system:',os.name |
|
56 | 56 | sys.exit(1) |
|
57 | 57 | |
|
58 | 58 | # Under Windows, 'sdist' has not been supported. Now that the docs build with |
|
59 | 59 | # Sphinx it might work, but let's not turn it on until someone confirms that it |
|
60 | 60 | # actually works. |
|
61 | 61 | if os_name == 'windows' and 'sdist' in sys.argv: |
|
62 | 62 | print 'The sdist command is not available under Windows. Exiting.' |
|
63 | 63 | sys.exit(1) |
|
64 | 64 | |
|
65 | 65 | #------------------------------------------------------------------------------- |
|
66 | 66 | # Things related to the IPython documentation |
|
67 | 67 | #------------------------------------------------------------------------------- |
|
68 | 68 | |
|
69 | 69 | # update the manuals when building a source dist |
|
70 | 70 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
|
71 | 71 | import textwrap |
|
72 | 72 | |
|
73 | 73 | # List of things to be updated. Each entry is a triplet of args for |
|
74 | 74 | # target_update() |
|
75 | 75 | to_update = [ |
|
76 | 76 | # FIXME - Disabled for now: we need to redo an automatic way |
|
77 | 77 | # of generating the magic info inside the rst. |
|
78 | 78 | #('doc/magic.tex', |
|
79 | 79 | #['IPython/Magic.py'], |
|
80 | 80 | #"cd doc && ./update_magic.sh" ), |
|
81 | 81 | |
|
82 | 82 | ('doc/ipython.1.gz', |
|
83 | 83 | ['doc/ipython.1'], |
|
84 | 84 | "cd doc && gzip -9c ipython.1 > ipython.1.gz"), |
|
85 | 85 | |
|
86 | 86 | ('doc/pycolor.1.gz', |
|
87 | 87 | ['doc/pycolor.1'], |
|
88 | 88 | "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"), |
|
89 | 89 | ] |
|
90 | 90 | |
|
91 | # Only build the docs is sphinx is present | |
|
91 | 92 | try: |
|
92 | 93 | import sphinx |
|
93 | 94 | except ImportError: |
|
94 | 95 | pass |
|
95 | 96 | else: |
|
97 | # BEG: This is disabled as I am not sure what to depend on. | |
|
98 | # I actually don't think we should be automatically building | |
|
99 | # the docs for people. | |
|
96 | 100 | # The do_sphinx scripts builds html and pdf, so just one |
|
97 | 101 | # target is enough to cover all manual generation |
|
98 | to_update.append( | |
|
99 | ('doc/manual/ipython.pdf', | |
|
100 | ['IPython/Release.py','doc/source/ipython.rst'], | |
|
101 | "cd doc && python do_sphinx.py") | |
|
102 | # to_update.append( | |
|
103 | # ('doc/manual/ipython.pdf', | |
|
104 | # ['IPython/Release.py','doc/source/ipython.rst'], | |
|
105 | # "cd docs && python do_sphinx.py") | |
|
102 | 106 | ) |
|
103 | 107 | [ target_update(*t) for t in to_update ] |
|
104 | 108 | |
|
105 | 109 | #--------------------------------------------------------------------------- |
|
106 | 110 | # Find all the packages, package data, scripts and data_files |
|
107 | 111 | #--------------------------------------------------------------------------- |
|
108 | 112 | |
|
109 | 113 | packages = find_packages() |
|
110 | 114 | package_data = find_package_data() |
|
111 | 115 | scripts = find_scripts() |
|
112 | 116 | data_files = find_data_files() |
|
113 | 117 | |
|
114 | 118 | #--------------------------------------------------------------------------- |
|
115 | 119 | # Handle dependencies and setuptools specific things |
|
116 | 120 | #--------------------------------------------------------------------------- |
|
117 | 121 | |
|
118 | 122 | # This dict is used for passing extra arguments that are setuptools |
|
119 | 123 | # specific to setup |
|
120 | 124 | setuptools_extra_args = {} |
|
121 | 125 | |
|
122 | 126 | if 'setuptools' in sys.modules: |
|
123 | 127 | setuptools_extra_args['zip_safe'] = False |
|
124 | 128 | setuptools_extra_args['entry_points'] = { |
|
125 | 129 | 'console_scripts': [ |
|
126 | 130 | 'ipython = IPython.ipapi:launch_new_instance', |
|
127 | 131 | 'pycolor = IPython.PyColorize:main', |
|
128 | 132 | 'ipcontroller = IPython.kernel.scripts.ipcontroller:main', |
|
129 | 133 | 'ipengine = IPython.kernel.scripts.ipengine:main', |
|
130 | 134 | 'ipcluster = IPython.kernel.scripts.ipcluster:main' |
|
131 | 135 | ] |
|
132 | 136 | } |
|
133 | 137 | setup_args["extras_require"] = dict( |
|
134 | 138 | kernel = [ |
|
135 | 139 | "zope.interface>=3.4.1", |
|
136 | 140 | "Twisted>=8.0.1", |
|
137 | 141 | "foolscap>=0.2.6" |
|
138 | 142 | ], |
|
139 | 143 | doc=['Sphinx>=0.3','pygments'], |
|
140 | 144 | test='nose>=0.10.1', |
|
141 | 145 | security=["pyOpenSSL>=0.6"] |
|
142 | 146 | ) |
|
143 | 147 | # Allow setuptools to handle the scripts |
|
144 | 148 | scripts = [] |
|
145 | 149 | # eggs will lack docs, examples |
|
146 | 150 | data_files = [] |
|
147 | 151 | else: |
|
148 | 152 | # package_data of setuptools was introduced to distutils in 2.4 |
|
149 | 153 | cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) |
|
150 | 154 | if sys.version_info < (2,4): |
|
151 | 155 | data_files.append(('lib', 'IPython/UserConfig', cfgfiles)) |
|
152 | 156 | # If we are running without setuptools, call this function which will |
|
153 | 157 | # check for dependencies an inform the user what is needed. This is |
|
154 | 158 | # just to make life easy for users. |
|
155 | 159 | check_for_dependencies() |
|
156 | 160 | |
|
157 | 161 | |
|
158 | 162 | #--------------------------------------------------------------------------- |
|
159 | 163 | # Do the actual setup now |
|
160 | 164 | #--------------------------------------------------------------------------- |
|
161 | 165 | |
|
162 | 166 | setup_args['packages'] = packages |
|
163 | 167 | setup_args['package_data'] = package_data |
|
164 | 168 | setup_args['scripts'] = scripts |
|
165 | 169 | setup_args['data_files'] = data_files |
|
166 | 170 | setup_args.update(setuptools_extra_args) |
|
167 | 171 | |
|
168 | 172 | if __name__ == '__main__': |
|
169 | 173 | setup(**setup_args) |
@@ -1,230 +1,226 b'' | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | |
|
3 | 3 | """ |
|
4 | 4 | This module defines the things that are used in setup.py for building IPython |
|
5 | 5 | |
|
6 | 6 | This includes: |
|
7 | 7 | |
|
8 | 8 | * The basic arguments to setup |
|
9 | 9 | * Functions for finding things like packages, package data, etc. |
|
10 | 10 | * A function for checking dependencies. |
|
11 | 11 | """ |
|
12 | 12 | |
|
13 | 13 | __docformat__ = "restructuredtext en" |
|
14 | 14 | |
|
15 | 15 | #------------------------------------------------------------------------------- |
|
16 | 16 | # Copyright (C) 2008 The IPython Development Team |
|
17 | 17 | # |
|
18 | 18 | # Distributed under the terms of the BSD License. The full license is in |
|
19 | 19 | # the file COPYING, distributed as part of this software. |
|
20 | 20 | #------------------------------------------------------------------------------- |
|
21 | 21 | |
|
22 | 22 | #------------------------------------------------------------------------------- |
|
23 | 23 | # Imports |
|
24 | 24 | #------------------------------------------------------------------------------- |
|
25 | 25 | |
|
26 | 26 | import os, sys |
|
27 | 27 | |
|
28 | 28 | from glob import glob |
|
29 | 29 | |
|
30 | 30 | from setupext import install_data_ext |
|
31 | 31 | |
|
32 | 32 | #------------------------------------------------------------------------------- |
|
33 | 33 | # Useful globals and utility functions |
|
34 | 34 | #------------------------------------------------------------------------------- |
|
35 | 35 | |
|
36 | 36 | # A few handy globals |
|
37 | 37 | isfile = os.path.isfile |
|
38 | 38 | pjoin = os.path.join |
|
39 | 39 | |
|
40 | 40 | def oscmd(s): |
|
41 | 41 | print ">", s |
|
42 | 42 | os.system(s) |
|
43 | 43 | |
|
44 | 44 | # A little utility we'll need below, since glob() does NOT allow you to do |
|
45 | 45 | # exclusion on multiple endings! |
|
46 | 46 | def file_doesnt_endwith(test,endings): |
|
47 | 47 | """Return true if test is a file and its name does NOT end with any |
|
48 | 48 | of the strings listed in endings.""" |
|
49 | 49 | if not isfile(test): |
|
50 | 50 | return False |
|
51 | 51 | for e in endings: |
|
52 | 52 | if test.endswith(e): |
|
53 | 53 | return False |
|
54 | 54 | return True |
|
55 | 55 | |
|
56 | 56 | #--------------------------------------------------------------------------- |
|
57 | 57 | # Basic project information |
|
58 | 58 | #--------------------------------------------------------------------------- |
|
59 | 59 | |
|
60 | 60 | # Release.py contains version, authors, license, url, keywords, etc. |
|
61 | 61 | execfile(pjoin('IPython','Release.py')) |
|
62 | 62 | |
|
63 | 63 | # Create a dict with the basic information |
|
64 | 64 | # This dict is eventually passed to setup after additional keys are added. |
|
65 | 65 | setup_args = dict( |
|
66 | 66 | name = name, |
|
67 | 67 | version = version, |
|
68 | 68 | description = description, |
|
69 | 69 | long_description = long_description, |
|
70 | 70 | author = author, |
|
71 | 71 | author_email = author_email, |
|
72 | 72 | url = url, |
|
73 | 73 | download_url = download_url, |
|
74 | 74 | license = license, |
|
75 | 75 | platforms = platforms, |
|
76 | 76 | keywords = keywords, |
|
77 | 77 | cmdclass = {'install_data': install_data_ext}, |
|
78 | 78 | ) |
|
79 | 79 | |
|
80 | 80 | |
|
81 | 81 | #--------------------------------------------------------------------------- |
|
82 | 82 | # Find packages |
|
83 | 83 | #--------------------------------------------------------------------------- |
|
84 | 84 | |
|
85 | 85 | def add_package(packages, pname, config=False, tests=False, scripts=False, others=None): |
|
86 | 86 | """ |
|
87 | 87 | Add a package to the list of packages, including certain subpackages. |
|
88 | 88 | """ |
|
89 | 89 | packages.append('.'.join(['IPython',pname])) |
|
90 | 90 | if config: |
|
91 | 91 | packages.append('.'.join(['IPython',pname,'config'])) |
|
92 | 92 | if tests: |
|
93 | 93 | packages.append('.'.join(['IPython',pname,'tests'])) |
|
94 | 94 | if scripts: |
|
95 | 95 | packages.append('.'.join(['IPython',pname,'scripts'])) |
|
96 | 96 | if others is not None: |
|
97 | 97 | for o in others: |
|
98 | 98 | packages.append('.'.join(['IPython',pname,o])) |
|
99 | 99 | |
|
100 | 100 | def find_packages(): |
|
101 | 101 | """ |
|
102 | 102 | Find all of IPython's packages. |
|
103 | 103 | """ |
|
104 | 104 | packages = ['IPython'] |
|
105 | 105 | add_package(packages, 'config', tests=True) |
|
106 | 106 | add_package(packages , 'Extensions') |
|
107 | 107 | add_package(packages, 'external') |
|
108 | 108 | add_package(packages, 'gui') |
|
109 | 109 | add_package(packages, 'gui.wx') |
|
110 | 110 | add_package(packages, 'kernel', config=True, tests=True, scripts=True) |
|
111 | 111 | add_package(packages, 'kernel.core', config=True, tests=True) |
|
112 | 112 | add_package(packages, 'testing', tests=True) |
|
113 | 113 | add_package(packages, 'tools', tests=True) |
|
114 | 114 | add_package(packages, 'UserConfig') |
|
115 | 115 | return packages |
|
116 | 116 | |
|
117 | 117 | #--------------------------------------------------------------------------- |
|
118 | 118 | # Find package data |
|
119 | 119 | #--------------------------------------------------------------------------- |
|
120 | 120 | |
|
121 | 121 | def find_package_data(): |
|
122 | 122 | """ |
|
123 | 123 | Find IPython's package_data. |
|
124 | 124 | """ |
|
125 | 125 | # This is not enough for these things to appear in an sdist. |
|
126 | 126 | # We need to muck with the MANIFEST to get this to work |
|
127 | 127 | package_data = {'IPython.UserConfig' : ['*'] } |
|
128 | 128 | return package_data |
|
129 | 129 | |
|
130 | 130 | |
|
131 | 131 | #--------------------------------------------------------------------------- |
|
132 | 132 | # Find data files |
|
133 | 133 | #--------------------------------------------------------------------------- |
|
134 | 134 | |
|
135 | 135 | def find_data_files(): |
|
136 | 136 | """ |
|
137 | 137 | Find IPython's data_files. |
|
138 | 138 | """ |
|
139 | 139 | |
|
140 | 140 | # I can't find how to make distutils create a nested dir. structure, so |
|
141 | 141 | # in the meantime do it manually. Butt ugly. |
|
142 | 142 | # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain |
|
143 | 143 | # information on how to do this more cleanly once python 2.4 can be assumed. |
|
144 | 144 | # Thanks to Noel for the tip. |
|
145 | 145 | docdirbase = 'share/doc/ipython' |
|
146 | 146 | manpagebase = 'share/man/man1' |
|
147 | 147 | |
|
148 | 148 | # We only need to exclude from this things NOT already excluded in the |
|
149 | 149 | # MANIFEST.in file. |
|
150 | 150 | exclude = ('.sh','.1.gz') |
|
151 | docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*')) | |
|
152 | examfiles = filter(isfile, glob('doc/examples/*.py')) | |
|
153 |
m |
|
|
154 |
|
|
|
155 | manpages = filter(isfile, glob('doc/*.1.gz')) | |
|
156 | scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor', | |
|
157 | 'scripts/irunner']) | |
|
151 | # We need to figure out how we want to package all of our rst docs? | |
|
152 | # docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('docs/*')) | |
|
153 | examfiles = filter(isfile, glob('docs/examples/core/*.py')) | |
|
154 | examfiles.append(filter(isfile, glob('docs/examples/kernel/*.py'))) | |
|
155 | manpages = filter(isfile, glob('docs/man/*.1.gz')) | |
|
158 | 156 | igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*')) |
|
159 | 157 | |
|
160 | data_files = [('data', docdirbase, docfiles), | |
|
158 | data_files = [#('data', docdirbase, docfiles), | |
|
161 | 159 | ('data', pjoin(docdirbase, 'examples'),examfiles), |
|
162 | ('data', pjoin(docdirbase, 'manual'),manfiles), | |
|
163 | ('data', pjoin(docdirbase, 'manual/_static'),manstatic), | |
|
164 | 160 | ('data', manpagebase, manpages), |
|
165 | 161 | ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), |
|
166 | 162 | ] |
|
167 | 163 | return data_files |
|
168 | 164 | |
|
169 | 165 | #--------------------------------------------------------------------------- |
|
170 | 166 | # Find scripts |
|
171 | 167 | #--------------------------------------------------------------------------- |
|
172 | 168 | |
|
173 | 169 | def find_scripts(): |
|
174 | 170 | """ |
|
175 | 171 | Find IPython's scripts. |
|
176 | 172 | """ |
|
177 | 173 | scripts = [] |
|
178 | 174 | scripts.append('IPython/kernel/scripts/ipengine') |
|
179 | 175 | scripts.append('IPython/kernel/scripts/ipcontroller') |
|
180 | 176 | scripts.append('IPython/kernel/scripts/ipcluster') |
|
181 | 177 | scripts.append('scripts/ipython') |
|
182 | 178 | scripts.append('scripts/pycolor') |
|
183 | 179 | scripts.append('scripts/irunner') |
|
184 | 180 | |
|
185 | 181 | # Script to be run by the windows binary installer after the default setup |
|
186 | 182 | # routine, to add shortcuts and similar windows-only things. Windows |
|
187 | 183 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils |
|
188 | 184 | # doesn't find them. |
|
189 | 185 | if 'bdist_wininst' in sys.argv: |
|
190 | 186 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): |
|
191 | 187 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." |
|
192 | 188 | sys.exit(1) |
|
193 | 189 | scripts.append('scripts/ipython_win_post_install.py') |
|
194 | 190 | |
|
195 | 191 | return scripts |
|
196 | 192 | |
|
197 | 193 | #--------------------------------------------------------------------------- |
|
198 | 194 | # Find scripts |
|
199 | 195 | #--------------------------------------------------------------------------- |
|
200 | 196 | |
|
201 | 197 | def check_for_dependencies(): |
|
202 | 198 | """Check for IPython's dependencies. |
|
203 | 199 | |
|
204 | 200 | This function should NOT be called if running under setuptools! |
|
205 | 201 | """ |
|
206 | 202 | from setupext.setupext import ( |
|
207 | 203 | print_line, print_raw, print_status, print_message, |
|
208 | 204 | check_for_zopeinterface, check_for_twisted, |
|
209 | 205 | check_for_foolscap, check_for_pyopenssl, |
|
210 | 206 | check_for_sphinx, check_for_pygments, |
|
211 | 207 | check_for_nose, check_for_pexpect |
|
212 | 208 | ) |
|
213 | 209 | print_line() |
|
214 | 210 | print_raw("BUILDING IPYTHON") |
|
215 | 211 | print_status('python', sys.version) |
|
216 | 212 | print_status('platform', sys.platform) |
|
217 | 213 | if sys.platform == 'win32': |
|
218 | 214 | print_status('Windows version', sys.getwindowsversion()) |
|
219 | 215 | |
|
220 | 216 | print_raw("") |
|
221 | 217 | print_raw("OPTIONAL DEPENDENCIES") |
|
222 | 218 | |
|
223 | 219 | check_for_zopeinterface() |
|
224 | 220 | check_for_twisted() |
|
225 | 221 | check_for_foolscap() |
|
226 | 222 | check_for_pyopenssl() |
|
227 | 223 | check_for_sphinx() |
|
228 | 224 | check_for_pygments() |
|
229 | 225 | check_for_nose() |
|
230 | 226 | check_for_pexpect() No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now