##// END OF EJS Templates
Add entry point for ipythonx to setup.py, when used with setuptools.
gvaroquaux -
Show More
@@ -1,174 +1,175 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 #('doc/magic.tex',
78 #('doc/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 ('doc/ipython.1.gz',
82 ('doc/ipython.1.gz',
83 ['doc/ipython.1'],
83 ['doc/ipython.1'],
84 "cd doc && gzip -9c ipython.1 > ipython.1.gz"),
84 "cd doc && gzip -9c ipython.1 > ipython.1.gz"),
85
85
86 ('doc/pycolor.1.gz',
86 ('doc/pycolor.1.gz',
87 ['doc/pycolor.1'],
87 ['doc/pycolor.1'],
88 "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"),
88 "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"),
89 ]
89 ]
90
90
91 # Only build the docs is sphinx is present
91 # Only build the docs is sphinx is present
92 try:
92 try:
93 import sphinx
93 import sphinx
94 except ImportError:
94 except ImportError:
95 pass
95 pass
96 else:
96 else:
97 pass
97 pass
98 # BEG: This is disabled as I am not sure what to depend on.
98 # BEG: This is disabled as I am not sure what to depend on.
99 # I actually don't think we should be automatically building
99 # I actually don't think we should be automatically building
100 # the docs for people.
100 # the docs for people.
101 # The do_sphinx scripts builds html and pdf, so just one
101 # The do_sphinx scripts builds html and pdf, so just one
102 # target is enough to cover all manual generation
102 # target is enough to cover all manual generation
103 # to_update.append(
103 # to_update.append(
104 # ('doc/manual/ipython.pdf',
104 # ('doc/manual/ipython.pdf',
105 # ['IPython/Release.py','doc/source/ipython.rst'],
105 # ['IPython/Release.py','doc/source/ipython.rst'],
106 # "cd docs && python do_sphinx.py")
106 # "cd docs && python do_sphinx.py")
107 # )
107 # )
108 [ target_update(*t) for t in to_update ]
108 [ target_update(*t) for t in to_update ]
109
109
110 #---------------------------------------------------------------------------
110 #---------------------------------------------------------------------------
111 # Find all the packages, package data, scripts and data_files
111 # Find all the packages, package data, scripts and data_files
112 #---------------------------------------------------------------------------
112 #---------------------------------------------------------------------------
113
113
114 packages = find_packages()
114 packages = find_packages()
115 package_data = find_package_data()
115 package_data = find_package_data()
116 scripts = find_scripts()
116 scripts = find_scripts()
117 data_files = find_data_files()
117 data_files = find_data_files()
118
118
119 #---------------------------------------------------------------------------
119 #---------------------------------------------------------------------------
120 # Handle dependencies and setuptools specific things
120 # Handle dependencies and setuptools specific things
121 #---------------------------------------------------------------------------
121 #---------------------------------------------------------------------------
122
122
123 # This dict is used for passing extra arguments that are setuptools
123 # This dict is used for passing extra arguments that are setuptools
124 # specific to setup
124 # specific to setup
125 setuptools_extra_args = {}
125 setuptools_extra_args = {}
126
126
127 if 'setuptools' in sys.modules:
127 if 'setuptools' in sys.modules:
128 setuptools_extra_args['zip_safe'] = False
128 setuptools_extra_args['zip_safe'] = False
129 setuptools_extra_args['entry_points'] = {
129 setuptools_extra_args['entry_points'] = {
130 'console_scripts': [
130 'console_scripts': [
131 'ipython = IPython.ipapi:launch_new_instance',
131 'ipython = IPython.ipapi:launch_new_instance',
132 'pycolor = IPython.PyColorize:main',
132 'pycolor = IPython.PyColorize:main',
133 'ipcontroller = IPython.kernel.scripts.ipcontroller:main',
133 'ipcontroller = IPython.kernel.scripts.ipcontroller:main',
134 'ipengine = IPython.kernel.scripts.ipengine:main',
134 'ipengine = IPython.kernel.scripts.ipengine:main',
135 'ipcluster = IPython.kernel.scripts.ipcluster:main'
135 'ipcluster = IPython.kernel.scripts.ipcluster:main',
136 'ipythonx = IPython.frontend.wx.ipythonx:main'
136 ]
137 ]
137 }
138 }
138 setup_args["extras_require"] = dict(
139 setup_args["extras_require"] = dict(
139 kernel = [
140 kernel = [
140 "zope.interface>=3.4.1",
141 "zope.interface>=3.4.1",
141 "Twisted>=8.0.1",
142 "Twisted>=8.0.1",
142 "foolscap>=0.2.6"
143 "foolscap>=0.2.6"
143 ],
144 ],
144 doc=['Sphinx>=0.3','pygments'],
145 doc=['Sphinx>=0.3','pygments'],
145 test='nose>=0.10.1',
146 test='nose>=0.10.1',
146 security=["pyOpenSSL>=0.6"]
147 security=["pyOpenSSL>=0.6"]
147 )
148 )
148 # Allow setuptools to handle the scripts
149 # Allow setuptools to handle the scripts
149 scripts = []
150 scripts = []
150 # eggs will lack docs, examples
151 # eggs will lack docs, examples
151 data_files = []
152 data_files = []
152 else:
153 else:
153 # package_data of setuptools was introduced to distutils in 2.4
154 # package_data of setuptools was introduced to distutils in 2.4
154 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
155 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
155 if sys.version_info < (2,4):
156 if sys.version_info < (2,4):
156 data_files.append(('lib', 'IPython/UserConfig', cfgfiles))
157 data_files.append(('lib', 'IPython/UserConfig', cfgfiles))
157 # If we are running without setuptools, call this function which will
158 # If we are running without setuptools, call this function which will
158 # check for dependencies an inform the user what is needed. This is
159 # check for dependencies an inform the user what is needed. This is
159 # just to make life easy for users.
160 # just to make life easy for users.
160 check_for_dependencies()
161 check_for_dependencies()
161
162
162
163
163 #---------------------------------------------------------------------------
164 #---------------------------------------------------------------------------
164 # Do the actual setup now
165 # Do the actual setup now
165 #---------------------------------------------------------------------------
166 #---------------------------------------------------------------------------
166
167
167 setup_args['packages'] = packages
168 setup_args['packages'] = packages
168 setup_args['package_data'] = package_data
169 setup_args['package_data'] = package_data
169 setup_args['scripts'] = scripts
170 setup_args['scripts'] = scripts
170 setup_args['data_files'] = data_files
171 setup_args['data_files'] = data_files
171 setup_args.update(setuptools_extra_args)
172 setup_args.update(setuptools_extra_args)
172
173
173 if __name__ == '__main__':
174 if __name__ == '__main__':
174 setup(**setup_args)
175 setup(**setup_args)
General Comments 0
You need to be logged in to leave comments. Login now