Show More
@@ -1,30 +1,31 b'' | |||
|
1 | 1 | include README_Windows.txt |
|
2 | 2 | include win32_manual_post_install.py |
|
3 | 3 | include ipython.py |
|
4 | include setupbase.py | |
|
4 | 5 | |
|
5 | 6 | graft scripts |
|
6 | 7 | |
|
7 | 8 | graft setupext |
|
8 | 9 | |
|
9 | 10 | graft IPython/UserConfig |
|
10 | 11 | |
|
11 | 12 | graft IPython/kernel |
|
12 | 13 | graft IPython/config |
|
13 | 14 | graft IPython/testing |
|
14 | 15 | graft IPython/tools |
|
15 | 16 | |
|
16 | 17 | graft docs |
|
17 | 18 | exclude docs/\#* |
|
18 | 19 | exclude docs/man/*.1 |
|
19 | 20 | |
|
20 | 21 | # There seems to be no way of excluding whole subdirectories, other than |
|
21 | 22 | # manually excluding all their subdirs. distutils really is horrible... |
|
22 | 23 | exclude docs/attic/* |
|
23 | 24 | exclude docs/build/* |
|
24 | 25 | |
|
25 | 26 | global-exclude *~ |
|
26 | 27 | global-exclude *.flc |
|
27 | 28 | global-exclude *.pyc |
|
28 | 29 | global-exclude .dircopy.log |
|
29 | 30 | global-exclude .svn |
|
30 | 31 | global-exclude .bzr |
@@ -1,175 +1,175 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 | #('doc/magic.tex', | |
|
78 | #('docs/magic.tex', | |
|
79 | 79 | #['IPython/Magic.py'], |
|
80 | 80 | #"cd doc && ./update_magic.sh" ), |
|
81 | 81 | |
|
82 | ('doc/ipython.1.gz', | |
|
83 | ['doc/ipython.1'], | |
|
84 | "cd doc && gzip -9c ipython.1 > ipython.1.gz"), | |
|
82 | ('docs/man/ipython.1.gz', | |
|
83 | ['docs/man/ipython.1'], | |
|
84 | "cd docs/man && gzip -9c ipython.1 > ipython.1.gz"), | |
|
85 | 85 | |
|
86 | ('doc/pycolor.1.gz', | |
|
87 | ['doc/pycolor.1'], | |
|
88 | "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"), | |
|
86 | ('docs/man/pycolor.1.gz', | |
|
87 | ['docs/man/pycolor.1'], | |
|
88 | "cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz"), | |
|
89 | 89 | ] |
|
90 | 90 | |
|
91 | 91 | # Only build the docs is sphinx is present |
|
92 | 92 | try: |
|
93 | 93 | import sphinx |
|
94 | 94 | except ImportError: |
|
95 | 95 | pass |
|
96 | 96 | else: |
|
97 | 97 | pass |
|
98 | 98 | # BEG: This is disabled as I am not sure what to depend on. |
|
99 | 99 | # I actually don't think we should be automatically building |
|
100 | 100 | # the docs for people. |
|
101 | 101 | # The do_sphinx scripts builds html and pdf, so just one |
|
102 | 102 | # target is enough to cover all manual generation |
|
103 | 103 | # to_update.append( |
|
104 | # ('doc/manual/ipython.pdf', | |
|
105 | # ['IPython/Release.py','doc/source/ipython.rst'], | |
|
104 | # ('docs/manual/ipython.pdf', | |
|
105 | # ['IPython/Release.py','docs/source/ipython.rst'], | |
|
106 | 106 | # "cd docs && python do_sphinx.py") |
|
107 | 107 | # ) |
|
108 | 108 | [ target_update(*t) for t in to_update ] |
|
109 | 109 | |
|
110 | 110 | #--------------------------------------------------------------------------- |
|
111 | 111 | # Find all the packages, package data, scripts and data_files |
|
112 | 112 | #--------------------------------------------------------------------------- |
|
113 | 113 | |
|
114 | 114 | packages = find_packages() |
|
115 | 115 | package_data = find_package_data() |
|
116 | 116 | scripts = find_scripts() |
|
117 | 117 | data_files = find_data_files() |
|
118 | 118 | |
|
119 | 119 | #--------------------------------------------------------------------------- |
|
120 | 120 | # Handle dependencies and setuptools specific things |
|
121 | 121 | #--------------------------------------------------------------------------- |
|
122 | 122 | |
|
123 | 123 | # This dict is used for passing extra arguments that are setuptools |
|
124 | 124 | # specific to setup |
|
125 | 125 | setuptools_extra_args = {} |
|
126 | 126 | |
|
127 | 127 | if 'setuptools' in sys.modules: |
|
128 | 128 | setuptools_extra_args['zip_safe'] = False |
|
129 | 129 | setuptools_extra_args['entry_points'] = { |
|
130 | 130 | 'console_scripts': [ |
|
131 | 131 | 'ipython = IPython.ipapi:launch_new_instance', |
|
132 | 132 | 'pycolor = IPython.PyColorize:main', |
|
133 | 133 | 'ipcontroller = IPython.kernel.scripts.ipcontroller:main', |
|
134 | 134 | 'ipengine = IPython.kernel.scripts.ipengine:main', |
|
135 | 135 | 'ipcluster = IPython.kernel.scripts.ipcluster:main', |
|
136 | 136 | 'ipythonx = IPython.frontend.wx.ipythonx:main' |
|
137 | 137 | ] |
|
138 | 138 | } |
|
139 | 139 | setup_args["extras_require"] = dict( |
|
140 | 140 | kernel = [ |
|
141 | 141 | "zope.interface>=3.4.1", |
|
142 | 142 | "Twisted>=8.0.1", |
|
143 | 143 | "foolscap>=0.2.6" |
|
144 | 144 | ], |
|
145 | 145 | doc=['Sphinx>=0.3','pygments'], |
|
146 | 146 | test='nose>=0.10.1', |
|
147 | 147 | security=["pyOpenSSL>=0.6"] |
|
148 | 148 | ) |
|
149 | 149 | # Allow setuptools to handle the scripts |
|
150 | 150 | scripts = [] |
|
151 | 151 | # eggs will lack docs, examples |
|
152 | 152 | data_files = [] |
|
153 | 153 | else: |
|
154 | 154 | # package_data of setuptools was introduced to distutils in 2.4 |
|
155 | 155 | cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) |
|
156 | 156 | if sys.version_info < (2,4): |
|
157 | 157 | data_files.append(('lib', 'IPython/UserConfig', cfgfiles)) |
|
158 | 158 | # If we are running without setuptools, call this function which will |
|
159 | 159 | # check for dependencies an inform the user what is needed. This is |
|
160 | 160 | # just to make life easy for users. |
|
161 | 161 | check_for_dependencies() |
|
162 | 162 | |
|
163 | 163 | |
|
164 | 164 | #--------------------------------------------------------------------------- |
|
165 | 165 | # Do the actual setup now |
|
166 | 166 | #--------------------------------------------------------------------------- |
|
167 | 167 | |
|
168 | 168 | setup_args['packages'] = packages |
|
169 | 169 | setup_args['package_data'] = package_data |
|
170 | 170 | setup_args['scripts'] = scripts |
|
171 | 171 | setup_args['data_files'] = data_files |
|
172 | 172 | setup_args.update(setuptools_extra_args) |
|
173 | 173 | |
|
174 | 174 | if __name__ == '__main__': |
|
175 | 175 | setup(**setup_args) |
@@ -1,237 +1,244 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, 'frontend', tests=True) |
|
111 | 111 | add_package(packages, 'frontend._process') |
|
112 | 112 | add_package(packages, 'frontend.wx') |
|
113 | 113 | add_package(packages, 'frontend.cocoa', tests=True) |
|
114 | 114 | add_package(packages, 'kernel', config=True, tests=True, scripts=True) |
|
115 | 115 | add_package(packages, 'kernel.core', config=True, tests=True) |
|
116 | 116 | add_package(packages, 'testing', tests=True) |
|
117 | 117 | add_package(packages, 'tools', tests=True) |
|
118 | 118 | add_package(packages, 'UserConfig') |
|
119 | 119 | return packages |
|
120 | 120 | |
|
121 | 121 | #--------------------------------------------------------------------------- |
|
122 | 122 | # Find package data |
|
123 | 123 | #--------------------------------------------------------------------------- |
|
124 | 124 | |
|
125 | 125 | def find_package_data(): |
|
126 | 126 | """ |
|
127 | 127 | Find IPython's package_data. |
|
128 | 128 | """ |
|
129 | 129 | # This is not enough for these things to appear in an sdist. |
|
130 | 130 | # We need to muck with the MANIFEST to get this to work |
|
131 | 131 | package_data = { |
|
132 | 132 | 'IPython.UserConfig' : ['*'], |
|
133 | 133 | 'IPython.tools.tests' : ['*.txt'], |
|
134 | 134 | 'IPython.testing' : ['*.txt'] |
|
135 | 135 | } |
|
136 | 136 | return package_data |
|
137 | 137 | |
|
138 | 138 | |
|
139 | 139 | #--------------------------------------------------------------------------- |
|
140 | 140 | # Find data files |
|
141 | 141 | #--------------------------------------------------------------------------- |
|
142 | 142 | |
|
143 | 143 | def find_data_files(): |
|
144 | 144 | """ |
|
145 | 145 | Find IPython's data_files. |
|
146 | 146 | """ |
|
147 | 147 | |
|
148 | 148 | # I can't find how to make distutils create a nested dir. structure, so |
|
149 | 149 | # in the meantime do it manually. Butt ugly. |
|
150 | 150 | # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain |
|
151 | 151 | # information on how to do this more cleanly once python 2.4 can be assumed. |
|
152 | 152 | # Thanks to Noel for the tip. |
|
153 | 153 | docdirbase = 'share/doc/ipython' |
|
154 | 154 | manpagebase = 'share/man/man1' |
|
155 | 155 | |
|
156 | 156 | # We only need to exclude from this things NOT already excluded in the |
|
157 | 157 | # MANIFEST.in file. |
|
158 | 158 | exclude = ('.sh','.1.gz') |
|
159 | 159 | # We need to figure out how we want to package all of our rst docs? |
|
160 | 160 | # docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('docs/*')) |
|
161 | # XXX - For now all the example files | |
|
161 | 162 | examfiles = filter(isfile, glob('docs/examples/core/*.py')) |
|
162 |
examfiles |
|
|
163 | examfiles += filter(isfile, glob('docs/examples/kernel/*.py')) | |
|
164 | ||
|
163 | 165 | manpages = filter(isfile, glob('docs/man/*.1.gz')) |
|
164 | 166 | igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*')) |
|
165 | 167 | |
|
166 | 168 | data_files = [#('data', docdirbase, docfiles), |
|
167 | 169 | ('data', pjoin(docdirbase, 'examples'),examfiles), |
|
168 | 170 | ('data', manpagebase, manpages), |
|
169 | 171 | ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), |
|
170 | 172 | ] |
|
171 | # import pprint | |
|
172 | # pprint.pprint(data_files) | |
|
173 | return [] | |
|
173 | ||
|
174 | ## import pprint # dbg | |
|
175 | ## print '*'*80 | |
|
176 | ## print 'data files' | |
|
177 | ## pprint.pprint(data_files) | |
|
178 | ## print '*'*80 | |
|
179 | ||
|
180 | return data_files | |
|
174 | 181 | |
|
175 | 182 | #--------------------------------------------------------------------------- |
|
176 | 183 | # Find scripts |
|
177 | 184 | #--------------------------------------------------------------------------- |
|
178 | 185 | |
|
179 | 186 | def find_scripts(): |
|
180 | 187 | """ |
|
181 | 188 | Find IPython's scripts. |
|
182 | 189 | """ |
|
183 | 190 | scripts = [] |
|
184 | 191 | scripts.append('IPython/kernel/scripts/ipengine') |
|
185 | 192 | scripts.append('IPython/kernel/scripts/ipcontroller') |
|
186 | 193 | scripts.append('IPython/kernel/scripts/ipcluster') |
|
187 | 194 | scripts.append('scripts/ipython') |
|
188 | 195 | scripts.append('scripts/ipythonx') |
|
189 | 196 | scripts.append('scripts/pycolor') |
|
190 | 197 | scripts.append('scripts/irunner') |
|
191 | 198 | |
|
192 | 199 | # Script to be run by the windows binary installer after the default setup |
|
193 | 200 | # routine, to add shortcuts and similar windows-only things. Windows |
|
194 | 201 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils |
|
195 | 202 | # doesn't find them. |
|
196 | 203 | if 'bdist_wininst' in sys.argv: |
|
197 | 204 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): |
|
198 | 205 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." |
|
199 | 206 | sys.exit(1) |
|
200 | 207 | scripts.append('scripts/ipython_win_post_install.py') |
|
201 | 208 | |
|
202 | 209 | return scripts |
|
203 | 210 | |
|
204 | 211 | #--------------------------------------------------------------------------- |
|
205 | 212 | # Find scripts |
|
206 | 213 | #--------------------------------------------------------------------------- |
|
207 | 214 | |
|
208 | 215 | def check_for_dependencies(): |
|
209 | 216 | """Check for IPython's dependencies. |
|
210 | 217 | |
|
211 | 218 | This function should NOT be called if running under setuptools! |
|
212 | 219 | """ |
|
213 | 220 | from setupext.setupext import ( |
|
214 | 221 | print_line, print_raw, print_status, print_message, |
|
215 | 222 | check_for_zopeinterface, check_for_twisted, |
|
216 | 223 | check_for_foolscap, check_for_pyopenssl, |
|
217 | 224 | check_for_sphinx, check_for_pygments, |
|
218 | 225 | check_for_nose, check_for_pexpect |
|
219 | 226 | ) |
|
220 | 227 | print_line() |
|
221 | 228 | print_raw("BUILDING IPYTHON") |
|
222 | 229 | print_status('python', sys.version) |
|
223 | 230 | print_status('platform', sys.platform) |
|
224 | 231 | if sys.platform == 'win32': |
|
225 | 232 | print_status('Windows version', sys.getwindowsversion()) |
|
226 | 233 | |
|
227 | 234 | print_raw("") |
|
228 | 235 | print_raw("OPTIONAL DEPENDENCIES") |
|
229 | 236 | |
|
230 | 237 | check_for_zopeinterface() |
|
231 | 238 | check_for_twisted() |
|
232 | 239 | check_for_foolscap() |
|
233 | 240 | check_for_pyopenssl() |
|
234 | 241 | check_for_sphinx() |
|
235 | 242 | check_for_pygments() |
|
236 | 243 | check_for_nose() |
|
237 | 244 | check_for_pexpect() |
General Comments 0
You need to be logged in to leave comments.
Login now