diff --git a/IPython/Release.py b/IPython/Release.py index cc9e745..cc62c70 100644 --- a/IPython/Release.py +++ b/IPython/Release.py @@ -32,7 +32,7 @@ else: version = '0.8.4' -description = "An enhanced interactive Python shell." +description = "Tools for interactive development in Python." long_description = \ """ @@ -77,13 +77,19 @@ license = 'BSD' authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'), 'Janko' : ('Janko Hauser','jhauser@zscout.de'), 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu'), - 'Ville' : ('Ville Vainio','vivainio@gmail.com') + 'Ville' : ('Ville Vainio','vivainio@gmail.com'), + 'Brian' : ('Brian E Granger', 'ellisonbg@gmail.com'), + 'Min' : ('Min Ragan-Kelley', 'benjaminrk@gmail.com') } +author = 'The IPython Development Team' + +author_email = 'ipython-dev@scipy.org' + url = 'http://ipython.scipy.org' download_url = 'http://ipython.scipy.org/dist' platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME'] -keywords = ['Interactive','Interpreter','Shell'] +keywords = ['Interactive','Interpreter','Shell','Parallel','Distributed'] diff --git a/IPython/kernel/tests/controllertest.py b/IPython/kernel/tests/controllertest.py index 14df89c..5ebfaab 100644 --- a/IPython/kernel/tests/controllertest.py +++ b/IPython/kernel/tests/controllertest.py @@ -28,7 +28,7 @@ import zope.interface as zi from IPython.kernel import engineservice as es from IPython.kernel import error -from IPython.testutils.util import DeferredTestCase +from IPython.testing.util import DeferredTestCase from IPython.kernel.controllerservice import \ IControllerCore diff --git a/IPython/kernel/tests/engineservicetest.py b/IPython/kernel/tests/engineservicetest.py index 974ee12..b4a6d21 100644 --- a/IPython/kernel/tests/engineservicetest.py +++ b/IPython/kernel/tests/engineservicetest.py @@ -27,7 +27,7 @@ from IPython.kernel import error from IPython.kernel.pickleutil import can, uncan import IPython.kernel.engineservice as es from IPython.kernel.core.interpreter import Interpreter -from IPython.testutils.parametric import Parametric, parametric +from IPython.testing.parametric import Parametric, parametric #------------------------------------------------------------------------------- # Tests diff --git a/IPython/kernel/tests/multienginetest.py b/IPython/kernel/tests/multienginetest.py index 4ae3e8c..30a2df7 100644 --- a/IPython/kernel/tests/multienginetest.py +++ b/IPython/kernel/tests/multienginetest.py @@ -21,8 +21,8 @@ from IPython.kernel import engineservice as es from IPython.kernel import multiengine as me from IPython.kernel import newserialized from IPython.kernel.error import NotDefined -from IPython.testutils import util -from IPython.testutils.parametric import parametric, Parametric +from IPython.testing import util +from IPython.testing.parametric import parametric, Parametric from IPython.kernel import newserialized from IPython.kernel.util import printer from IPython.kernel.error import (InvalidEngineID, diff --git a/IPython/kernel/tests/test_controllerservice.py b/IPython/kernel/tests/test_controllerservice.py index 212b235..875d948 100644 --- a/IPython/kernel/tests/test_controllerservice.py +++ b/IPython/kernel/tests/test_controllerservice.py @@ -27,7 +27,7 @@ from twisted.application.service import IService from IPython.kernel.controllerservice import ControllerService from IPython.kernel.tests import multienginetest as met from controllertest import IControllerCoreTestCase -from IPython.testutils.util import DeferredTestCase +from IPython.testing.util import DeferredTestCase class BasicControllerServiceTest(DeferredTestCase, IControllerCoreTestCase): diff --git a/IPython/kernel/tests/test_enginefc.py b/IPython/kernel/tests/test_enginefc.py index ee0f0cb..3d9040f 100644 --- a/IPython/kernel/tests/test_enginefc.py +++ b/IPython/kernel/tests/test_enginefc.py @@ -26,7 +26,7 @@ import zope.interface as zi from IPython.kernel.fcutil import Tub, UnauthenticatedTub from IPython.kernel import engineservice as es -from IPython.testutils.util import DeferredTestCase +from IPython.testing.util import DeferredTestCase from IPython.kernel.controllerservice import IControllerBase from IPython.kernel.enginefc import FCRemoteEngineRefFromService, IEngineBase from IPython.kernel.engineservice import IEngineQueued diff --git a/IPython/kernel/tests/test_engineservice.py b/IPython/kernel/tests/test_engineservice.py index d815bae..4e95ce7 100644 --- a/IPython/kernel/tests/test_engineservice.py +++ b/IPython/kernel/tests/test_engineservice.py @@ -27,7 +27,7 @@ from twisted.internet import defer from twisted.application.service import IService from IPython.kernel import engineservice as es -from IPython.testutils.util import DeferredTestCase +from IPython.testing.util import DeferredTestCase from IPython.kernel.tests.engineservicetest import \ IEngineCoreTestCase, \ IEngineSerializedTestCase, \ diff --git a/IPython/kernel/tests/test_multiengine.py b/IPython/kernel/tests/test_multiengine.py index dd8f619..125671d 100644 --- a/IPython/kernel/tests/test_multiengine.py +++ b/IPython/kernel/tests/test_multiengine.py @@ -16,7 +16,7 @@ __docformat__ = "restructuredtext en" #------------------------------------------------------------------------------- from twisted.internet import defer -from IPython.testutils.util import DeferredTestCase +from IPython.testing.util import DeferredTestCase from IPython.kernel.controllerservice import ControllerService from IPython.kernel import multiengine as me from IPython.kernel.tests.multienginetest import (IMultiEngineTestCase, diff --git a/IPython/kernel/tests/test_multienginefc.py b/IPython/kernel/tests/test_multienginefc.py index 90f65c1..7e2f381 100644 --- a/IPython/kernel/tests/test_multienginefc.py +++ b/IPython/kernel/tests/test_multienginefc.py @@ -18,7 +18,7 @@ from twisted.internet import defer, reactor from IPython.kernel.fcutil import Tub, UnauthenticatedTub -from IPython.testutils.util import DeferredTestCase +from IPython.testing.util import DeferredTestCase from IPython.kernel.controllerservice import ControllerService from IPython.kernel.multiengine import IMultiEngine from IPython.kernel.tests.multienginetest import IFullSynchronousMultiEngineTestCase diff --git a/IPython/kernel/tests/test_newserialized.py b/IPython/kernel/tests/test_newserialized.py index 1fde7ac..7b4d3a2 100644 --- a/IPython/kernel/tests/test_newserialized.py +++ b/IPython/kernel/tests/test_newserialized.py @@ -17,7 +17,7 @@ __docformat__ = "restructuredtext en" import zope.interface as zi from twisted.trial import unittest -from IPython.testutils.util import DeferredTestCase +from IPython.testing.util import DeferredTestCase from IPython.kernel.newserialized import \ ISerialized, \ diff --git a/IPython/kernel/tests/test_pendingdeferred.py b/IPython/kernel/tests/test_pendingdeferred.py index a96be3e..a194747 100644 --- a/IPython/kernel/tests/test_pendingdeferred.py +++ b/IPython/kernel/tests/test_pendingdeferred.py @@ -19,9 +19,9 @@ __docformat__ = "restructuredtext en" from twisted.internet import defer from twisted.python import failure -from IPython.testutils import tcommon -from IPython.testutils.tcommon import * -from IPython.testutils.util import DeferredTestCase +from IPython.testing import tcommon +from IPython.testing.tcommon import * +from IPython.testing.util import DeferredTestCase import IPython.kernel.pendingdeferred as pd from IPython.kernel import error from IPython.kernel.util import printer diff --git a/IPython/kernel/tests/test_task.py b/IPython/kernel/tests/test_task.py index 85d3a55..d59f7f1 100644 --- a/IPython/kernel/tests/test_task.py +++ b/IPython/kernel/tests/test_task.py @@ -22,7 +22,7 @@ from twisted.trial import unittest from IPython.kernel import task, controllerservice as cs, engineservice as es from IPython.kernel.multiengine import IMultiEngine -from IPython.testutils.util import DeferredTestCase +from IPython.testing.util import DeferredTestCase from IPython.kernel.tests.tasktest import ITaskControllerTestCase #------------------------------------------------------------------------------- diff --git a/IPython/kernel/tests/test_taskfc.py b/IPython/kernel/tests/test_taskfc.py index c7d0103..411ba87 100644 --- a/IPython/kernel/tests/test_taskfc.py +++ b/IPython/kernel/tests/test_taskfc.py @@ -23,7 +23,7 @@ from IPython.kernel.fcutil import Tub, UnauthenticatedTub from IPython.kernel import task as taskmodule from IPython.kernel import controllerservice as cs import IPython.kernel.multiengine as me -from IPython.testutils.util import DeferredTestCase +from IPython.testing.util import DeferredTestCase from IPython.kernel.multienginefc import IFCSynchronousMultiEngine from IPython.kernel.taskfc import IFCTaskController from IPython.kernel.util import printer diff --git a/IPython/testing/tcommon.py b/IPython/testing/tcommon.py index f4b7bcc..73f7362 100644 --- a/IPython/testing/tcommon.py +++ b/IPython/testing/tcommon.py @@ -2,7 +2,7 @@ This file is meant to be used as -from IPython.testutils.tcommon import * +from IPython.testing.tcommon import * by any test code. @@ -32,5 +32,5 @@ try: except ImportError: pexpect = None else: - from IPython.testutils.ipdoctest import IPDocTestLoader,makeTestSuite + from IPython.testing.ipdoctest import IPDocTestLoader,makeTestSuite diff --git a/IPython/testing/testTEMPLATE.py b/IPython/testing/testTEMPLATE.py index c9b07c7..2484a13 100755 --- a/IPython/testing/testTEMPLATE.py +++ b/IPython/testing/testTEMPLATE.py @@ -25,8 +25,8 @@ __docformat__ = "restructuredtext en" # Imports #------------------------------------------------------------------------------- -from IPython.testutils import tcommon -from IPython.testutils.tcommon import * +from IPython.testing import tcommon +from IPython.testing.tcommon import * #------------------------------------------------------------------------------- # Setup for inline and standalone doctests diff --git a/IPython/testing/tests/test_testutils.py b/IPython/testing/tests/test_testutils.py index 2933f90..683661b 100755 --- a/IPython/testing/tests/test_testutils.py +++ b/IPython/testing/tests/test_testutils.py @@ -25,8 +25,8 @@ __docformat__ = "restructuredtext en" # Imports #------------------------------------------------------------------------------- -from IPython.testutils import tcommon -from IPython.testutils.tcommon import * +from IPython.testing import tcommon +from IPython.testing.tcommon import * #------------------------------------------------------------------------------- # Setup for inline and standalone doctests @@ -43,7 +43,7 @@ dt_files = fullPath(__file__,[]) # If you have any modules whose docstrings should be scanned for embedded tests # as examples accorging to standard doctest practice, set them here (as a # single string or a list thereof): -dt_modules = ['IPython.testutils.tutils'] +dt_modules = ['IPython.testing.tutils'] #------------------------------------------------------------------------------- # Regular Unittests diff --git a/IPython/testing/tstTEMPLATE_doctest.py b/IPython/testing/tstTEMPLATE_doctest.py index 0e2d427..a01b7f5 100644 --- a/IPython/testing/tstTEMPLATE_doctest.py +++ b/IPython/testing/tstTEMPLATE_doctest.py @@ -11,6 +11,6 @@ gets confused.""" # Setup - all imports are done in tcommon import tcommon; reload(tcommon) # for interactive use -from IPython.testutils.tcommon import * +from IPython.testing.tcommon import * # Doctest code begins here diff --git a/IPython/testing/tstTEMPLATE_doctest.txt b/IPython/testing/tstTEMPLATE_doctest.txt index 880d540..9f7d7e5 100644 --- a/IPython/testing/tstTEMPLATE_doctest.txt +++ b/IPython/testing/tstTEMPLATE_doctest.txt @@ -13,7 +13,7 @@ test_toeplitz_doctest.py, which is run via IPython's irunner script to create valid doctest input automatically. # Setup - all imports are done in tcommon ->>> from IPython.testutils.tcommon import * +>>> from IPython.testing.tcommon import * # Rest of doctest goes here... diff --git a/IPython/tools/tests/test_tools_utils.py b/IPython/tools/tests/test_tools_utils.py index 9c1eda1..61ec558 100755 --- a/IPython/tools/tests/test_tools_utils.py +++ b/IPython/tools/tests/test_tools_utils.py @@ -3,8 +3,8 @@ """ # Module imports -from IPython.testutils import tcommon -from IPython.testutils.tcommon import * +from IPython.testing import tcommon +from IPython.testing.tcommon import * # If you have standalone doctests in a separate file, set their names in the # dt_files variable (as a single string or a list thereof). The mkPath call diff --git a/IPython/tools/tests/tst_tools_utils_doctest.py b/IPython/tools/tests/tst_tools_utils_doctest.py index 9f22d8b..bb0abe5 100644 --- a/IPython/tools/tests/tst_tools_utils_doctest.py +++ b/IPython/tools/tests/tst_tools_utils_doctest.py @@ -1,6 +1,6 @@ # Setup - all imports are done in tcommon -from IPython.testutils import tcommon -from IPython.testutils.tcommon import * +from IPython.testing import tcommon +from IPython.testing.tcommon import * # Doctest code begins here from IPython.tools import utils diff --git a/IPython/tools/tests/tst_tools_utils_doctest.txt b/IPython/tools/tests/tst_tools_utils_doctest.txt index 8301b98..8873850 100644 --- a/IPython/tools/tests/tst_tools_utils_doctest.txt +++ b/IPython/tools/tests/tst_tools_utils_doctest.txt @@ -13,8 +13,8 @@ mkdoctests.py script for details. Begin included file tst_tools_utils_doctest.py:: # Setup - all imports are done in tcommon - >>> from IPython.testutils import tcommon - >>> from IPython.testutils.tcommon import * + >>> from IPython.testing import tcommon + >>> from IPython.testing.tcommon import * # Doctest code begins here >>> from IPython.tools import utils diff --git a/IPython/tools/tests/tst_tools_utils_doctest2.py b/IPython/tools/tests/tst_tools_utils_doctest2.py index 8a35b98..4e6f3b2 100644 --- a/IPython/tools/tests/tst_tools_utils_doctest2.py +++ b/IPython/tools/tests/tst_tools_utils_doctest2.py @@ -1,6 +1,6 @@ # Setup - all imports are done in tcommon -from IPython.testutils import tcommon -from IPython.testutils.tcommon import * +from IPython.testing import tcommon +from IPython.testing.tcommon import * # Doctest code begins here from IPython.tools import utils diff --git a/IPython/tools/tests/tst_tools_utils_doctest2.txt b/IPython/tools/tests/tst_tools_utils_doctest2.txt index bebb551..1ccea08 100644 --- a/IPython/tools/tests/tst_tools_utils_doctest2.txt +++ b/IPython/tools/tests/tst_tools_utils_doctest2.txt @@ -15,8 +15,8 @@ Auto-generated tests Begin included file tst_tools_utils_doctest2.py:: # Setup - all imports are done in tcommon - >>> from IPython.testutils import tcommon - >>> from IPython.testutils.tcommon import * + >>> from IPython.testing import tcommon + >>> from IPython.testing.tcommon import * # Doctest code begins here >>> from IPython.tools import utils diff --git a/setup.py b/setup.py index a98f793..b15fe47 100755 --- a/setup.py +++ b/setup.py @@ -6,12 +6,16 @@ Under Posix environments it works like a typical setup.py script. Under Windows, the command sdist is not supported, since IPython requires utilities which are not available under Windows.""" -#***************************************************************************** -# Copyright (C) 2001-2005 Fernando Perez +#------------------------------------------------------------------------------- +# Copyright (C) 2008 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. -#***************************************************************************** +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Imports +#------------------------------------------------------------------------------- # Stdlib imports import os @@ -24,35 +28,24 @@ from glob import glob if os.path.exists('MANIFEST'): os.remove('MANIFEST') from distutils.core import setup -from setupext import install_data_ext # Local imports from IPython.genutils import target_update -# A few handy globals +from setupbase import ( + setup_args, + find_packages, + find_package_data, + find_scripts, + find_data_files, + check_for_dependencies +) + isfile = os.path.isfile -pjoin = os.path.join - -############################################################################## -# Utility functions -def oscmd(s): - print ">", s - os.system(s) - -# A little utility we'll need below, since glob() does NOT allow you to do -# exclusion on multiple endings! -def file_doesnt_endwith(test,endings): - """Return true if test is a file and its name does NOT end with any - of the strings listed in endings.""" - if not isfile(test): - return False - for e in endings: - if test.endswith(e): - return False - return True - -############################################################################### -# Main code begins + +#------------------------------------------------------------------------------- +# Handle OS specific things +#------------------------------------------------------------------------------- if os.name == 'posix': os_name = 'posix' @@ -69,6 +62,10 @@ if os_name == 'windows' and 'sdist' in sys.argv: print 'The sdist command is not available under Windows. Exiting.' sys.exit(1) +#------------------------------------------------------------------------------- +# Things related to the IPython documentation +#------------------------------------------------------------------------------- + # update the manuals when building a source dist if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): import textwrap @@ -98,89 +95,68 @@ if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): [ target_update(*t) for t in to_update ] -# Release.py contains version, authors, license, url, keywords, etc. -execfile(pjoin('IPython','Release.py')) - -# I can't find how to make distutils create a nested dir. structure, so -# in the meantime do it manually. Butt ugly. -# Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain -# information on how to do this more cleanly once python 2.4 can be assumed. -# Thanks to Noel for the tip. -docdirbase = 'share/doc/ipython' -manpagebase = 'share/man/man1' - -# We only need to exclude from this things NOT already excluded in the -# MANIFEST.in file. -exclude = ('.sh','.1.gz') -docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*')) -examfiles = filter(isfile, glob('doc/examples/*.py')) -manfiles = filter(isfile, glob('doc/manual/*')) -manstatic = filter(isfile, glob('doc/manual/_static/*')) -manpages = filter(isfile, glob('doc/*.1.gz')) - -cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) -scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor', - 'scripts/irunner']) - -igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*')) - -# Script to be run by the windows binary installer after the default setup -# routine, to add shortcuts and similar windows-only things. Windows -# post-install scripts MUST reside in the scripts/ dir, otherwise distutils -# doesn't find them. -if 'bdist_wininst' in sys.argv: - if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): - print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." - sys.exit(1) - scriptfiles.append('scripts/ipython_win_post_install.py') - -datafiles = [('data', docdirbase, docfiles), - ('data', pjoin(docdirbase, 'examples'),examfiles), - ('data', pjoin(docdirbase, 'manual'),manfiles), - ('data', pjoin(docdirbase, 'manual/_static'),manstatic), - ('data', manpagebase, manpages), - ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), - ] +#--------------------------------------------------------------------------- +# Find all the packages, package data, scripts and data_files +#--------------------------------------------------------------------------- + +packages = find_packages() +package_data = find_package_data() +scripts = find_scripts() +data_files = find_data_files() + +#--------------------------------------------------------------------------- +# Handle dependencies and setuptools specific things +#--------------------------------------------------------------------------- + +# This dict is used for passing extra arguments that are setuptools +# specific to setup +setuptools_extra_args = {} if 'setuptools' in sys.modules: - # setuptools config for egg building - egg_extra_kwds = { - 'entry_points': { - 'console_scripts': [ + setuptools_extra_args['zip_safe'] = False + setuptools_extra_args['entry_points'] = { + 'console_scripts': [ 'ipython = IPython.ipapi:launch_new_instance', - 'pycolor = IPython.PyColorize:main' - ]} - } - scriptfiles = [] + 'pycolor = IPython.PyColorize:main', + 'ipcontroller = IPython.kernel.scripts.ipcontroller:main', + 'ipengine = IPython.kernel.scripts.ipengine:main', + 'ipcluster = IPython.kernel.scripts.ipcluster:main' + ] + } + setup_args["extras_require"] = dict( + kernel = [ + "zope.interface>=3.4.1", + "Twisted>=8.0.1", + "foolscap>=0.2.6" + ], + doc=['Sphinx>=0.3','pygments'], + test='nose>=0.10.1', + security=["pyOpenSSL>=0.6"] + ) + # Allow setuptools to handle the scripts + scripts = [] # eggs will lack docs, examples - datafiles = [] + data_files = [] else: - # Normal, non-setuptools install - egg_extra_kwds = {} # package_data of setuptools was introduced to distutils in 2.4 + cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) if sys.version_info < (2,4): - datafiles.append(('lib', 'IPython/UserConfig', cfgfiles)) - -# Call the setup() routine which does most of the work -setup(name = name, - version = version, - description = description, - long_description = long_description, - author = authors['Fernando'][0], - author_email = authors['Fernando'][1], - url = url, - download_url = download_url, - license = license, - platforms = platforms, - keywords = keywords, - packages = ['IPython', 'IPython.Extensions', 'IPython.external', - 'IPython.gui', 'IPython.gui.wx', - 'IPython.UserConfig'], - scripts = scriptfiles, - package_data = {'IPython.UserConfig' : ['*'] }, - - cmdclass = {'install_data': install_data_ext}, - data_files = datafiles, - # extra params needed for eggs - **egg_extra_kwds - ) + data_files.append(('lib', 'IPython/UserConfig', cfgfiles)) + # If we are running without setuptools, call this function which will + # check for dependencies an inform the user what is needed. This is + # just to make life easy for users. + check_for_dependencies() + + +#--------------------------------------------------------------------------- +# Do the actual setup now +#--------------------------------------------------------------------------- + +setup_args['packages'] = packages +setup_args['package_data'] = package_data +setup_args['scripts'] = scripts +setup_args['data_files'] = data_files +setup_args.update(setuptools_extra_args) + +if __name__ == '__main__': + setup(**setup_args) diff --git a/setupbase.py b/setupbase.py new file mode 100644 index 0000000..41954cd --- /dev/null +++ b/setupbase.py @@ -0,0 +1,201 @@ +# encoding: utf-8 + +__docformat__ = "restructuredtext en" + +#------------------------------------------------------------------------------- +# Copyright (C) 2008 The IPython Development Team +# +# Distributed under the terms of the BSD License. The full license is in +# the file COPYING, distributed as part of this software. +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Imports +#------------------------------------------------------------------------------- + +import os, sys + +from glob import glob + +from setupext import install_data_ext + +#------------------------------------------------------------------------------- +# Useful globals and utility functions +#------------------------------------------------------------------------------- + +# A few handy globals +isfile = os.path.isfile +pjoin = os.path.join + +def oscmd(s): + print ">", s + os.system(s) + +# A little utility we'll need below, since glob() does NOT allow you to do +# exclusion on multiple endings! +def file_doesnt_endwith(test,endings): + """Return true if test is a file and its name does NOT end with any + of the strings listed in endings.""" + if not isfile(test): + return False + for e in endings: + if test.endswith(e): + return False + return True + +#--------------------------------------------------------------------------- +# Basic project information +#--------------------------------------------------------------------------- + +# Release.py contains version, authors, license, url, keywords, etc. +execfile(pjoin('IPython','Release.py')) + +# Create a dict with the basic information +# This dict is eventually passed to setup after additional keys are added. +setup_args = dict( + name = name, + version = version, + description = description, + long_description = long_description, + author = author, + author_email = author_email, + url = url, + download_url = download_url, + license = license, + platforms = platforms, + keywords = keywords, + cmdclass = {'install_data': install_data_ext}, + ) + + +#--------------------------------------------------------------------------- +# Find packages +#--------------------------------------------------------------------------- + +def add_package(packages, pname, config=False, tests=False, scripts=False, others=None): + packages.append('.'.join(['ipython1',pname])) + if config: + packages.append('.'.join(['ipython1',pname,'config'])) + if tests: + packages.append('.'.join(['ipython1',pname,'tests'])) + if scripts: + packages.append('.'.join(['ipython1',pname,'scripts'])) + if others is not None: + for o in others: + packages.append('.'.join(['ipython1',pname,o])) + +def find_packages(): + packages = ['ipython'] + add_package(packages, 'config', tests=True) + add_package(packages , 'Extensions') + add_package(packages, 'external') + add_package(packages, 'gui') + add_package(packages, 'gui.wx') + add_package(packages, 'kernel', config=True, tests=True, scripts=True) + add_package(packages, 'kernel.core', config=True, tests=True) + add_package(packages, 'testing', tests=True) + add_package(packages, 'tools', tests=True) + add_package(packages, 'UserConfig') + return packages + +#--------------------------------------------------------------------------- +# Find package data +#--------------------------------------------------------------------------- + +def find_package_data(): + # This is not enough for these things to appear in an sdist. + # We need to muck with the MANIFEST to get this to work + package_data = {'IPython.UserConfig' : ['*'] } + return package_data + + +#--------------------------------------------------------------------------- +# Find data files +#--------------------------------------------------------------------------- + +def find_data_files(): + + # I can't find how to make distutils create a nested dir. structure, so + # in the meantime do it manually. Butt ugly. + # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain + # information on how to do this more cleanly once python 2.4 can be assumed. + # Thanks to Noel for the tip. + docdirbase = 'share/doc/ipython' + manpagebase = 'share/man/man1' + + # We only need to exclude from this things NOT already excluded in the + # MANIFEST.in file. + exclude = ('.sh','.1.gz') + docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*')) + examfiles = filter(isfile, glob('doc/examples/*.py')) + manfiles = filter(isfile, glob('doc/manual/*')) + manstatic = filter(isfile, glob('doc/manual/_static/*')) + manpages = filter(isfile, glob('doc/*.1.gz')) + scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor', + 'scripts/irunner']) + igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*')) + + data_files = [('data', docdirbase, docfiles), + ('data', pjoin(docdirbase, 'examples'),examfiles), + ('data', pjoin(docdirbase, 'manual'),manfiles), + ('data', pjoin(docdirbase, 'manual/_static'),manstatic), + ('data', manpagebase, manpages), + ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), + ] + return data_files + +#--------------------------------------------------------------------------- +# Find scripts +#--------------------------------------------------------------------------- + +def find_scripts(): + scripts = [] + scripts.append('ipython1/kernel/scripts/ipengine') + scripts.append('ipython1/kernel/scripts/ipcontroller') + scripts.append('ipython1/kernel/scripts/ipcluster') + scripts.append('scripts/ipython') + scripts.append('scripts/pycolor') + scripts.append('scripts/irunner') + + # Script to be run by the windows binary installer after the default setup + # routine, to add shortcuts and similar windows-only things. Windows + # post-install scripts MUST reside in the scripts/ dir, otherwise distutils + # doesn't find them. + if 'bdist_wininst' in sys.argv: + if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): + print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." + sys.exit(1) + scripts.append('scripts/ipython_win_post_install.py') + + return scripts + +#--------------------------------------------------------------------------- +# Find scripts +#--------------------------------------------------------------------------- + +def check_for_dependencies(): + from setupext.setupext import ( + print_line, print_raw, print_status, print_message, + check_for_zopeinterface, check_for_twisted, + check_for_foolscap, check_for_pyopenssl, + check_for_sphinx, check_for_pygments, + check_for_nose, check_for_pexpect + ) + print_line() + print_raw("BUILDING IPYTHON") + print_status('python', sys.version) + print_status('platform', sys.platform) + if sys.platform == 'win32': + print_status('Windows version', sys.getwindowsversion()) + + print_raw("") + print_raw("OPTIONAL DEPENDENCIES") + + check_for_zopeinterface() + check_for_twisted() + check_for_foolscap() + check_for_pyopenssl() + check_for_sphinx() + check_for_pygments() + check_for_nose() + check_for_pexpect() \ No newline at end of file diff --git a/setupext/setupext.py b/setupext/setupext.py new file mode 100644 index 0000000..cf2fd54 --- /dev/null +++ b/setupext/setupext.py @@ -0,0 +1,177 @@ +# encoding: utf-8 + +__docformat__ = "restructuredtext en" + +#------------------------------------------------------------------------------- +# Copyright (C) 2008 The IPython Development Team +# +# Distributed under the terms of the BSD License. The full license is in +# the file COPYING, distributed as part of this software. +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Imports +#------------------------------------------------------------------------------- + +import sys, os +from textwrap import fill + +display_status=True + +if display_status: + def print_line(char='='): + print char * 76 + + def print_status(package, status): + initial_indent = "%22s: " % package + indent = ' ' * 24 + print fill(str(status), width=76, + initial_indent=initial_indent, + subsequent_indent=indent) + + def print_message(message): + indent = ' ' * 24 + "* " + print fill(str(message), width=76, + initial_indent=indent, + subsequent_indent=indent) + + def print_raw(section): + print section +else: + def print_line(*args, **kwargs): + pass + print_status = print_message = print_raw = print_line + +#------------------------------------------------------------------------------- +# Tests for specific packages +#------------------------------------------------------------------------------- + +def check_for_ipython(): + try: + import IPython + except ImportError: + print_status("IPython", "Not found") + return False + else: + print_status("IPython", IPython.__version__) + return True + +def check_for_zopeinterface(): + try: + import zope.interface + except ImportError: + print_status("zope.Interface", "Not found (required for parallel computing capabilities)") + return False + else: + print_status("Zope.Interface","yes") + return True + +def check_for_twisted(): + try: + import twisted + except ImportError: + print_status("Twisted", "Not found (required for parallel computing capabilities)") + return False + else: + major = twisted.version.major + minor = twisted.version.minor + micro = twisted.version.micro + if not ((major==2 and minor>=5 and micro>=0) or \ + major>=8): + print_message("WARNING: IPython requires Twisted 2.5.0 or greater, you have version %s"%twisted.version.short()) + return False + else: + print_status("Twisted", twisted.version.short()) + return True + +def check_for_foolscap(): + try: + import foolscap + except ImportError: + print_status('Foolscap', "Not found (required for parallel computing capabilities)") + return False + else: + print_status('Foolscap', foolscap.__version__) + return True + +def check_for_pyopenssl(): + try: + import OpenSSL + except ImportError: + print_status('OpenSSL', "Not found (required if you want security in the parallel computing capabilities)") + return False + else: + print_status('OpenSSL', OpenSSL.__version__) + return True + +def check_for_sphinx(): + try: + import sphinx + except ImportError: + print_status('sphinx', "Not found (required for building the IPtyhon documentation)") + return False + else: + print_status('sphinx', sphinx.__version__) + return True + +def check_for_pygments(): + try: + import pygments + except ImportError: + print_status('pygments', "Not found (required for syntax highlighting of code in the IPtyhon documentation)") + return False + else: + print_status('pygments', pygments.__version__) + return True + +def check_for_nose(): + try: + import nose + except ImportError: + print_status('nose', "Not found (required for running the IPython test suite)") + return False + else: + print_status('nose', nose.__version__) + return True + +def check_for_pexpect(): + try: + import pexpect + except ImportError: + print_status("pexpect", "no (required for running standalone doctests)") + return False + else: + print_status("pexpect", pexpect.__version__) + return True + +def check_for_httplib2(): + try: + import httplib2 + except ImportError: + print_status("httplib2", "no (required for blocking http clients)") + return False + else: + print_status("httplib2","yes") + return True + +def check_for_sqlalchemy(): + try: + import sqlalchemy + except ImportError: + print_status("sqlalchemy", "no (required for the ipython1 notebook)") + return False + else: + print_status("sqlalchemy","yes") + return True + +def check_for_simplejson(): + try: + import simplejson + except ImportError: + print_status("simplejson", "no (required for the ipython1 notebook)") + return False + else: + print_status("simplejson","yes") + return True + + \ No newline at end of file