2008-02-29 02:30:23 +08:00
|
|
|
#!/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
|
2008-05-29 11:15:04 +08:00
|
|
|
requires utilities which are not available under Windows."""
|
2008-02-29 02:30:23 +08:00
|
|
|
|
2008-06-07 06:16:36 +08:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Copyright (C) 2008 The IPython Development Team
|
2008-02-29 02:30:23 +08:00
|
|
|
#
|
|
|
|
# Distributed under the terms of the BSD License. The full license is in
|
|
|
|
# the file COPYING, distributed as part of this software.
|
2008-06-07 06:16:36 +08:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Imports
|
|
|
|
#-------------------------------------------------------------------------------
|
2008-02-29 02:30:23 +08:00
|
|
|
|
|
|
|
# Stdlib imports
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from glob import glob
|
2008-05-29 11:15:04 +08:00
|
|
|
|
|
|
|
# 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
|
2008-02-29 02:30:23 +08:00
|
|
|
|
2008-05-29 11:15:04 +08:00
|
|
|
# Local imports
|
|
|
|
from IPython.genutils import target_update
|
|
|
|
|
2008-06-07 06:16:36 +08:00
|
|
|
from setupbase import (
|
|
|
|
setup_args,
|
|
|
|
find_packages,
|
|
|
|
find_package_data,
|
|
|
|
find_scripts,
|
|
|
|
find_data_files,
|
|
|
|
check_for_dependencies
|
|
|
|
)
|
|
|
|
|
2008-02-29 02:30:23 +08:00
|
|
|
isfile = os.path.isfile
|
2008-06-07 06:16:36 +08:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Handle OS specific things
|
|
|
|
#-------------------------------------------------------------------------------
|
2008-02-29 02:30:23 +08:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2008-05-29 11:15:04 +08:00
|
|
|
# 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.
|
2008-02-29 02:30:23 +08:00
|
|
|
if os_name == 'windows' and 'sdist' in sys.argv:
|
|
|
|
print 'The sdist command is not available under Windows. Exiting.'
|
|
|
|
sys.exit(1)
|
|
|
|
|
2008-06-07 06:16:36 +08:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Things related to the IPython documentation
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
2008-02-29 02:30:23 +08:00
|
|
|
# update the manuals when building a source dist
|
|
|
|
if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
|
2008-05-23 00:44:30 +08:00
|
|
|
import textwrap
|
2008-05-29 11:15:04 +08:00
|
|
|
|
|
|
|
# List of things to be updated. Each entry is a triplet of args for
|
2008-02-29 02:30:23 +08:00
|
|
|
# target_update()
|
2008-06-09 06:25:02 +08:00
|
|
|
to_update = [
|
2008-05-29 11:15:04 +08:00
|
|
|
# FIXME - Disabled for now: we need to redo an automatic way
|
|
|
|
# of generating the magic info inside the rst.
|
|
|
|
#('doc/magic.tex',
|
|
|
|
#['IPython/Magic.py'],
|
|
|
|
#"cd doc && ./update_magic.sh" ),
|
|
|
|
|
|
|
|
('doc/ipython.1.gz',
|
|
|
|
['doc/ipython.1'],
|
|
|
|
"cd doc && gzip -9c ipython.1 > ipython.1.gz"),
|
|
|
|
|
|
|
|
('doc/pycolor.1.gz',
|
|
|
|
['doc/pycolor.1'],
|
|
|
|
"cd doc && gzip -9c pycolor.1 > pycolor.1.gz"),
|
|
|
|
]
|
|
|
|
|
2008-06-12 06:01:38 +08:00
|
|
|
# Only build the docs is sphinx is present
|
2008-06-09 06:25:02 +08:00
|
|
|
try:
|
|
|
|
import sphinx
|
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
else:
|
2008-06-12 06:03:52 +08:00
|
|
|
pass
|
2008-06-12 06:01:38 +08:00
|
|
|
# BEG: This is disabled as I am not sure what to depend on.
|
|
|
|
# I actually don't think we should be automatically building
|
|
|
|
# the docs for people.
|
2008-06-09 06:25:02 +08:00
|
|
|
# The do_sphinx scripts builds html and pdf, so just one
|
|
|
|
# target is enough to cover all manual generation
|
2008-06-12 06:01:38 +08:00
|
|
|
# to_update.append(
|
|
|
|
# ('doc/manual/ipython.pdf',
|
|
|
|
# ['IPython/Release.py','doc/source/ipython.rst'],
|
|
|
|
# "cd docs && python do_sphinx.py")
|
2008-06-12 06:03:52 +08:00
|
|
|
# )
|
2008-05-29 11:15:04 +08:00
|
|
|
[ target_update(*t) for t in to_update ]
|
2008-02-29 02:30:23 +08:00
|
|
|
|
2008-06-07 06:16:36 +08:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
# 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 = {}
|
2008-02-29 02:30:23 +08:00
|
|
|
|
|
|
|
if 'setuptools' in sys.modules:
|
2008-06-07 06:16:36 +08:00
|
|
|
setuptools_extra_args['zip_safe'] = False
|
|
|
|
setuptools_extra_args['entry_points'] = {
|
|
|
|
'console_scripts': [
|
2008-02-29 02:30:23 +08:00
|
|
|
'ipython = IPython.ipapi:launch_new_instance',
|
2008-06-07 06:16:36 +08:00
|
|
|
'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 = []
|
2008-05-29 11:15:04 +08:00
|
|
|
# eggs will lack docs, examples
|
2008-06-07 06:16:36 +08:00
|
|
|
data_files = []
|
2008-02-29 02:30:23 +08:00
|
|
|
else:
|
2008-05-04 00:06:46 +08:00
|
|
|
# package_data of setuptools was introduced to distutils in 2.4
|
2008-06-07 06:16:36 +08:00
|
|
|
cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
|
2008-05-04 00:06:46 +08:00
|
|
|
if sys.version_info < (2,4):
|
2008-06-07 06:16:36 +08:00
|
|
|
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)
|