setup.py 1.7 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.1  
Kentaro Wada 已提交
11
version = '1.2.1'
K
Kentaro Wada 已提交
12 13 14 15 16


class LabelmeBuildPyCommand(BuildPyCommand):

    def run(self):
K
Kentaro Wada 已提交
17 18 19
        this_dir = osp.dirname(osp.abspath(__file__))
        src = osp.join(this_dir, 'labelme/resources.qrc')
        dst = osp.join(this_dir, 'labelme/resources.py')
K
Kentaro Wada 已提交
20 21 22 23
        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
Fix cwd  
Kentaro Wada 已提交
24
        cmd = 'pyrcc4 -o {1} {0}'.format(src, dst)
K
Kentaro Wada 已提交
25
        print('converting {0} -> {1}'.format(src, dst))
K
Kentaro Wada 已提交
26
        subprocess.call(shlex.split(cmd))
27
        BuildPyCommand.run(self)
K
Kentaro Wada 已提交
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42


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 已提交
43
    long_description=open('README.rst').read(),
K
Kentaro Wada 已提交
44 45
    author='Kentaro Wada',
    author_email='www.kentaro.wada@gmail.com',
K
Kentaro Wada 已提交
46 47
    url='https://github.com/mpitid/pylabelme',
    install_requires=[],
K
Kentaro Wada 已提交
48
    license='GPLv3',
K
Kentaro Wada 已提交
49 50 51 52 53 54 55 56
    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 已提交
57
    package_data={'labelme': ['icons', 'resources.qrc']},
K
Kentaro Wada 已提交
58 59
    scripts=['scripts/labelme'],
)