| 1 |
# -*- coding: utf-8 -*- |
| 2 |
"""Setup script for IPython. |
| 3 |
|
| 4 |
Under Posix environments it works like a typical setup.py script. |
| 5 |
Under Windows, the command sdist is not supported, since IPython |
| 6 |
requires utilities which are not available under Windows.""" |
| 7 |
|
| 8 |
#----------------------------------------------------------------------------- |
| 9 |
# Copyright (c) 2008-2011, IPython Development Team. |
| 10 |
# Copyright (c) 2001-2007, Fernando Perez <[email protected]> |
| 11 |
# Copyright (c) 2001, Janko Hauser <[email protected]> |
| 12 |
# Copyright (c) 2001, Nathaniel Gray <[email protected]> |
| 13 |
# |
| 14 |
# Distributed under the terms of the Modified BSD License. |
| 15 |
# |
| 16 |
# The full license is in the file COPYING.rst, distributed with this software. |
| 17 |
#----------------------------------------------------------------------------- |
| 18 |
|
| 19 |
import os |
| 20 |
import sys |
| 21 |
|
| 22 |
# At least we're on the python version we need, move on. |
| 23 |
|
| 24 |
from setuptools import setup |
| 25 |
|
| 26 |
# Our own imports |
| 27 |
|
| 28 |
from setupbase import target_update |
| 29 |
|
| 30 |
from setupbase import ( |
| 31 |
setup_args, |
| 32 |
check_package_data_first, |
| 33 |
find_data_files, |
| 34 |
git_prebuild, |
| 35 |
) |
| 36 |
|
| 37 |
#------------------------------------------------------------------------------- |
| 38 |
# Things related to the IPython documentation |
| 39 |
#------------------------------------------------------------------------------- |
| 40 |
|
| 41 |
# update the manuals when building a source dist |
| 42 |
if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
| 43 |
|
| 44 |
# List of things to be updated. Each entry is a triplet of args for |
| 45 |
# target_update() |
| 46 |
to_update = [ |
| 47 |
( |
| 48 |
"docs/man/ipython.1.gz", |
| 49 |
["docs/man/ipython.1"], |
| 50 |
"cd docs/man && python -m gzip --best ipython.1", |
| 51 |
), |
| 52 |
] |
| 53 |
|
| 54 |
|
| 55 |
[ target_update(*t) for t in to_update ] |
| 56 |
|
| 57 |
#--------------------------------------------------------------------------- |
| 58 |
# Find all the packages, package data, and data_files |
| 59 |
#--------------------------------------------------------------------------- |
| 60 |
|
| 61 |
data_files = find_data_files() |
| 62 |
|
| 63 |
setup_args['data_files'] = data_files |
| 64 |
|
| 65 |
#--------------------------------------------------------------------------- |
| 66 |
# custom distutils commands |
| 67 |
#--------------------------------------------------------------------------- |
| 68 |
# imports here, so they are after setuptools import if there was one |
| 69 |
from setuptools.command.sdist import sdist |
| 70 |
|
| 71 |
setup_args['cmdclass'] = { |
| 72 |
'build_py': \ |
| 73 |
check_package_data_first(git_prebuild('IPython')), |
| 74 |
'sdist' : git_prebuild('IPython', sdist), |
| 75 |
} |
| 76 |
|
| 77 |
#--------------------------------------------------------------------------- |
| 78 |
# Do the actual setup now |
| 79 |
#--------------------------------------------------------------------------- |
| 80 |
|
| 81 |
if __name__ == "__main__": |
| 82 |
setup(**setup_args) |