setup.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3. # Copyright (c) Jupyter Development Team.
  4. # Distributed under the terms of the Modified BSD License.
  5. from __future__ import print_function
  6. #-----------------------------------------------------------------------------
  7. # Minimal Python version sanity check
  8. #-----------------------------------------------------------------------------
  9. import sys
  10. v = sys.version_info
  11. if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,3)):
  12. error = "ERROR: %s requires Python version 2.7 or 3.3 or above." % name
  13. print(error, file=sys.stderr)
  14. sys.exit(1)
  15. PY3 = (sys.version_info[0] >= 3)
  16. #-----------------------------------------------------------------------------
  17. # get on with it
  18. #-----------------------------------------------------------------------------
  19. from distutils import log
  20. import json
  21. import os
  22. from glob import glob
  23. # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
  24. # update it when the contents of directories change.
  25. if os.path.exists('MANIFEST'): os.remove('MANIFEST')
  26. from distutils.command.build_ext import build_ext
  27. from distutils.command.build_py import build_py
  28. from setuptools.command.sdist import sdist
  29. from setuptools import setup
  30. from setuptools.command.bdist_egg import bdist_egg
  31. # Our own imports
  32. from setupbase import (
  33. bdist_egg_disabled,
  34. ensure_core_data,
  35. find_packages,
  36. find_package_data,
  37. js_prerelease,
  38. CheckAssets,
  39. CoreDeps,
  40. version_ns,
  41. name
  42. )
  43. here = os.path.dirname(os.path.abspath(__file__))
  44. pjoin = os.path.join
  45. DESCRIPTION = 'An alpha preview of the JupyterLab notebook server extension.'
  46. LONG_DESCRIPTION = 'This is an alpha preview of JupyterLab. It is not ready for general usage yet. Development happens on https://github.com/jupyter/jupyterlab, with chat on https://gitter.im/jupyter/jupyterlab.'
  47. setup_args = dict(
  48. name = name,
  49. description = DESCRIPTION,
  50. long_description = LONG_DESCRIPTION,
  51. version = version_ns['__version__'],
  52. scripts = glob(pjoin('scripts', '*')),
  53. packages = find_packages(),
  54. package_data = find_package_data(),
  55. author = 'Jupyter Development Team',
  56. author_email = 'jupyter@googlegroups.com',
  57. url = 'http://jupyter.org',
  58. license = 'BSD',
  59. platforms = "Linux, Mac OS X, Windows",
  60. keywords = ['ipython', 'jupyter', 'Web'],
  61. classifiers = [
  62. 'Development Status :: 3 - Alpha',
  63. 'Intended Audience :: Developers',
  64. 'Intended Audience :: System Administrators',
  65. 'Intended Audience :: Science/Research',
  66. 'License :: OSI Approved :: BSD License',
  67. 'Programming Language :: Python',
  68. 'Programming Language :: Python :: 2.7',
  69. 'Programming Language :: Python :: 3',
  70. 'Programming Language :: Python :: 3.3',
  71. 'Programming Language :: Python :: 3.4',
  72. 'Programming Language :: Python :: 3.5',
  73. ],
  74. )
  75. cmdclass = dict(
  76. build_py = ensure_core_data(build_py),
  77. build_ext = ensure_core_data(build_ext),
  78. sdist = js_prerelease(sdist, strict=True),
  79. bdist_egg = bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled,
  80. jsdeps = CheckAssets,
  81. coredeps = CoreDeps,
  82. )
  83. try:
  84. from wheel.bdist_wheel import bdist_wheel
  85. cmdclass['bdist_wheel'] = js_prerelease(bdist_wheel, strict=True)
  86. except ImportError:
  87. pass
  88. setup_args['cmdclass'] = cmdclass
  89. setuptools_args = {}
  90. install_requires = setuptools_args['install_requires'] = [
  91. 'notebook>=4.3.1',
  92. 'jupyterlab_launcher>=0.3.0'
  93. ]
  94. extras_require = setuptools_args['extras_require'] = {
  95. 'test:python_version == "2.7"': ['mock'],
  96. 'test': ['pytest', 'requests'],
  97. 'docs': [
  98. 'sphinx',
  99. 'recommonmark',
  100. 'sphinx_rtd_theme'
  101. ],
  102. }
  103. if 'setuptools' in sys.modules:
  104. setup_args.update(setuptools_args)
  105. # force entrypoints with setuptools (needed for Windows, unconditional because of wheels)
  106. setup_args['entry_points'] = {
  107. 'console_scripts': [
  108. 'jupyter-lab = jupyterlab.labapp:main',
  109. 'jupyter-labextension = jupyterlab.labextensions:main',
  110. 'jupyter-labhub = jupyterlab.labhubapp:main'
  111. ]
  112. }
  113. setup_args.pop('scripts', None)
  114. setup_args.update(setuptools_args)
  115. if __name__ == '__main__':
  116. setup(**setup_args)