diff --git a/Makefile b/Makefile index 303af1c8..89e90abd 100644 --- a/Makefile +++ b/Makefile @@ -15,13 +15,13 @@ qt4: qt4py2 qt5: qt5py3 qt4py2: - pyrcc4 -py2 -o resources.py resources.qrc + pyrcc4 -py2 -o lib/resources.py resources.qrc qt4py3: - pyrcc4 -py3 -o resources.py resources.qrc + pyrcc4 -py3 -o lib/resources.py resources.qrc qt5py3: - pyrcc5 -o resources.py resources.qrc + pyrcc5 -o lib/resources.py resources.qrc clean: rm -f ~/.labelImgSettings.pkl resources.pyc diff --git a/labelImg.py b/labelImg.py index b4cca861..6e0e03ac 100755 --- a/labelImg.py +++ b/labelImg.py @@ -26,8 +26,7 @@ except ImportError: from PyQt4.QtGui import * from PyQt4.QtCore import * -import resources -# Add internal libs +from libs.resources import * from libs.constants import * from libs.utils import * from libs.settings import Settings @@ -44,7 +43,6 @@ from libs.pascal_voc_io import XML_EXT from libs.yolo_io import YoloReader from libs.yolo_io import TXT_EXT from libs.ustr import ustr -from libs.version import __version__ from libs.hashableQListWidgetItem import HashableQListWidgetItem __appname__ = 'labelImg' @@ -603,7 +601,7 @@ class MainWindow(QMainWindow, WindowMixin): elif osName == 'Linux': return ['xdg-open'] elif osName == 'Darwin': - return ['open', '-a', 'Safari'] + return ['open'] ## Callbacks ## def showTutorialDialog(self): diff --git a/libs/__init__.py b/libs/__init__.py index e69de29b..af9f86bb 100644 --- a/libs/__init__.py +++ b/libs/__init__.py @@ -0,0 +1,2 @@ +__version_info__ = ('1', '8', '1') +__version__ = '.'.join(__version_info__) diff --git a/libs/version.py b/libs/version.py deleted file mode 100644 index af9f86bb..00000000 --- a/libs/version.py +++ /dev/null @@ -1,2 +0,0 @@ -__version_info__ = ('1', '8', '1') -__version__ = '.'.join(__version_info__) diff --git a/setup.py b/setup.py index e1485ffb..5f85c116 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,18 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from setuptools import setup, find_packages -from libs.version import __version__ +from setuptools import setup, find_packages, Command from sys import platform as _platform +from shutil import rmtree +import sys +import os + +here = os.path.abspath(os.path.dirname(__file__)) +NAME = 'labelImg' +about = {} + +with open(os.path.join(here, 'libs', '__init__.py')) as f: + exec(f.read(), about) with open('README.rst') as readme_file: readme = readme_file.read() @@ -11,9 +20,14 @@ with open('README.rst') as readme_file: with open('HISTORY.rst') as history_file: history = history_file.read() -requirements = [ - # TODO: Different OS have different requirements -] + +REQUIRED = [] + +if (sys.version_info > (3, 0)): + REQUIRED = ['pyqt5', 'lxml'] +else: + print('\033[93m For py2, you are unable to installl pyqt4 by pip \033[0m') + REQUIRED = ['lxml'] # OS specific settings SET_REQUIRES = [] @@ -27,7 +41,7 @@ elif _platform == "darwin": required_packages = find_packages() required_packages.append('labelImg') -APP = ['labelImg.py'] +APP = [NAME] OPTIONS = { 'argv_emulation': True, 'iconfile': 'resources/icons/app.icns' @@ -35,8 +49,8 @@ OPTIONS = { setup( app=APP, - name='labelImg', - version=__version__, + name=NAME, + version=about['__version__'], description="LabelImg is a graphical image annotation tool and label object bounding boxes in images", long_description=readme + '\n\n' + history, author="TzuTa Lin", @@ -50,7 +64,7 @@ setup( ] }, include_package_data=True, - install_requires=requirements, + install_requires=REQUIRED, license="MIT license", zip_safe=False, keywords='labelImg labelTool development annotation deeplearning',