##// END OF EJS Templates
First semi-working draft of ipython based kernel.
First semi-working draft of ipython based kernel.

File last commit:

r2498:3eae1372
r2759:f19d51df
Show More
setup.py
251 lines | 8.9 KiB | text/x-python | PythonLexer
Ville M. Vainio
more crlf
r1033 #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Setup script for IPython.
Under Posix environments it works like a typical setup.py script.
Under Windows, the command sdist is not supported, since IPython
Fernando Perez
Finish doc/build tools cleanup....
r1207 requires utilities which are not available under Windows."""
Ville M. Vainio
more crlf
r1033
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 #-------------------------------------------------------------------------------
# Copyright (C) 2008 The IPython Development Team
Ville M. Vainio
more crlf
r1033 #
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 #-------------------------------------------------------------------------------
Fernando Perez
Inform user at install time of minimal python requirements if not met....
r2493 #-----------------------------------------------------------------------------
# Minimal Python version sanity check
#-----------------------------------------------------------------------------
import sys
# This check is also made in IPython/__init__, don't forget to update both when
# changing Python version requirements.
if sys.version[0:3] < '2.5':
error = """\
ERROR: 'IPython requires Python Version 2.5 or above.'
Exiting."""
print >> sys.stderr, error
sys.exit(1)
# At least we're on Python 2.5 or newer, move on.
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 #-------------------------------------------------------------------------------
# Imports
#-------------------------------------------------------------------------------
Ville M. Vainio
more crlf
r1033
# Stdlib imports
import os
Fernando Perez
Move cleanup to main setup.py, where it belongs....
r2460 import shutil
Ville M. Vainio
more crlf
r1033
from glob import glob
Fernando Perez
Finish doc/build tools cleanup....
r1207
# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
# update it when the contents of directories change.
if os.path.exists('MANIFEST'): os.remove('MANIFEST')
from distutils.core import setup
Ville M. Vainio
more crlf
r1033
Fernando Perez
Inform user at install time of minimal python requirements if not met....
r2493 # Our own imports
Brian Granger
Work to address the review comments on Fernando's branch....
r2498 from IPython.utils.path import target_update
Fernando Perez
Finish doc/build tools cleanup....
r1207
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 from setupbase import (
setup_args,
find_packages,
find_package_data,
find_scripts,
find_data_files,
check_for_dependencies
)
Ville M. Vainio
more crlf
r1033 isfile = os.path.isfile
Brian Granger
Fixing installation related issues.
r2058 pjoin = os.path.join
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237
Fernando Perez
Move cleanup to main setup.py, where it belongs....
r2460 #-----------------------------------------------------------------------------
# Function definitions
#-----------------------------------------------------------------------------
def cleanup():
"""Clean up the junk left around by the build process"""
if "develop" not in sys.argv:
try:
shutil.rmtree('ipython.egg-info')
except:
try:
os.unlink('ipython.egg-info')
except:
pass
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 #-------------------------------------------------------------------------------
# Handle OS specific things
#-------------------------------------------------------------------------------
Ville M. Vainio
more crlf
r1033
if os.name == 'posix':
os_name = 'posix'
elif os.name in ['nt','dos']:
os_name = 'windows'
else:
print 'Unsupported operating system:',os.name
sys.exit(1)
Fernando Perez
Finish doc/build tools cleanup....
r1207 # Under Windows, 'sdist' has not been supported. Now that the docs build with
# Sphinx it might work, but let's not turn it on until someone confirms that it
# actually works.
Ville M. Vainio
more crlf
r1033 if os_name == 'windows' and 'sdist' in sys.argv:
print 'The sdist command is not available under Windows. Exiting.'
sys.exit(1)
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 #-------------------------------------------------------------------------------
# Things related to the IPython documentation
#-------------------------------------------------------------------------------
Ville M. Vainio
more crlf
r1033 # update the manuals when building a source dist
if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
Ville M. Vainio
Updated setup.py and do_sphinx.py for new manual distribution
r1188 import textwrap
Fernando Perez
Finish doc/build tools cleanup....
r1207
# List of things to be updated. Each entry is a triplet of args for
Ville M. Vainio
more crlf
r1033 # target_update()
Brian E Granger
Finished initial reworking and updating of setup.py and friends, including the MANIFEST.in. Everything seems...
r1244 to_update = [
Fernando Perez
Finish doc/build tools cleanup....
r1207 # FIXME - Disabled for now: we need to redo an automatic way
# of generating the magic info inside the rst.
Fernando Perez
Fixes to build system.
r1522 #('docs/magic.tex',
Fernando Perez
Finish doc/build tools cleanup....
r1207 #['IPython/Magic.py'],
#"cd doc && ./update_magic.sh" ),
Fernando Perez
Update setup and support tools to include new man pages.
r2100
('docs/man/ipcluster.1.gz',
['docs/man/ipcluster.1'],
'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
('docs/man/ipcontroller.1.gz',
['docs/man/ipcontroller.1'],
'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
('docs/man/ipengine.1.gz',
['docs/man/ipengine.1'],
'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
Fernando Perez
Fixes to build system.
r1522 ('docs/man/ipython.1.gz',
['docs/man/ipython.1'],
Fernando Perez
Update setup and support tools to include new man pages.
r2100 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
('docs/man/ipython-wx.1.gz',
['docs/man/ipython-wx.1'],
'cd docs/man && gzip -9c ipython-wx.1 > ipython-wx.1.gz'),
('docs/man/ipythonx.1.gz',
['docs/man/ipythonx.1'],
'cd docs/man && gzip -9c ipythonx.1 > ipythonx.1.gz'),
('docs/man/irunner.1.gz',
['docs/man/irunner.1'],
'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'),
Fernando Perez
Finish doc/build tools cleanup....
r1207
Fernando Perez
Fixes to build system.
r1522 ('docs/man/pycolor.1.gz',
['docs/man/pycolor.1'],
Fernando Perez
Update setup and support tools to include new man pages.
r2100 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'),
Fernando Perez
Finish doc/build tools cleanup....
r1207 ]
Fernando Perez
Final updates for releasing the 0.9.rc1....
r1596 # Only build the docs if sphinx is present
Brian E Granger
Finished initial reworking and updating of setup.py and friends, including the MANIFEST.in. Everything seems...
r1244 try:
import sphinx
except ImportError:
pass
else:
Fernando Perez
Final updates for releasing the 0.9.rc1....
r1596 # The Makefile calls the do_sphinx scripts to build html and pdf, so
# just one target is enough to cover all manual generation
# First, compute all the dependencies that can force us to rebuild the
# docs. Start with the main release file that contains metadata
Brian Granger
Fixing installation related issues.
r2058 docdeps = ['IPython/core/release.py']
Fernando Perez
Final updates for releasing the 0.9.rc1....
r1596 # Inculde all the reST sources
pjoin = os.path.join
for dirpath,dirnames,filenames in os.walk('docs/source'):
if dirpath in ['_static','_templates']:
continue
docdeps += [ pjoin(dirpath,f) for f in filenames
if f.endswith('.txt') ]
# and the examples
for dirpath,dirnames,filenames in os.walk('docs/example'):
docdeps += [ pjoin(dirpath,f) for f in filenames
if not f.endswith('~') ]
# then, make them all dependencies for the main PDF (the html will get
# auto-generated as well).
to_update.append(
('docs/dist/ipython.pdf',
docdeps,
"cd docs && make dist")
)
Fernando Perez
Fixes to build/setup machinery....
r1525
Fernando Perez
Finish doc/build tools cleanup....
r1207 [ target_update(*t) for t in to_update ]
Fernando Perez
Fixes to build/setup machinery....
r1525
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 #---------------------------------------------------------------------------
# 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
#---------------------------------------------------------------------------
Fernando Perez
Improve setuptools support....
r2422 # For some commands, use setuptools. Note that we do NOT list install here!
# If you want a setuptools-enhanced install, just run 'setupegg.py install'
if len(set(('develop', 'sdist', 'release', 'bdist_egg', 'bdist_rpm',
'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info',
'build_sphinx', 'egg_info', 'easy_install', 'upload',
)).intersection(sys.argv)) > 0:
import setuptools
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 # This dict is used for passing extra arguments that are setuptools
# specific to setup
setuptools_extra_args = {}
Ville M. Vainio
more crlf
r1033
if 'setuptools' in sys.modules:
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 setuptools_extra_args['zip_safe'] = False
setuptools_extra_args['entry_points'] = {
'console_scripts': [
Brian Granger
Removed ipapi compatability layer and updated top-level functions....
r2269 'ipython = IPython.core.ipapp:launch_new_instance',
Brian Granger
Fixing installation related issues.
r2058 'pycolor = IPython.utils.PyColorize:main',
Brian Granger
Work on ipcontroller....
r2296 'ipcontroller = IPython.kernel.ipcontrollerapp:launch_new_instance',
Brian Granger
The ipengine script has been refactored to use the new config system....
r2299 'ipengine = IPython.kernel.ipengineapp:launch_new_instance',
Brian Granger
Semi-working refactored ipcluster....
r2302 'ipcluster = IPython.kernel.ipclusterapp:launch_new_instance',
Fernando Perez
Fix decorator bug and update build scripts to use setuptools for iptest.
r1570 'ipythonx = IPython.frontend.wx.ipythonx:main',
'iptest = IPython.testing.iptest:main',
Brian Granger
Fixing installation related issues.
r2058 'irunner = IPython.lib.irunner:main'
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 ]
}
Brian Granger
Skipping a few tests related to the wx frontend that fail on Windows.
r1561 setup_args['extras_require'] = dict(
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 kernel = [
Brian Granger
Skipping a few tests related to the wx frontend that fail on Windows.
r1561 'zope.interface>=3.4.1',
'Twisted>=8.0.1',
'foolscap>=0.2.6'
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 ],
Brian Granger
Skipping a few tests related to the wx frontend that fail on Windows.
r1561 doc='Sphinx>=0.3',
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 test='nose>=0.10.1',
Brian Granger
Skipping a few tests related to the wx frontend that fail on Windows.
r1561 security='pyOpenSSL>=0.6'
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 )
# Allow setuptools to handle the scripts
scripts = []
Ville M. Vainio
more crlf
r1033 else:
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 # 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)
Fernando Perez
Move cleanup to main setup.py, where it belongs....
r2460
Brian E Granger
Initial work towards refactoring the setup.py scripts to accept the new ipython1 packages...
r1237 if __name__ == '__main__':
setup(**setup_args)
Fernando Perez
Move cleanup to main setup.py, where it belongs....
r2460 cleanup()