setup.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. find_data_files,
  37. js_prerelease,
  38. CheckAssets,
  39. version_ns,
  40. name,
  41. custom_egg_info
  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. data_files = find_data_files(),
  56. include_package_data = True,
  57. author = 'Jupyter Development Team',
  58. author_email = 'jupyter@googlegroups.com',
  59. url = 'http://jupyter.org',
  60. license = 'BSD',
  61. platforms = "Linux, Mac OS X, Windows",
  62. keywords = ['ipython', 'jupyter', 'Web'],
  63. classifiers = [
  64. 'Development Status :: 3 - Alpha',
  65. 'Intended Audience :: Developers',
  66. 'Intended Audience :: System Administrators',
  67. 'Intended Audience :: Science/Research',
  68. 'License :: OSI Approved :: BSD License',
  69. 'Programming Language :: Python',
  70. 'Programming Language :: Python :: 2.7',
  71. 'Programming Language :: Python :: 3',
  72. 'Programming Language :: Python :: 3.3',
  73. 'Programming Language :: Python :: 3.4',
  74. 'Programming Language :: Python :: 3.5',
  75. ],
  76. )
  77. cmdclass = dict(
  78. build_py = build_py,
  79. build_ext = build_ext,
  80. sdist = js_prerelease(sdist, strict=True),
  81. bdist_egg = bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled,
  82. jsdeps = CheckAssets,
  83. egg_info = custom_egg_info
  84. )
  85. try:
  86. from wheel.bdist_wheel import bdist_wheel
  87. cmdclass['bdist_wheel'] = js_prerelease(bdist_wheel, strict=True)
  88. except ImportError:
  89. pass
  90. setup_args['cmdclass'] = cmdclass
  91. setuptools_args = {}
  92. install_requires = setuptools_args['install_requires'] = [
  93. 'notebook>=4.3.1',
  94. 'jupyterlab_launcher>=0.5.2,<0.6.0'
  95. ]
  96. extras_require = setuptools_args['extras_require'] = {
  97. 'test:python_version == "2.7"': ['mock'],
  98. 'test': ['pytest', 'requests'],
  99. 'docs': [
  100. 'sphinx',
  101. 'recommonmark',
  102. 'sphinx_rtd_theme'
  103. ],
  104. }
  105. if 'setuptools' in sys.modules:
  106. setup_args.update(setuptools_args)
  107. # force entrypoints with setuptools (needed for Windows, unconditional because of wheels)
  108. setup_args['entry_points'] = {
  109. 'console_scripts': [
  110. 'jupyter-lab = jupyterlab.labapp:main',
  111. 'jupyter-labextension = jupyterlab.labextensions:main',
  112. 'jupyter-labhub = jupyterlab.labhubapp:main'
  113. ]
  114. }
  115. setup_args.pop('scripts', None)
  116. setup_args.update(setuptools_args)
  117. if __name__ == '__main__':
  118. setup(**setup_args)