setup.py 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. find_packages,
  35. find_package_data,
  36. js_prerelease,
  37. CheckAssets,
  38. version_ns,
  39. name
  40. )
  41. here = os.path.dirname(os.path.abspath(__file__))
  42. pjoin = os.path.join
  43. DESCRIPTION = 'An alpha preview of the JupyterLab notebook server extension.'
  44. 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.'
  45. setup_args = dict(
  46. name = name,
  47. description = DESCRIPTION,
  48. long_description = LONG_DESCRIPTION,
  49. version = version_ns['__version__'],
  50. scripts = glob(pjoin('scripts', '*')),
  51. packages = find_packages(),
  52. package_data = find_package_data(),
  53. author = 'Jupyter Development Team',
  54. author_email = 'jupyter@googlegroups.com',
  55. url = 'http://jupyter.org',
  56. license = 'BSD',
  57. platforms = "Linux, Mac OS X, Windows",
  58. keywords = ['ipython', 'jupyter', 'Web'],
  59. classifiers = [
  60. 'Development Status :: 3 - Alpha',
  61. 'Intended Audience :: Developers',
  62. 'Intended Audience :: System Administrators',
  63. 'Intended Audience :: Science/Research',
  64. 'License :: OSI Approved :: BSD License',
  65. 'Programming Language :: Python',
  66. 'Programming Language :: Python :: 2.7',
  67. 'Programming Language :: Python :: 3',
  68. 'Programming Language :: Python :: 3.3',
  69. 'Programming Language :: Python :: 3.4',
  70. 'Programming Language :: Python :: 3.5',
  71. ],
  72. )
  73. cmdclass = dict(
  74. build_py = build_py,
  75. build_ext = build_ext,
  76. sdist = js_prerelease(sdist, strict=True),
  77. bdist_egg = bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled,
  78. jsdeps = CheckAssets,
  79. )
  80. try:
  81. from wheel.bdist_wheel import bdist_wheel
  82. cmdclass['bdist_wheel'] = js_prerelease(bdist_wheel, strict=True)
  83. except ImportError:
  84. pass
  85. setup_args['cmdclass'] = cmdclass
  86. setuptools_args = {}
  87. install_requires = setuptools_args['install_requires'] = [
  88. 'notebook>=4.3.1',
  89. 'jupyterlab_launcher>=0.5.0'
  90. ]
  91. extras_require = setuptools_args['extras_require'] = {
  92. 'test:python_version == "2.7"': ['mock'],
  93. 'test': ['pytest', 'requests'],
  94. 'docs': [
  95. 'sphinx',
  96. 'recommonmark',
  97. 'sphinx_rtd_theme'
  98. ],
  99. }
  100. if 'setuptools' in sys.modules:
  101. setup_args.update(setuptools_args)
  102. # force entrypoints with setuptools (needed for Windows, unconditional because of wheels)
  103. setup_args['entry_points'] = {
  104. 'console_scripts': [
  105. 'jupyter-lab = jupyterlab.labapp:main',
  106. 'jupyter-labextension = jupyterlab.labextensions:main',
  107. 'jupyter-labhub = jupyterlab.labhubapp:main'
  108. ]
  109. }
  110. setup_args.pop('scripts', None)
  111. setup_args.update(setuptools_args)
  112. if __name__ == '__main__':
  113. setup(**setup_args)