setup.py 1.9 KB
Newer Older
K
Kentaro Wada 已提交
1
from distutils.command.build_py import build_py as BuildPyCommand
K
Kentaro Wada 已提交
2
from distutils.spawn import find_executable
K
Fix cwd  
Kentaro Wada 已提交
3
import os.path as osp
K
Kentaro Wada 已提交
4 5 6 7 8 9 10
from setuptools import find_packages
from setuptools import setup
import shlex
import subprocess
import sys


K
1.2.3  
Kentaro Wada 已提交
11
version = '1.2.3'
K
Kentaro Wada 已提交
12 13 14 15 16


class LabelmeBuildPyCommand(BuildPyCommand):

    def run(self):
K
Kentaro Wada 已提交
17 18 19 20
        if find_executable('pyrcc4') is None:
            sys.stderr.write('Please install pyrcc4 command.\n')
            sys.stderr.write('(See https://github.com/wkentaro/labelme.git)\n')
            sys.exit(1)
K
Kentaro Wada 已提交
21 22 23 24 25 26
        this_dir = osp.dirname(osp.abspath(__file__))
        package_dir = osp.join(this_dir, 'labelme')
        src = 'resources.qrc'
        dst = 'resources.py'
        print('converting {0} -> {1}'
              .format(osp.join(package_dir, src), osp.join(package_dir, dst)))
K
Fix cwd  
Kentaro Wada 已提交
27
        cmd = 'pyrcc4 -o {1} {0}'.format(src, dst)
K
Kentaro Wada 已提交
28
        subprocess.call(shlex.split(cmd), cwd=package_dir)
29
        BuildPyCommand.run(self)
K
Kentaro Wada 已提交
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44


try:
    import PyQt4
except ImportError:
    sys.stderr.write('Please install PyQt4.\n')
    sys.exit(1)


setup(
    name='labelme',
    version=version,
    packages=find_packages(),
    cmdclass={'build_py': LabelmeBuildPyCommand},
    description='Simple Image Annotation Tool.',
K
Kentaro Wada 已提交
45
    long_description=open('README.rst').read(),
K
Kentaro Wada 已提交
46 47
    author='Kentaro Wada',
    author_email='www.kentaro.wada@gmail.com',
K
Kentaro Wada 已提交
48 49
    url='https://github.com/mpitid/pylabelme',
    install_requires=[],
K
Kentaro Wada 已提交
50
    license='GPLv3',
K
Kentaro Wada 已提交
51 52 53 54 55 56 57 58
    keywords='Image Annotation, Machine Learning',
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: POSIX',
        'Topic :: Internet :: WWW/HTTP',
    ],
K
Kentaro Wada 已提交
59
    package_data={'labelme': ['icons/*', 'resources.qrc']},
K
Kentaro Wada 已提交
60
    entry_points={'console_scripts': ['labelme=labelme.app:main']},
K
Kentaro Wada 已提交
61
    scripts=['scripts/labelme_draw_json'],
K
Kentaro Wada 已提交
62
)