setup.py 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. from hashlib import sha256
  21. import json
  22. import os
  23. from glob import glob
  24. try:
  25. from urllib2 import urlopen
  26. except ImportError:
  27. from urllib.request import urlopen
  28. # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
  29. # update it when the contents of directories change.
  30. if os.path.exists('MANIFEST'): os.remove('MANIFEST')
  31. from distutils.command.build_ext import build_ext
  32. from distutils.command.build_py import build_py
  33. from setuptools.command.sdist import sdist
  34. from setuptools import setup
  35. from setuptools.command.bdist_egg import bdist_egg
  36. from setuptools import setup
  37. # Our own imports
  38. from setupbase import (
  39. bdist_egg_disabled,
  40. find_packages,
  41. find_package_data,
  42. find_data_files,
  43. js_prerelease,
  44. CheckAssets,
  45. version_ns,
  46. name,
  47. custom_egg_info
  48. )
  49. here = os.path.dirname(os.path.abspath(__file__))
  50. pjoin = os.path.join
  51. DESCRIPTION = 'An alpha preview of the JupyterLab notebook server extension.'
  52. 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.'
  53. setup_args = dict(
  54. name = name,
  55. description = DESCRIPTION,
  56. long_description = LONG_DESCRIPTION,
  57. version = version_ns['__version__'],
  58. scripts = glob(pjoin('scripts', '*')),
  59. packages = find_packages(),
  60. package_data = find_package_data(),
  61. data_files = find_data_files(),
  62. include_package_data = True,
  63. author = 'Jupyter Development Team',
  64. author_email = 'jupyter@googlegroups.com',
  65. url = 'http://jupyter.org',
  66. license = 'BSD',
  67. platforms = "Linux, Mac OS X, Windows",
  68. keywords = ['ipython', 'jupyter', 'Web'],
  69. classifiers = [
  70. 'Development Status :: 3 - Alpha',
  71. 'Intended Audience :: Developers',
  72. 'Intended Audience :: System Administrators',
  73. 'Intended Audience :: Science/Research',
  74. 'License :: OSI Approved :: BSD License',
  75. 'Programming Language :: Python',
  76. 'Programming Language :: Python :: 2.7',
  77. 'Programming Language :: Python :: 3',
  78. 'Programming Language :: Python :: 3.3',
  79. 'Programming Language :: Python :: 3.4',
  80. 'Programming Language :: Python :: 3.5',
  81. ],
  82. )
  83. cmdclass = dict(
  84. build_py = build_py,
  85. build_ext = build_ext,
  86. sdist = js_prerelease(sdist, strict=True),
  87. bdist_egg = bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled,
  88. jsdeps = CheckAssets,
  89. egg_info = custom_egg_info
  90. )
  91. try:
  92. from wheel.bdist_wheel import bdist_wheel
  93. cmdclass['bdist_wheel'] = js_prerelease(bdist_wheel, strict=True)
  94. except ImportError:
  95. pass
  96. setup_args['cmdclass'] = cmdclass
  97. setuptools_args = {}
  98. install_requires = setuptools_args['install_requires'] = [
  99. 'notebook>=4.3.1',
  100. 'jupyterlab_launcher>=0.6.0',
  101. 'ipython_genutils',
  102. "futures;python_version<'3.0'",
  103. "subprocess32;python_version<'3.0'"
  104. ]
  105. extras_require = setuptools_args['extras_require'] = {
  106. 'test:python_version == "2.7"': ['mock'],
  107. 'test': ['pytest', 'requests', 'pytest-check-links', 'selenium'],
  108. 'docs': [
  109. 'sphinx',
  110. 'recommonmark',
  111. 'sphinx_rtd_theme'
  112. ],
  113. }
  114. if 'setuptools' in sys.modules:
  115. setup_args.update(setuptools_args)
  116. # force entrypoints with setuptools (needed for Windows, unconditional because of wheels)
  117. setup_args['entry_points'] = {
  118. 'console_scripts': [
  119. 'jupyter-lab = jupyterlab.labapp:main',
  120. 'jupyter-labextension = jupyterlab.labextensions:main',
  121. 'jupyter-labhub = jupyterlab.labhubapp:main',
  122. 'jlpm = jupyterlab.jlpmapp:main',
  123. ]
  124. }
  125. setup_args.pop('scripts', None)
  126. setup_args.update(setuptools_args)
  127. if __name__ == '__main__':
  128. setup(**setup_args)