setup.py 2.3 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
2.3.1  
Kentaro Wada 已提交
11
version = '2.3.1'
K
2.0.0  
Kentaro Wada 已提交
12 13 14 15


if sys.argv[1] == 'release':
    for cmd in [
K
2.0.1  
Kentaro Wada 已提交
16
            'python setup.py sdist upload',
K
2.0.0  
Kentaro Wada 已提交
17
            'git tag v{0}'.format(version),
K
2.0.1  
Kentaro Wada 已提交
18
            'git push origin master --tag']:
K
2.0.0  
Kentaro Wada 已提交
19
        subprocess.call(shlex.split(cmd))
K
2.0.2  
Kentaro Wada 已提交
20
    sys.exit(0)
K
Kentaro Wada 已提交
21 22 23 24 25


class LabelmeBuildPyCommand(BuildPyCommand):

    def run(self):
K
Kentaro Wada 已提交
26 27 28 29
        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 已提交
30 31 32 33 34 35
        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 已提交
36
        cmd = 'pyrcc4 -o {1} {0}'.format(src, dst)
K
Kentaro Wada 已提交
37
        subprocess.call(shlex.split(cmd), cwd=package_dir)
38
        BuildPyCommand.run(self)
K
Kentaro Wada 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53


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 已提交
54
    long_description=open('README.md').read(),
K
Kentaro Wada 已提交
55 56
    author='Kentaro Wada',
    author_email='www.kentaro.wada@gmail.com',
K
Kentaro Wada 已提交
57
    url='https://github.com/mpitid/pylabelme',
58 59
    install_requires=[
        'matplotlib',
E
Eisoku Kuroiwa 已提交
60
        'Pillow>=2.8.0',
61 62
        'scipy',
        'scikit-image',
K
Kentaro Wada 已提交
63
        'PyYAML',
64
    ],
K
Kentaro Wada 已提交
65
    license='GPLv3',
K
Kentaro Wada 已提交
66 67 68 69 70 71 72 73
    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 已提交
74
    package_data={'labelme': ['icons/*', 'resources.qrc']},
K
Kentaro Wada 已提交
75
    entry_points={'console_scripts': ['labelme=labelme.app:main']},
K
Kentaro Wada 已提交
76 77 78 79 80
    scripts=[
        'scripts/labelme_draw_json',
        'scripts/labelme_json_to_dataset',
        'scripts/labelme_on_docker',
    ],
K
Kentaro Wada 已提交
81
)