##// 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 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 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 104 # ('doc/manual/ipython.pdf',
105 105 # ['IPython/Release.py','doc/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 '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 139 setup_args["extras_require"] = dict(
139 140 kernel = [
140 141 "zope.interface>=3.4.1",
141 142 "Twisted>=8.0.1",
142 143 "foolscap>=0.2.6"
143 144 ],
144 145 doc=['Sphinx>=0.3','pygments'],
145 146 test='nose>=0.10.1',
146 147 security=["pyOpenSSL>=0.6"]
147 148 )
148 149 # Allow setuptools to handle the scripts
149 150 scripts = []
150 151 # eggs will lack docs, examples
151 152 data_files = []
152 153 else:
153 154 # package_data of setuptools was introduced to distutils in 2.4
154 155 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
155 156 if sys.version_info < (2,4):
156 157 data_files.append(('lib', 'IPython/UserConfig', cfgfiles))
157 158 # If we are running without setuptools, call this function which will
158 159 # check for dependencies an inform the user what is needed. This is
159 160 # just to make life easy for users.
160 161 check_for_dependencies()
161 162
162 163
163 164 #---------------------------------------------------------------------------
164 165 # Do the actual setup now
165 166 #---------------------------------------------------------------------------
166 167
167 168 setup_args['packages'] = packages
168 169 setup_args['package_data'] = package_data
169 170 setup_args['scripts'] = scripts
170 171 setup_args['data_files'] = data_files
171 172 setup_args.update(setuptools_extra_args)
172 173
173 174 if __name__ == '__main__':
174 175 setup(**setup_args)
General Comments 0
You need to be logged in to leave comments. Login now