forked from wkentaro/labelme
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
89 lines (76 loc) · 2.52 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
from distutils.command.build_py import build_py as BuildPyCommand
from distutils.spawn import find_executable
import os.path as osp
from setuptools import find_packages
from setuptools import setup
import shlex
import subprocess
import sys
version = '2.6.4'
try:
import PyQt5 # NOQA
PYQT_VERSION = 5
except ImportError:
try:
import PyQt4 # NOQA
PYQT_VERSION = 4
except ImportError:
sys.stderr.write('Please install PyQt4 or PyQt5.\n')
sys.exit(1)
if sys.argv[1] == 'release':
commands = [
'git tag v{:s}'.format(version),
'git push origin master --tag',
'python setup.py sdist',
'twine upload dist/labelme-{:s}.tar.gz'.format(version),
]
sys.exit(sum(subprocess.call(shlex.split(cmd)) for cmd in commands))
here = osp.dirname(osp.abspath(__file__))
class LabelmeBuildPyCommand(BuildPyCommand):
def run(self):
pyrcc = 'pyrcc{:d}'.format(PYQT_VERSION)
if find_executable(pyrcc) is None:
sys.stderr.write('Please install {:s} command.\n'.format(pyrcc))
sys.stderr.write('(See https://github.com/wkentaro/labelme.git)\n')
sys.exit(1)
package_dir = osp.join(here, 'labelme')
src = 'resources.qrc'
dst = 'resources.py'
cmd = '{pyrcc} -o {dst} {src}'.format(pyrcc=pyrcc, src=src, dst=dst)
print('+ {:s}'.format(cmd))
subprocess.call(shlex.split(cmd), cwd=package_dir)
BuildPyCommand.run(self)
setup(
name='labelme',
version=version,
packages=find_packages(),
cmdclass={'build_py': LabelmeBuildPyCommand},
description='Annotation Tool for Object Segmentation.',
long_description=open('README.md').read(),
author='Kentaro Wada',
author_email='[email protected]',
url='https://github.com/wkentaro/labelme',
install_requires=[
'matplotlib',
'Pillow>=2.8.0',
'scipy',
'six',
'PyYAML',
],
license='GPLv3',
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',
],
package_data={'labelme': ['icons/*', 'resources.qrc']},
entry_points={'console_scripts': ['labelme=labelme.app:main']},
scripts=[
'scripts/labelme_draw_json',
'scripts/labelme_json_to_dataset',
'scripts/labelme_on_docker',
],
)