2011-10-10 02:28:13 +08:00
|
|
|
#!/usr/bin/env python
|
2011-12-09 06:34:22 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
2015-04-11 04:20:40 +08:00
|
|
|
"""Setup script for Jupyter Notebook"""
|
2011-12-09 06:34:22 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
2015-04-11 04:20:40 +08:00
|
|
|
# Copyright (c) 2015-, Jupyter Development Team.
|
|
|
|
# Copyright (c) 2008-2015, IPython Development Team.
|
2011-12-09 06:34:22 +08:00
|
|
|
#
|
|
|
|
# Distributed under the terms of the Modified BSD License.
|
|
|
|
#
|
2015-04-11 04:20:40 +08:00
|
|
|
# The full license is in the file COPYING.md, distributed with this software.
|
2011-12-09 06:34:22 +08:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
2015-04-11 04:20:40 +08:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2015-05-14 01:56:32 +08:00
|
|
|
name = "notebook"
|
2015-04-11 04:20:40 +08:00
|
|
|
|
2011-12-09 06:34:22 +08:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Minimal Python version sanity check
|
|
|
|
#-----------------------------------------------------------------------------
|
2010-01-17 08:57:22 +08:00
|
|
|
|
|
|
|
import sys
|
|
|
|
|
2014-04-03 02:59:27 +08:00
|
|
|
v = sys.version_info
|
|
|
|
if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,3)):
|
2015-04-11 04:20:40 +08:00
|
|
|
error = "ERROR: %s requires Python version 2.7 or 3.3 or above." % name
|
2013-09-10 02:13:28 +08:00
|
|
|
print(error, file=sys.stderr)
|
|
|
|
sys.exit(1)
|
2011-12-09 06:34:22 +08:00
|
|
|
|
|
|
|
PY3 = (sys.version_info[0] >= 3)
|
|
|
|
|
|
|
|
# At least we're on the python version we need, move on.
|
|
|
|
|
2015-04-11 04:20:40 +08:00
|
|
|
|
2011-12-09 06:34:22 +08:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Imports
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
from glob import glob
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
# Our own imports
|
|
|
|
|
|
|
|
from setupbase import (
|
2015-04-11 04:20:40 +08:00
|
|
|
version,
|
2011-12-09 06:34:22 +08:00
|
|
|
find_packages,
|
|
|
|
find_package_data,
|
2014-02-08 06:12:53 +08:00
|
|
|
check_package_data_first,
|
2013-09-15 03:21:05 +08:00
|
|
|
CompileCSS,
|
2015-05-05 06:51:56 +08:00
|
|
|
CompileJS,
|
2015-04-12 07:19:00 +08:00
|
|
|
Bower,
|
2013-10-26 05:01:31 +08:00
|
|
|
JavascriptVersion,
|
2014-07-24 05:19:27 +08:00
|
|
|
css_js_prerelease,
|
2011-12-09 06:34:22 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
isfile = os.path.isfile
|
|
|
|
pjoin = os.path.join
|
|
|
|
|
2015-04-11 04:20:40 +08:00
|
|
|
setup_args = dict(
|
|
|
|
name = name,
|
|
|
|
description = "",
|
|
|
|
version = version,
|
|
|
|
scripts = glob(pjoin('scripts', '*')),
|
|
|
|
packages = find_packages(),
|
|
|
|
package_data = find_package_data(),
|
|
|
|
author = 'Jupyter Development Team',
|
|
|
|
author_email = 'jupyter@googlegroups.com',
|
|
|
|
url = 'http://jupyter.org',
|
|
|
|
license = 'BSD',
|
|
|
|
platforms = "Linux, Mac OS X, Windows",
|
|
|
|
keywords = ['Interactive', 'Interpreter', 'Shell', 'Web'],
|
|
|
|
classifiers = [
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'Intended Audience :: System Administrators',
|
|
|
|
'Intended Audience :: Science/Research',
|
|
|
|
'License :: OSI Approved :: BSD License',
|
|
|
|
'Programming Language :: Python',
|
|
|
|
'Programming Language :: Python :: 2.7',
|
|
|
|
'Programming Language :: Python :: 3',
|
|
|
|
'Programming Language :: Python :: 3.3',
|
|
|
|
],
|
|
|
|
)
|
2011-12-09 06:34:22 +08:00
|
|
|
|
|
|
|
|
2013-05-01 07:18:52 +08:00
|
|
|
|
2011-12-09 06:34:22 +08:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
# Find all the packages, package data, and data_files
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
packages = find_packages()
|
|
|
|
package_data = find_package_data()
|
2014-02-06 13:36:49 +08:00
|
|
|
|
2012-07-01 04:41:30 +08:00
|
|
|
#---------------------------------------------------------------------------
|
2012-07-01 06:17:46 +08:00
|
|
|
# custom distutils commands
|
2012-07-01 04:41:30 +08:00
|
|
|
#---------------------------------------------------------------------------
|
2012-07-01 06:17:46 +08:00
|
|
|
# imports here, so they are after setuptools import if there was one
|
2015-04-11 04:20:40 +08:00
|
|
|
from distutils.command.build_py import build_py
|
2012-07-01 06:17:46 +08:00
|
|
|
from distutils.command.sdist import sdist
|
2015-04-11 04:20:40 +08:00
|
|
|
|
2012-07-01 04:41:30 +08:00
|
|
|
|
2012-07-01 06:17:46 +08:00
|
|
|
setup_args['cmdclass'] = {
|
2014-07-24 06:33:08 +08:00
|
|
|
'build_py': css_js_prerelease(
|
2015-04-11 04:20:40 +08:00
|
|
|
check_package_data_first(build_py)),
|
2015-05-05 06:51:56 +08:00
|
|
|
'sdist' : css_js_prerelease(sdist, strict=True),
|
2013-09-15 03:21:05 +08:00
|
|
|
'css' : CompileCSS,
|
2015-05-05 06:51:56 +08:00
|
|
|
'js' : CompileJS,
|
|
|
|
'jsdeps' : Bower,
|
2013-10-26 05:01:31 +08:00
|
|
|
'jsversion' : JavascriptVersion,
|
2012-07-01 06:17:46 +08:00
|
|
|
}
|
2012-07-01 04:41:30 +08:00
|
|
|
|
2015-04-01 03:00:56 +08:00
|
|
|
|
|
|
|
|
2011-12-09 06:34:22 +08:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
# Handle scripts, dependencies, and setuptools specific things
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# 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'
|
|
|
|
needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
|
2014-01-31 10:46:23 +08:00
|
|
|
'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
|
|
|
|
'egg_info', 'easy_install', 'upload', 'install_egg_info',
|
2011-12-09 06:34:22 +08:00
|
|
|
))
|
|
|
|
|
|
|
|
if len(needs_setuptools.intersection(sys.argv)) > 0:
|
|
|
|
import setuptools
|
|
|
|
|
|
|
|
# This dict is used for passing extra arguments that are setuptools
|
|
|
|
# specific to setup
|
|
|
|
setuptools_extra_args = {}
|
|
|
|
|
2014-01-31 10:46:23 +08:00
|
|
|
# setuptools requirements
|
|
|
|
|
2015-02-06 06:16:19 +08:00
|
|
|
pyzmq = 'pyzmq>=13'
|
|
|
|
|
2015-04-11 04:20:40 +08:00
|
|
|
setup_args['scripts'] = glob(pjoin('scripts', '*'))
|
2014-06-04 05:37:23 +08:00
|
|
|
|
2014-10-08 06:55:45 +08:00
|
|
|
install_requires = [
|
2015-04-11 04:20:40 +08:00
|
|
|
'jinja2',
|
|
|
|
'tornado>=4',
|
|
|
|
'ipython_genutils',
|
2015-04-09 07:29:12 +08:00
|
|
|
'traitlets',
|
2015-04-11 04:20:40 +08:00
|
|
|
'jupyter_core',
|
|
|
|
'jupyter_client',
|
2015-05-09 05:15:23 +08:00
|
|
|
'nbformat',
|
2015-05-09 01:36:45 +08:00
|
|
|
'nbconvert',
|
2015-05-09 03:35:02 +08:00
|
|
|
'ipykernel', # bless IPython kernel for now
|
2014-10-08 06:55:45 +08:00
|
|
|
]
|
2015-04-11 04:20:40 +08:00
|
|
|
extras_require = {
|
|
|
|
':sys_platform != "win32"': ['terminado>=0.3.3'],
|
2015-04-14 00:40:49 +08:00
|
|
|
'doc': ['Sphinx>=1.1'],
|
2015-04-11 04:20:40 +08:00
|
|
|
'test:python_version == "2.7"': ['mock'],
|
|
|
|
'test': ['nose', 'requests'],
|
|
|
|
}
|
2014-01-31 10:46:23 +08:00
|
|
|
|
2011-12-09 06:34:22 +08:00
|
|
|
if 'setuptools' in sys.modules:
|
2013-05-01 07:18:52 +08:00
|
|
|
# setup.py develop should check for submodules
|
|
|
|
from setuptools.command.develop import develop
|
2015-04-12 07:19:00 +08:00
|
|
|
setup_args['cmdclass']['develop'] = css_js_prerelease(develop)
|
|
|
|
if not PY3:
|
|
|
|
setup_args['setup_requires'] = ['ipython_genutils']
|
2015-04-14 00:40:49 +08:00
|
|
|
|
2015-04-11 04:20:40 +08:00
|
|
|
try:
|
|
|
|
from wheel.bdist_wheel import bdist_wheel
|
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
setup_args['cmdclass']['bdist_wheel'] = css_js_prerelease(bdist_wheel)
|
2015-04-14 00:40:49 +08:00
|
|
|
|
2011-12-09 06:34:22 +08:00
|
|
|
setuptools_extra_args['zip_safe'] = False
|
2014-01-31 10:46:23 +08:00
|
|
|
setup_args['extras_require'] = extras_require
|
|
|
|
requires = setup_args['install_requires'] = install_requires
|
2011-12-09 06:34:22 +08:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
# Do the actual setup now
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
setup_args.update(setuptools_extra_args)
|
|
|
|
|
|
|
|
def main():
|
|
|
|
setup(**setup_args)
|
2010-01-13 13:03:16 +08:00
|
|
|
|
2011-12-09 06:34:22 +08:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|