setup.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. from distutils.command.build_py import build_py as BuildPyCommand
  2. from distutils.spawn import find_executable
  3. import os.path as osp
  4. from setuptools import find_packages
  5. from setuptools import setup
  6. import shlex
  7. import subprocess
  8. import sys
  9. version = '1.2.1'
  10. class LabelmeBuildPyCommand(BuildPyCommand):
  11. def run(self):
  12. this_dir = osp.dirname(osp.abspath(__file__))
  13. src = osp.join(this_dir, 'labelme/resources.qrc')
  14. dst = osp.join(this_dir, 'labelme/resources.py')
  15. if find_executable('pyrcc4') is None:
  16. sys.stderr.write('Please install pyrcc4 command.\n')
  17. sys.stderr.write('(See https://github.com/wkentaro/labelme.git)\n')
  18. sys.exit(1)
  19. cmd = 'pyrcc4 -o {1} {0}'.format(src, dst)
  20. print('converting {0} -> {1}'.format(src, dst))
  21. subprocess.call(shlex.split(cmd))
  22. BuildPyCommand.run(self)
  23. try:
  24. import PyQt4
  25. except ImportError:
  26. sys.stderr.write('Please install PyQt4.\n')
  27. sys.exit(1)
  28. setup(
  29. name='labelme',
  30. version=version,
  31. packages=find_packages(),
  32. cmdclass={'build_py': LabelmeBuildPyCommand},
  33. description='Simple Image Annotation Tool.',
  34. long_description=open('README.rst').read(),
  35. author='Kentaro Wada',
  36. author_email='www.kentaro.wada@gmail.com',
  37. url='https://github.com/mpitid/pylabelme',
  38. install_requires=[],
  39. license='GPLv3',
  40. keywords='Image Annotation, Machine Learning',
  41. classifiers=[
  42. 'Development Status :: 5 - Production/Stable',
  43. 'Intended Audience :: Developers',
  44. 'License :: OSI Approved :: MIT License',
  45. 'Operating System :: POSIX',
  46. 'Topic :: Internet :: WWW/HTTP',
  47. ],
  48. package_data={'labelme': ['icons', 'resources.qrc']},
  49. scripts=['scripts/labelme'],
  50. )