##// END OF EJS Templates
Fixing the setup.py script under setuptools and the __init__.py script.
Brian Granger -
Show More
@@ -1,72 +1,72 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 IPython -- An enhanced Interactive Python
4 4
5 5 One of Python's nicest features is its interactive interpreter. This allows
6 6 very fast testing of ideas without the overhead of creating test files as is
7 7 typical in most programming languages. However, the interpreter supplied with
8 8 the standard Python distribution is fairly primitive (and IDLE isn't really
9 9 much better).
10 10
11 11 IPython tries to:
12 12
13 13 i - provide an efficient environment for interactive work in Python
14 14 programming. It tries to address what we see as shortcomings of the standard
15 15 Python prompt, and adds many features to make interactive work much more
16 16 efficient.
17 17
18 18 ii - offer a flexible framework so that it can be used as the base
19 19 environment for other projects and problems where Python can be the
20 20 underlying language. Specifically scientific environments like Mathematica,
21 21 IDL and Mathcad inspired its design, but similar ideas can be useful in many
22 22 fields. Python is a fabulous language for implementing this kind of system
23 23 (due to its dynamic and introspective features), and with suitable libraries
24 24 entire systems could be built leveraging Python's power.
25 25
26 26 iii - serve as an embeddable, ready to go interpreter for your own programs.
27 27
28 28 IPython requires Python 2.4 or newer.
29 29 """
30 30
31 31 #*****************************************************************************
32 32 # Copyright (C) 2008-2009 The IPython Development Team
33 33 # Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu>
34 34 #
35 35 # Distributed under the terms of the BSD License. The full license is in
36 36 # the file COPYING, distributed as part of this software.
37 37 #*****************************************************************************
38 38
39 39 # Enforce proper version requirements
40 40 import sys
41 41
42 42 if sys.version[0:3] < '2.4':
43 43 raise ImportError('Python Version 2.4 or above is required for IPython.')
44 44
45 45 # Make it easy to import extensions - they are always directly on pythonpath.
46 46 # Therefore, non-IPython modules can be added to Extensions directory
47 47 import os
48 48 sys.path.append(os.path.dirname(__file__) + "/Extensions")
49 49
50 50 # Define what gets imported with a 'from IPython import *'
51 __all__ = ['ipapi','generics','ipstruct','Release','Shell']
51 __all__ = ['IPython.core.ipapi','utils.generics','utils.ipstruct','Release','Shell']
52 52
53 53 # Load __all__ in IPython namespace so that a simple 'import IPython' gives
54 54 # access to them via IPython.<name>
55 55 glob,loc = globals(),locals()
56 56 for name in __all__:
57 57 #print 'Importing: ',name # dbg
58 58 __import__(name,glob,loc,[])
59 59
60 60 import Shell
61 61
62 62 # Release data
63 63 from IPython import Release # do it explicitly so pydoc can see it - pydoc bug
64 64 __author__ = '%s <%s>\n%s <%s>\n%s <%s>' % \
65 65 ( Release.authors['Fernando'] + Release.authors['Janko'] + \
66 66 Release.authors['Nathan'] )
67 67 __license__ = Release.license
68 68 __version__ = Release.version
69 69 __revision__ = Release.revision
70 70
71 71 # Namespace cleanup
72 72 del name,glob,loc
@@ -1,189 +1,189 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 from IPython.genutils import target_update
33 from IPython.utils.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 #('docs/magic.tex',
79 79 #['IPython/Magic.py'],
80 80 #"cd doc && ./update_magic.sh" ),
81 81
82 82 ('docs/man/ipython.1.gz',
83 83 ['docs/man/ipython.1'],
84 84 "cd docs/man && gzip -9c ipython.1 > ipython.1.gz"),
85 85
86 86 ('docs/man/pycolor.1.gz',
87 87 ['docs/man/pycolor.1'],
88 88 "cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz"),
89 89 ]
90 90
91 91 # Only build the docs if sphinx is present
92 92 try:
93 93 import sphinx
94 94 except ImportError:
95 95 pass
96 96 else:
97 97 # The Makefile calls the do_sphinx scripts to build html and pdf, so
98 98 # just one target is enough to cover all manual generation
99 99
100 100 # First, compute all the dependencies that can force us to rebuild the
101 101 # docs. Start with the main release file that contains metadata
102 102 docdeps = ['IPython/Release.py']
103 103 # Inculde all the reST sources
104 104 pjoin = os.path.join
105 105 for dirpath,dirnames,filenames in os.walk('docs/source'):
106 106 if dirpath in ['_static','_templates']:
107 107 continue
108 108 docdeps += [ pjoin(dirpath,f) for f in filenames
109 109 if f.endswith('.txt') ]
110 110 # and the examples
111 111 for dirpath,dirnames,filenames in os.walk('docs/example'):
112 112 docdeps += [ pjoin(dirpath,f) for f in filenames
113 113 if not f.endswith('~') ]
114 114 # then, make them all dependencies for the main PDF (the html will get
115 115 # auto-generated as well).
116 116 to_update.append(
117 117 ('docs/dist/ipython.pdf',
118 118 docdeps,
119 119 "cd docs && make dist")
120 120 )
121 121
122 122 [ target_update(*t) for t in to_update ]
123 123
124 124
125 125 #---------------------------------------------------------------------------
126 126 # Find all the packages, package data, scripts and data_files
127 127 #---------------------------------------------------------------------------
128 128
129 129 packages = find_packages()
130 130 package_data = find_package_data()
131 131 scripts = find_scripts()
132 132 data_files = find_data_files()
133 133
134 134 #---------------------------------------------------------------------------
135 135 # Handle dependencies and setuptools specific things
136 136 #---------------------------------------------------------------------------
137 137
138 138 # This dict is used for passing extra arguments that are setuptools
139 139 # specific to setup
140 140 setuptools_extra_args = {}
141 141
142 142 if 'setuptools' in sys.modules:
143 143 setuptools_extra_args['zip_safe'] = False
144 144 setuptools_extra_args['entry_points'] = {
145 145 'console_scripts': [
146 'ipython = IPython.ipapi:launch_new_instance',
146 'ipython = IPython.core.ipapi:launch_new_instance',
147 147 'pycolor = IPython.PyColorize:main',
148 148 'ipcontroller = IPython.kernel.scripts.ipcontroller:main',
149 149 'ipengine = IPython.kernel.scripts.ipengine:main',
150 150 'ipcluster = IPython.kernel.scripts.ipcluster:main',
151 151 'ipythonx = IPython.frontend.wx.ipythonx:main',
152 152 'iptest = IPython.testing.iptest:main',
153 153 ]
154 154 }
155 155 setup_args['extras_require'] = dict(
156 156 kernel = [
157 157 'zope.interface>=3.4.1',
158 158 'Twisted>=8.0.1',
159 159 'foolscap>=0.2.6'
160 160 ],
161 161 doc='Sphinx>=0.3',
162 162 test='nose>=0.10.1',
163 163 security='pyOpenSSL>=0.6'
164 164 )
165 165 # Allow setuptools to handle the scripts
166 166 scripts = []
167 167 else:
168 168 # package_data of setuptools was introduced to distutils in 2.4
169 169 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
170 170 if sys.version_info < (2,4):
171 171 data_files.append(('lib', 'IPython/UserConfig', cfgfiles))
172 172 # If we are running without setuptools, call this function which will
173 173 # check for dependencies an inform the user what is needed. This is
174 174 # just to make life easy for users.
175 175 check_for_dependencies()
176 176
177 177
178 178 #---------------------------------------------------------------------------
179 179 # Do the actual setup now
180 180 #---------------------------------------------------------------------------
181 181
182 182 setup_args['packages'] = packages
183 183 setup_args['package_data'] = package_data
184 184 setup_args['scripts'] = scripts
185 185 setup_args['data_files'] = data_files
186 186 setup_args.update(setuptools_extra_args)
187 187
188 188 if __name__ == '__main__':
189 189 setup(**setup_args)
General Comments 0
You need to be logged in to leave comments. Login now