##// END OF EJS Templates
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
Brian E Granger -
Show More
@@ -0,0 +1,201 b''
1 # encoding: utf-8
2
3 __docformat__ = "restructuredtext en"
4
5 #-------------------------------------------------------------------------------
6 # Copyright (C) 2008 The IPython Development Team
7 #
8 # Distributed under the terms of the BSD License. The full license is in
9 # the file COPYING, distributed as part of this software.
10 #-------------------------------------------------------------------------------
11
12 #-------------------------------------------------------------------------------
13 # Imports
14 #-------------------------------------------------------------------------------
15
16 import os, sys
17
18 from glob import glob
19
20 from setupext import install_data_ext
21
22 #-------------------------------------------------------------------------------
23 # Useful globals and utility functions
24 #-------------------------------------------------------------------------------
25
26 # A few handy globals
27 isfile = os.path.isfile
28 pjoin = os.path.join
29
30 def oscmd(s):
31 print ">", s
32 os.system(s)
33
34 # A little utility we'll need below, since glob() does NOT allow you to do
35 # exclusion on multiple endings!
36 def file_doesnt_endwith(test,endings):
37 """Return true if test is a file and its name does NOT end with any
38 of the strings listed in endings."""
39 if not isfile(test):
40 return False
41 for e in endings:
42 if test.endswith(e):
43 return False
44 return True
45
46 #---------------------------------------------------------------------------
47 # Basic project information
48 #---------------------------------------------------------------------------
49
50 # Release.py contains version, authors, license, url, keywords, etc.
51 execfile(pjoin('IPython','Release.py'))
52
53 # Create a dict with the basic information
54 # This dict is eventually passed to setup after additional keys are added.
55 setup_args = dict(
56 name = name,
57 version = version,
58 description = description,
59 long_description = long_description,
60 author = author,
61 author_email = author_email,
62 url = url,
63 download_url = download_url,
64 license = license,
65 platforms = platforms,
66 keywords = keywords,
67 cmdclass = {'install_data': install_data_ext},
68 )
69
70
71 #---------------------------------------------------------------------------
72 # Find packages
73 #---------------------------------------------------------------------------
74
75 def add_package(packages, pname, config=False, tests=False, scripts=False, others=None):
76 packages.append('.'.join(['ipython1',pname]))
77 if config:
78 packages.append('.'.join(['ipython1',pname,'config']))
79 if tests:
80 packages.append('.'.join(['ipython1',pname,'tests']))
81 if scripts:
82 packages.append('.'.join(['ipython1',pname,'scripts']))
83 if others is not None:
84 for o in others:
85 packages.append('.'.join(['ipython1',pname,o]))
86
87 def find_packages():
88 packages = ['ipython']
89 add_package(packages, 'config', tests=True)
90 add_package(packages , 'Extensions')
91 add_package(packages, 'external')
92 add_package(packages, 'gui')
93 add_package(packages, 'gui.wx')
94 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
95 add_package(packages, 'kernel.core', config=True, tests=True)
96 add_package(packages, 'testing', tests=True)
97 add_package(packages, 'tools', tests=True)
98 add_package(packages, 'UserConfig')
99 return packages
100
101 #---------------------------------------------------------------------------
102 # Find package data
103 #---------------------------------------------------------------------------
104
105 def find_package_data():
106 # This is not enough for these things to appear in an sdist.
107 # We need to muck with the MANIFEST to get this to work
108 package_data = {'IPython.UserConfig' : ['*'] }
109 return package_data
110
111
112 #---------------------------------------------------------------------------
113 # Find data files
114 #---------------------------------------------------------------------------
115
116 def find_data_files():
117
118 # I can't find how to make distutils create a nested dir. structure, so
119 # in the meantime do it manually. Butt ugly.
120 # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain
121 # information on how to do this more cleanly once python 2.4 can be assumed.
122 # Thanks to Noel for the tip.
123 docdirbase = 'share/doc/ipython'
124 manpagebase = 'share/man/man1'
125
126 # We only need to exclude from this things NOT already excluded in the
127 # MANIFEST.in file.
128 exclude = ('.sh','.1.gz')
129 docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*'))
130 examfiles = filter(isfile, glob('doc/examples/*.py'))
131 manfiles = filter(isfile, glob('doc/manual/*'))
132 manstatic = filter(isfile, glob('doc/manual/_static/*'))
133 manpages = filter(isfile, glob('doc/*.1.gz'))
134 scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor',
135 'scripts/irunner'])
136 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
137
138 data_files = [('data', docdirbase, docfiles),
139 ('data', pjoin(docdirbase, 'examples'),examfiles),
140 ('data', pjoin(docdirbase, 'manual'),manfiles),
141 ('data', pjoin(docdirbase, 'manual/_static'),manstatic),
142 ('data', manpagebase, manpages),
143 ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles),
144 ]
145 return data_files
146
147 #---------------------------------------------------------------------------
148 # Find scripts
149 #---------------------------------------------------------------------------
150
151 def find_scripts():
152 scripts = []
153 scripts.append('ipython1/kernel/scripts/ipengine')
154 scripts.append('ipython1/kernel/scripts/ipcontroller')
155 scripts.append('ipython1/kernel/scripts/ipcluster')
156 scripts.append('scripts/ipython')
157 scripts.append('scripts/pycolor')
158 scripts.append('scripts/irunner')
159
160 # Script to be run by the windows binary installer after the default setup
161 # routine, to add shortcuts and similar windows-only things. Windows
162 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
163 # doesn't find them.
164 if 'bdist_wininst' in sys.argv:
165 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
166 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
167 sys.exit(1)
168 scripts.append('scripts/ipython_win_post_install.py')
169
170 return scripts
171
172 #---------------------------------------------------------------------------
173 # Find scripts
174 #---------------------------------------------------------------------------
175
176 def check_for_dependencies():
177 from setupext.setupext import (
178 print_line, print_raw, print_status, print_message,
179 check_for_zopeinterface, check_for_twisted,
180 check_for_foolscap, check_for_pyopenssl,
181 check_for_sphinx, check_for_pygments,
182 check_for_nose, check_for_pexpect
183 )
184 print_line()
185 print_raw("BUILDING IPYTHON")
186 print_status('python', sys.version)
187 print_status('platform', sys.platform)
188 if sys.platform == 'win32':
189 print_status('Windows version', sys.getwindowsversion())
190
191 print_raw("")
192 print_raw("OPTIONAL DEPENDENCIES")
193
194 check_for_zopeinterface()
195 check_for_twisted()
196 check_for_foolscap()
197 check_for_pyopenssl()
198 check_for_sphinx()
199 check_for_pygments()
200 check_for_nose()
201 check_for_pexpect() No newline at end of file
@@ -0,0 +1,177 b''
1 # encoding: utf-8
2
3 __docformat__ = "restructuredtext en"
4
5 #-------------------------------------------------------------------------------
6 # Copyright (C) 2008 The IPython Development Team
7 #
8 # Distributed under the terms of the BSD License. The full license is in
9 # the file COPYING, distributed as part of this software.
10 #-------------------------------------------------------------------------------
11
12 #-------------------------------------------------------------------------------
13 # Imports
14 #-------------------------------------------------------------------------------
15
16 import sys, os
17 from textwrap import fill
18
19 display_status=True
20
21 if display_status:
22 def print_line(char='='):
23 print char * 76
24
25 def print_status(package, status):
26 initial_indent = "%22s: " % package
27 indent = ' ' * 24
28 print fill(str(status), width=76,
29 initial_indent=initial_indent,
30 subsequent_indent=indent)
31
32 def print_message(message):
33 indent = ' ' * 24 + "* "
34 print fill(str(message), width=76,
35 initial_indent=indent,
36 subsequent_indent=indent)
37
38 def print_raw(section):
39 print section
40 else:
41 def print_line(*args, **kwargs):
42 pass
43 print_status = print_message = print_raw = print_line
44
45 #-------------------------------------------------------------------------------
46 # Tests for specific packages
47 #-------------------------------------------------------------------------------
48
49 def check_for_ipython():
50 try:
51 import IPython
52 except ImportError:
53 print_status("IPython", "Not found")
54 return False
55 else:
56 print_status("IPython", IPython.__version__)
57 return True
58
59 def check_for_zopeinterface():
60 try:
61 import zope.interface
62 except ImportError:
63 print_status("zope.Interface", "Not found (required for parallel computing capabilities)")
64 return False
65 else:
66 print_status("Zope.Interface","yes")
67 return True
68
69 def check_for_twisted():
70 try:
71 import twisted
72 except ImportError:
73 print_status("Twisted", "Not found (required for parallel computing capabilities)")
74 return False
75 else:
76 major = twisted.version.major
77 minor = twisted.version.minor
78 micro = twisted.version.micro
79 if not ((major==2 and minor>=5 and micro>=0) or \
80 major>=8):
81 print_message("WARNING: IPython requires Twisted 2.5.0 or greater, you have version %s"%twisted.version.short())
82 return False
83 else:
84 print_status("Twisted", twisted.version.short())
85 return True
86
87 def check_for_foolscap():
88 try:
89 import foolscap
90 except ImportError:
91 print_status('Foolscap', "Not found (required for parallel computing capabilities)")
92 return False
93 else:
94 print_status('Foolscap', foolscap.__version__)
95 return True
96
97 def check_for_pyopenssl():
98 try:
99 import OpenSSL
100 except ImportError:
101 print_status('OpenSSL', "Not found (required if you want security in the parallel computing capabilities)")
102 return False
103 else:
104 print_status('OpenSSL', OpenSSL.__version__)
105 return True
106
107 def check_for_sphinx():
108 try:
109 import sphinx
110 except ImportError:
111 print_status('sphinx', "Not found (required for building the IPtyhon documentation)")
112 return False
113 else:
114 print_status('sphinx', sphinx.__version__)
115 return True
116
117 def check_for_pygments():
118 try:
119 import pygments
120 except ImportError:
121 print_status('pygments', "Not found (required for syntax highlighting of code in the IPtyhon documentation)")
122 return False
123 else:
124 print_status('pygments', pygments.__version__)
125 return True
126
127 def check_for_nose():
128 try:
129 import nose
130 except ImportError:
131 print_status('nose', "Not found (required for running the IPython test suite)")
132 return False
133 else:
134 print_status('nose', nose.__version__)
135 return True
136
137 def check_for_pexpect():
138 try:
139 import pexpect
140 except ImportError:
141 print_status("pexpect", "no (required for running standalone doctests)")
142 return False
143 else:
144 print_status("pexpect", pexpect.__version__)
145 return True
146
147 def check_for_httplib2():
148 try:
149 import httplib2
150 except ImportError:
151 print_status("httplib2", "no (required for blocking http clients)")
152 return False
153 else:
154 print_status("httplib2","yes")
155 return True
156
157 def check_for_sqlalchemy():
158 try:
159 import sqlalchemy
160 except ImportError:
161 print_status("sqlalchemy", "no (required for the ipython1 notebook)")
162 return False
163 else:
164 print_status("sqlalchemy","yes")
165 return True
166
167 def check_for_simplejson():
168 try:
169 import simplejson
170 except ImportError:
171 print_status("simplejson", "no (required for the ipython1 notebook)")
172 return False
173 else:
174 print_status("simplejson","yes")
175 return True
176
177 No newline at end of file
@@ -32,7 +32,7 b' else:'
32
32
33 version = '0.8.4'
33 version = '0.8.4'
34
34
35 description = "An enhanced interactive Python shell."
35 description = "Tools for interactive development in Python."
36
36
37 long_description = \
37 long_description = \
38 """
38 """
@@ -77,13 +77,19 b" license = 'BSD'"
77 authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'),
77 authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'),
78 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
78 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
79 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu'),
79 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu'),
80 'Ville' : ('Ville Vainio','vivainio@gmail.com')
80 'Ville' : ('Ville Vainio','vivainio@gmail.com'),
81 'Brian' : ('Brian E Granger', 'ellisonbg@gmail.com'),
82 'Min' : ('Min Ragan-Kelley', 'benjaminrk@gmail.com')
81 }
83 }
82
84
85 author = 'The IPython Development Team'
86
87 author_email = 'ipython-dev@scipy.org'
88
83 url = 'http://ipython.scipy.org'
89 url = 'http://ipython.scipy.org'
84
90
85 download_url = 'http://ipython.scipy.org/dist'
91 download_url = 'http://ipython.scipy.org/dist'
86
92
87 platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME']
93 platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME']
88
94
89 keywords = ['Interactive','Interpreter','Shell']
95 keywords = ['Interactive','Interpreter','Shell','Parallel','Distributed']
@@ -28,7 +28,7 b' import zope.interface as zi'
28
28
29 from IPython.kernel import engineservice as es
29 from IPython.kernel import engineservice as es
30 from IPython.kernel import error
30 from IPython.kernel import error
31 from IPython.testutils.util import DeferredTestCase
31 from IPython.testing.util import DeferredTestCase
32 from IPython.kernel.controllerservice import \
32 from IPython.kernel.controllerservice import \
33 IControllerCore
33 IControllerCore
34
34
@@ -27,7 +27,7 b' from IPython.kernel import error'
27 from IPython.kernel.pickleutil import can, uncan
27 from IPython.kernel.pickleutil import can, uncan
28 import IPython.kernel.engineservice as es
28 import IPython.kernel.engineservice as es
29 from IPython.kernel.core.interpreter import Interpreter
29 from IPython.kernel.core.interpreter import Interpreter
30 from IPython.testutils.parametric import Parametric, parametric
30 from IPython.testing.parametric import Parametric, parametric
31
31
32 #-------------------------------------------------------------------------------
32 #-------------------------------------------------------------------------------
33 # Tests
33 # Tests
@@ -21,8 +21,8 b' from IPython.kernel import engineservice as es'
21 from IPython.kernel import multiengine as me
21 from IPython.kernel import multiengine as me
22 from IPython.kernel import newserialized
22 from IPython.kernel import newserialized
23 from IPython.kernel.error import NotDefined
23 from IPython.kernel.error import NotDefined
24 from IPython.testutils import util
24 from IPython.testing import util
25 from IPython.testutils.parametric import parametric, Parametric
25 from IPython.testing.parametric import parametric, Parametric
26 from IPython.kernel import newserialized
26 from IPython.kernel import newserialized
27 from IPython.kernel.util import printer
27 from IPython.kernel.util import printer
28 from IPython.kernel.error import (InvalidEngineID,
28 from IPython.kernel.error import (InvalidEngineID,
@@ -27,7 +27,7 b' from twisted.application.service import IService'
27 from IPython.kernel.controllerservice import ControllerService
27 from IPython.kernel.controllerservice import ControllerService
28 from IPython.kernel.tests import multienginetest as met
28 from IPython.kernel.tests import multienginetest as met
29 from controllertest import IControllerCoreTestCase
29 from controllertest import IControllerCoreTestCase
30 from IPython.testutils.util import DeferredTestCase
30 from IPython.testing.util import DeferredTestCase
31
31
32 class BasicControllerServiceTest(DeferredTestCase,
32 class BasicControllerServiceTest(DeferredTestCase,
33 IControllerCoreTestCase):
33 IControllerCoreTestCase):
@@ -26,7 +26,7 b' import zope.interface as zi'
26
26
27 from IPython.kernel.fcutil import Tub, UnauthenticatedTub
27 from IPython.kernel.fcutil import Tub, UnauthenticatedTub
28 from IPython.kernel import engineservice as es
28 from IPython.kernel import engineservice as es
29 from IPython.testutils.util import DeferredTestCase
29 from IPython.testing.util import DeferredTestCase
30 from IPython.kernel.controllerservice import IControllerBase
30 from IPython.kernel.controllerservice import IControllerBase
31 from IPython.kernel.enginefc import FCRemoteEngineRefFromService, IEngineBase
31 from IPython.kernel.enginefc import FCRemoteEngineRefFromService, IEngineBase
32 from IPython.kernel.engineservice import IEngineQueued
32 from IPython.kernel.engineservice import IEngineQueued
@@ -27,7 +27,7 b' from twisted.internet import defer'
27 from twisted.application.service import IService
27 from twisted.application.service import IService
28
28
29 from IPython.kernel import engineservice as es
29 from IPython.kernel import engineservice as es
30 from IPython.testutils.util import DeferredTestCase
30 from IPython.testing.util import DeferredTestCase
31 from IPython.kernel.tests.engineservicetest import \
31 from IPython.kernel.tests.engineservicetest import \
32 IEngineCoreTestCase, \
32 IEngineCoreTestCase, \
33 IEngineSerializedTestCase, \
33 IEngineSerializedTestCase, \
@@ -16,7 +16,7 b' __docformat__ = "restructuredtext en"'
16 #-------------------------------------------------------------------------------
16 #-------------------------------------------------------------------------------
17
17
18 from twisted.internet import defer
18 from twisted.internet import defer
19 from IPython.testutils.util import DeferredTestCase
19 from IPython.testing.util import DeferredTestCase
20 from IPython.kernel.controllerservice import ControllerService
20 from IPython.kernel.controllerservice import ControllerService
21 from IPython.kernel import multiengine as me
21 from IPython.kernel import multiengine as me
22 from IPython.kernel.tests.multienginetest import (IMultiEngineTestCase,
22 from IPython.kernel.tests.multienginetest import (IMultiEngineTestCase,
@@ -18,7 +18,7 b' from twisted.internet import defer, reactor'
18
18
19 from IPython.kernel.fcutil import Tub, UnauthenticatedTub
19 from IPython.kernel.fcutil import Tub, UnauthenticatedTub
20
20
21 from IPython.testutils.util import DeferredTestCase
21 from IPython.testing.util import DeferredTestCase
22 from IPython.kernel.controllerservice import ControllerService
22 from IPython.kernel.controllerservice import ControllerService
23 from IPython.kernel.multiengine import IMultiEngine
23 from IPython.kernel.multiengine import IMultiEngine
24 from IPython.kernel.tests.multienginetest import IFullSynchronousMultiEngineTestCase
24 from IPython.kernel.tests.multienginetest import IFullSynchronousMultiEngineTestCase
@@ -17,7 +17,7 b' __docformat__ = "restructuredtext en"'
17
17
18 import zope.interface as zi
18 import zope.interface as zi
19 from twisted.trial import unittest
19 from twisted.trial import unittest
20 from IPython.testutils.util import DeferredTestCase
20 from IPython.testing.util import DeferredTestCase
21
21
22 from IPython.kernel.newserialized import \
22 from IPython.kernel.newserialized import \
23 ISerialized, \
23 ISerialized, \
@@ -19,9 +19,9 b' __docformat__ = "restructuredtext en"'
19 from twisted.internet import defer
19 from twisted.internet import defer
20 from twisted.python import failure
20 from twisted.python import failure
21
21
22 from IPython.testutils import tcommon
22 from IPython.testing import tcommon
23 from IPython.testutils.tcommon import *
23 from IPython.testing.tcommon import *
24 from IPython.testutils.util import DeferredTestCase
24 from IPython.testing.util import DeferredTestCase
25 import IPython.kernel.pendingdeferred as pd
25 import IPython.kernel.pendingdeferred as pd
26 from IPython.kernel import error
26 from IPython.kernel import error
27 from IPython.kernel.util import printer
27 from IPython.kernel.util import printer
@@ -22,7 +22,7 b' from twisted.trial import unittest'
22
22
23 from IPython.kernel import task, controllerservice as cs, engineservice as es
23 from IPython.kernel import task, controllerservice as cs, engineservice as es
24 from IPython.kernel.multiengine import IMultiEngine
24 from IPython.kernel.multiengine import IMultiEngine
25 from IPython.testutils.util import DeferredTestCase
25 from IPython.testing.util import DeferredTestCase
26 from IPython.kernel.tests.tasktest import ITaskControllerTestCase
26 from IPython.kernel.tests.tasktest import ITaskControllerTestCase
27
27
28 #-------------------------------------------------------------------------------
28 #-------------------------------------------------------------------------------
@@ -23,7 +23,7 b' from IPython.kernel.fcutil import Tub, UnauthenticatedTub'
23 from IPython.kernel import task as taskmodule
23 from IPython.kernel import task as taskmodule
24 from IPython.kernel import controllerservice as cs
24 from IPython.kernel import controllerservice as cs
25 import IPython.kernel.multiengine as me
25 import IPython.kernel.multiengine as me
26 from IPython.testutils.util import DeferredTestCase
26 from IPython.testing.util import DeferredTestCase
27 from IPython.kernel.multienginefc import IFCSynchronousMultiEngine
27 from IPython.kernel.multienginefc import IFCSynchronousMultiEngine
28 from IPython.kernel.taskfc import IFCTaskController
28 from IPython.kernel.taskfc import IFCTaskController
29 from IPython.kernel.util import printer
29 from IPython.kernel.util import printer
@@ -2,7 +2,7 b''
2
2
3 This file is meant to be used as
3 This file is meant to be used as
4
4
5 from IPython.testutils.tcommon import *
5 from IPython.testing.tcommon import *
6
6
7 by any test code.
7 by any test code.
8
8
@@ -32,5 +32,5 b' try:'
32 except ImportError:
32 except ImportError:
33 pexpect = None
33 pexpect = None
34 else:
34 else:
35 from IPython.testutils.ipdoctest import IPDocTestLoader,makeTestSuite
35 from IPython.testing.ipdoctest import IPDocTestLoader,makeTestSuite
36
36
@@ -25,8 +25,8 b' __docformat__ = "restructuredtext en"'
25 # Imports
25 # Imports
26 #-------------------------------------------------------------------------------
26 #-------------------------------------------------------------------------------
27
27
28 from IPython.testutils import tcommon
28 from IPython.testing import tcommon
29 from IPython.testutils.tcommon import *
29 from IPython.testing.tcommon import *
30
30
31 #-------------------------------------------------------------------------------
31 #-------------------------------------------------------------------------------
32 # Setup for inline and standalone doctests
32 # Setup for inline and standalone doctests
@@ -25,8 +25,8 b' __docformat__ = "restructuredtext en"'
25 # Imports
25 # Imports
26 #-------------------------------------------------------------------------------
26 #-------------------------------------------------------------------------------
27
27
28 from IPython.testutils import tcommon
28 from IPython.testing import tcommon
29 from IPython.testutils.tcommon import *
29 from IPython.testing.tcommon import *
30
30
31 #-------------------------------------------------------------------------------
31 #-------------------------------------------------------------------------------
32 # Setup for inline and standalone doctests
32 # Setup for inline and standalone doctests
@@ -43,7 +43,7 b' dt_files = fullPath(__file__,[])'
43 # If you have any modules whose docstrings should be scanned for embedded tests
43 # If you have any modules whose docstrings should be scanned for embedded tests
44 # as examples accorging to standard doctest practice, set them here (as a
44 # as examples accorging to standard doctest practice, set them here (as a
45 # single string or a list thereof):
45 # single string or a list thereof):
46 dt_modules = ['IPython.testutils.tutils']
46 dt_modules = ['IPython.testing.tutils']
47
47
48 #-------------------------------------------------------------------------------
48 #-------------------------------------------------------------------------------
49 # Regular Unittests
49 # Regular Unittests
@@ -11,6 +11,6 b' gets confused."""'
11
11
12 # Setup - all imports are done in tcommon
12 # Setup - all imports are done in tcommon
13 import tcommon; reload(tcommon) # for interactive use
13 import tcommon; reload(tcommon) # for interactive use
14 from IPython.testutils.tcommon import *
14 from IPython.testing.tcommon import *
15
15
16 # Doctest code begins here
16 # Doctest code begins here
@@ -13,7 +13,7 b" test_toeplitz_doctest.py, which is run via IPython's irunner script to create"
13 valid doctest input automatically.
13 valid doctest input automatically.
14
14
15 # Setup - all imports are done in tcommon
15 # Setup - all imports are done in tcommon
16 >>> from IPython.testutils.tcommon import *
16 >>> from IPython.testing.tcommon import *
17
17
18 # Rest of doctest goes here...
18 # Rest of doctest goes here...
19
19
@@ -3,8 +3,8 b''
3 """
3 """
4
4
5 # Module imports
5 # Module imports
6 from IPython.testutils import tcommon
6 from IPython.testing import tcommon
7 from IPython.testutils.tcommon import *
7 from IPython.testing.tcommon import *
8
8
9 # If you have standalone doctests in a separate file, set their names in the
9 # If you have standalone doctests in a separate file, set their names in the
10 # dt_files variable (as a single string or a list thereof). The mkPath call
10 # dt_files variable (as a single string or a list thereof). The mkPath call
@@ -1,6 +1,6 b''
1 # Setup - all imports are done in tcommon
1 # Setup - all imports are done in tcommon
2 from IPython.testutils import tcommon
2 from IPython.testing import tcommon
3 from IPython.testutils.tcommon import *
3 from IPython.testing.tcommon import *
4
4
5 # Doctest code begins here
5 # Doctest code begins here
6 from IPython.tools import utils
6 from IPython.tools import utils
@@ -13,8 +13,8 b' mkdoctests.py script for details.'
13 Begin included file tst_tools_utils_doctest.py::
13 Begin included file tst_tools_utils_doctest.py::
14
14
15 # Setup - all imports are done in tcommon
15 # Setup - all imports are done in tcommon
16 >>> from IPython.testutils import tcommon
16 >>> from IPython.testing import tcommon
17 >>> from IPython.testutils.tcommon import *
17 >>> from IPython.testing.tcommon import *
18
18
19 # Doctest code begins here
19 # Doctest code begins here
20 >>> from IPython.tools import utils
20 >>> from IPython.tools import utils
@@ -1,6 +1,6 b''
1 # Setup - all imports are done in tcommon
1 # Setup - all imports are done in tcommon
2 from IPython.testutils import tcommon
2 from IPython.testing import tcommon
3 from IPython.testutils.tcommon import *
3 from IPython.testing.tcommon import *
4
4
5 # Doctest code begins here
5 # Doctest code begins here
6 from IPython.tools import utils
6 from IPython.tools import utils
@@ -15,8 +15,8 b' Auto-generated tests'
15 Begin included file tst_tools_utils_doctest2.py::
15 Begin included file tst_tools_utils_doctest2.py::
16
16
17 # Setup - all imports are done in tcommon
17 # Setup - all imports are done in tcommon
18 >>> from IPython.testutils import tcommon
18 >>> from IPython.testing import tcommon
19 >>> from IPython.testutils.tcommon import *
19 >>> from IPython.testing.tcommon import *
20
20
21 # Doctest code begins here
21 # Doctest code begins here
22 >>> from IPython.tools import utils
22 >>> from IPython.tools import utils
@@ -6,12 +6,16 b' 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) 2001-2005 Fernando Perez <fperez@colorado.edu>
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
16 #-------------------------------------------------------------------------------
17 # Imports
18 #-------------------------------------------------------------------------------
15
19
16 # Stdlib imports
20 # Stdlib imports
17 import os
21 import os
@@ -24,35 +28,24 b' from glob import glob'
24 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
28 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
25
29
26 from distutils.core import setup
30 from distutils.core import setup
27 from setupext import install_data_ext
28
31
29 # Local imports
32 # Local imports
30 from IPython.genutils import target_update
33 from IPython.genutils import target_update
31
34
32 # A few handy globals
35 from setupbase import (
36 setup_args,
37 find_packages,
38 find_package_data,
39 find_scripts,
40 find_data_files,
41 check_for_dependencies
42 )
43
33 isfile = os.path.isfile
44 isfile = os.path.isfile
34 pjoin = os.path.join
45
35
46 #-------------------------------------------------------------------------------
36 ##############################################################################
47 # Handle OS specific things
37 # Utility functions
48 #-------------------------------------------------------------------------------
38 def oscmd(s):
39 print ">", s
40 os.system(s)
41
42 # A little utility we'll need below, since glob() does NOT allow you to do
43 # exclusion on multiple endings!
44 def file_doesnt_endwith(test,endings):
45 """Return true if test is a file and its name does NOT end with any
46 of the strings listed in endings."""
47 if not isfile(test):
48 return False
49 for e in endings:
50 if test.endswith(e):
51 return False
52 return True
53
54 ###############################################################################
55 # Main code begins
56
49
57 if os.name == 'posix':
50 if os.name == 'posix':
58 os_name = 'posix'
51 os_name = 'posix'
@@ -69,6 +62,10 b" if os_name == 'windows' and 'sdist' in sys.argv:"
69 print 'The sdist command is not available under Windows. Exiting.'
62 print 'The sdist command is not available under Windows. Exiting.'
70 sys.exit(1)
63 sys.exit(1)
71
64
65 #-------------------------------------------------------------------------------
66 # Things related to the IPython documentation
67 #-------------------------------------------------------------------------------
68
72 # update the manuals when building a source dist
69 # update the manuals when building a source dist
73 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'):
74 import textwrap
71 import textwrap
@@ -98,89 +95,68 b" if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):"
98
95
99 [ target_update(*t) for t in to_update ]
96 [ target_update(*t) for t in to_update ]
100
97
101 # Release.py contains version, authors, license, url, keywords, etc.
98 #---------------------------------------------------------------------------
102 execfile(pjoin('IPython','Release.py'))
99 # Find all the packages, package data, scripts and data_files
103
100 #---------------------------------------------------------------------------
104 # I can't find how to make distutils create a nested dir. structure, so
105 # in the meantime do it manually. Butt ugly.
106 # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain
107 # information on how to do this more cleanly once python 2.4 can be assumed.
108 # Thanks to Noel for the tip.
109 docdirbase = 'share/doc/ipython'
110 manpagebase = 'share/man/man1'
111
112 # We only need to exclude from this things NOT already excluded in the
113 # MANIFEST.in file.
114 exclude = ('.sh','.1.gz')
115 docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*'))
116 examfiles = filter(isfile, glob('doc/examples/*.py'))
117 manfiles = filter(isfile, glob('doc/manual/*'))
118 manstatic = filter(isfile, glob('doc/manual/_static/*'))
119 manpages = filter(isfile, glob('doc/*.1.gz'))
120
101
121 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
102 packages = find_packages()
122 scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor',
103 package_data = find_package_data()
123 'scripts/irunner'])
104 scripts = find_scripts()
124
105 data_files = find_data_files()
125 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
106
126
107 #---------------------------------------------------------------------------
127 # Script to be run by the windows binary installer after the default setup
108 # Handle dependencies and setuptools specific things
128 # routine, to add shortcuts and similar windows-only things. Windows
109 #---------------------------------------------------------------------------
129 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
110
130 # doesn't find them.
111 # This dict is used for passing extra arguments that are setuptools
131 if 'bdist_wininst' in sys.argv:
112 # specific to setup
132 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
113 setuptools_extra_args = {}
133 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
134 sys.exit(1)
135 scriptfiles.append('scripts/ipython_win_post_install.py')
136
137 datafiles = [('data', docdirbase, docfiles),
138 ('data', pjoin(docdirbase, 'examples'),examfiles),
139 ('data', pjoin(docdirbase, 'manual'),manfiles),
140 ('data', pjoin(docdirbase, 'manual/_static'),manstatic),
141 ('data', manpagebase, manpages),
142 ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles),
143 ]
144
114
145 if 'setuptools' in sys.modules:
115 if 'setuptools' in sys.modules:
146 # setuptools config for egg building
116 setuptools_extra_args['zip_safe'] = False
147 egg_extra_kwds = {
117 setuptools_extra_args['entry_points'] = {
148 'entry_points': {
149 'console_scripts': [
118 'console_scripts': [
150 'ipython = IPython.ipapi:launch_new_instance',
119 'ipython = IPython.ipapi:launch_new_instance',
151 'pycolor = IPython.PyColorize:main'
120 'pycolor = IPython.PyColorize:main',
152 ]}
121 'ipcontroller = IPython.kernel.scripts.ipcontroller:main',
122 'ipengine = IPython.kernel.scripts.ipengine:main',
123 'ipcluster = IPython.kernel.scripts.ipcluster:main'
124 ]
153 }
125 }
154 scriptfiles = []
126 setup_args["extras_require"] = dict(
127 kernel = [
128 "zope.interface>=3.4.1",
129 "Twisted>=8.0.1",
130 "foolscap>=0.2.6"
131 ],
132 doc=['Sphinx>=0.3','pygments'],
133 test='nose>=0.10.1',
134 security=["pyOpenSSL>=0.6"]
135 )
136 # Allow setuptools to handle the scripts
137 scripts = []
155 # eggs will lack docs, examples
138 # eggs will lack docs, examples
156 datafiles = []
139 data_files = []
157 else:
140 else:
158 # Normal, non-setuptools install
159 egg_extra_kwds = {}
160 # package_data of setuptools was introduced to distutils in 2.4
141 # package_data of setuptools was introduced to distutils in 2.4
142 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
161 if sys.version_info < (2,4):
143 if sys.version_info < (2,4):
162 datafiles.append(('lib', 'IPython/UserConfig', cfgfiles))
144 data_files.append(('lib', 'IPython/UserConfig', cfgfiles))
163
145 # If we are running without setuptools, call this function which will
164 # Call the setup() routine which does most of the work
146 # check for dependencies an inform the user what is needed. This is
165 setup(name = name,
147 # just to make life easy for users.
166 version = version,
148 check_for_dependencies()
167 description = description,
149
168 long_description = long_description,
150
169 author = authors['Fernando'][0],
151 #---------------------------------------------------------------------------
170 author_email = authors['Fernando'][1],
152 # Do the actual setup now
171 url = url,
153 #---------------------------------------------------------------------------
172 download_url = download_url,
154
173 license = license,
155 setup_args['packages'] = packages
174 platforms = platforms,
156 setup_args['package_data'] = package_data
175 keywords = keywords,
157 setup_args['scripts'] = scripts
176 packages = ['IPython', 'IPython.Extensions', 'IPython.external',
158 setup_args['data_files'] = data_files
177 'IPython.gui', 'IPython.gui.wx',
159 setup_args.update(setuptools_extra_args)
178 'IPython.UserConfig'],
160
179 scripts = scriptfiles,
161 if __name__ == '__main__':
180 package_data = {'IPython.UserConfig' : ['*'] },
162 setup(**setup_args)
181
182 cmdclass = {'install_data': install_data_ext},
183 data_files = datafiles,
184 # extra params needed for eggs
185 **egg_extra_kwds
186 )
General Comments 0
You need to be logged in to leave comments. Login now