setup.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. from distutils.spawn import find_executable
  2. import os.path as osp
  3. from setuptools.command.develop import develop as DevelopCommand
  4. from setuptools.command.install import install as InstallCommand
  5. from setuptools import find_packages
  6. from setuptools import setup
  7. import shlex
  8. import subprocess
  9. import sys
  10. PY3 = sys.version_info[0] == 3
  11. PY2 = sys.version_info[0] == 2
  12. assert PY3 or PY2
  13. version = '2.11.0'
  14. install_requires = [
  15. 'matplotlib',
  16. 'numpy',
  17. 'Pillow>=2.8.0',
  18. 'PyYAML',
  19. ]
  20. try:
  21. import PyQt5 # NOQA
  22. PYQT_VERSION = 5
  23. except ImportError:
  24. try:
  25. import PyQt4 # NOQA
  26. PYQT_VERSION = 4
  27. except ImportError:
  28. if PY2:
  29. sys.stderr.write(
  30. 'Please install PyQt4 or PyQt5 for Python2.\n'
  31. 'Note that PyQt5 can be installed via pip for Python3.')
  32. sys.exit(1)
  33. assert PY3
  34. # PyQt5 can be installed via pip for Python3
  35. install_requires.append('pyqt5')
  36. PYQT_VERSION = 5
  37. if sys.argv[1] == 'release':
  38. commands = [
  39. 'git tag v{:s}'.format(version),
  40. 'git push origin master --tag',
  41. 'python setup.py sdist',
  42. 'twine upload dist/labelme-{:s}.tar.gz'.format(version),
  43. ]
  44. sys.exit(sum(subprocess.call(shlex.split(cmd)) for cmd in commands))
  45. setup(
  46. name='labelme',
  47. version=version,
  48. packages=find_packages(),
  49. description='Image Polygonal Annotation with Python.',
  50. long_description=open('README.md').read(),
  51. long_description_content_type='text/markdown',
  52. author='Kentaro Wada',
  53. author_email='www.kentaro.wada@gmail.com',
  54. url='https://github.com/wkentaro/labelme',
  55. install_requires=install_requires,
  56. license='GPLv3',
  57. keywords='Image Annotation, Machine Learning',
  58. classifiers=[
  59. 'Development Status :: 5 - Production/Stable',
  60. 'Intended Audience :: Developers',
  61. 'License :: OSI Approved :: MIT License',
  62. 'Operating System :: POSIX',
  63. 'Topic :: Internet :: WWW/HTTP',
  64. ],
  65. package_data={'labelme': ['icons/*']},
  66. entry_points={
  67. 'console_scripts': [
  68. 'labelme=labelme.app:main',
  69. 'labelme_draw_json=labelme.cli.draw_json:main',
  70. 'labelme_json_to_dataset=labelme.cli.json_to_dataset:main',
  71. 'labelme_on_docker=labelme.cli.on_docker:main',
  72. ],
  73. },
  74. )