From b3e24ab76094e846cc905ef9aeed2459381e14f7 Mon Sep 17 00:00:00 2001 From: Andrey Zhavoronkov Date: Thu, 10 Dec 2020 12:19:38 +0300 Subject: [PATCH 1/3] ability to install opencv-python-headless instead opencv-python --- setup.py | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/setup.py b/setup.py index d0ea36e0cc..a5a7468b5d 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: MIT +import os import os.path as osp import re import setuptools @@ -27,6 +28,26 @@ def find_version(file_path=None): version = version_text[match.start(1) : match.end(1)] return version +def get_requirements(): + requirements = [ + 'attrs>=19.3.0', + 'defusedxml', + 'GitPython', + 'lxml', + 'matplotlib', + 'numpy>=1.17.3', + 'Pillow', + 'pycocotools', + 'PyYAML', + 'scikit-image', + 'tensorboardX', + ] + if os.getenv('HEADLESS') == '1': + requirements.append('opencv-python-headless') + else: + requirements.append('opencv-python') + + return requirements with open('README.md', 'r') as fh: long_description = fh.read() @@ -51,20 +72,7 @@ def find_version(file_path=None): "Operating System :: OS Independent", ], python_requires='>=3.5', - install_requires=[ - 'attrs>=19.3.0', - 'defusedxml', - 'GitPython', - 'lxml', - 'matplotlib', - 'numpy>=1.17.3', - 'opencv-python', - 'Pillow', - 'pycocotools', - 'PyYAML', - 'scikit-image', - 'tensorboardX', - ], + install_requires=get_requirements(), extras_require={ 'tf': ['tensorflow'], 'tf-gpu': ['tensorflow-gpu'], From 6ae0baf77e66b41837d7988a9ba67c2fab2565fb Mon Sep 17 00:00:00 2001 From: Andrey Zhavoronkov Date: Thu, 10 Dec 2020 12:49:01 +0300 Subject: [PATCH 2/3] fixed comment --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a5a7468b5d..7e08249839 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: MIT +from distutils.util import strtobool import os import os.path as osp import re @@ -42,7 +43,7 @@ def get_requirements(): 'scikit-image', 'tensorboardX', ] - if os.getenv('HEADLESS') == '1': + if strtobool(os.getenv('DATUMARO_HEADLESS', '0').lower()): requirements.append('opencv-python-headless') else: requirements.append('opencv-python') From 7a3d3afa16153ed41244fce5325ab67c58aa5e80 Mon Sep 17 00:00:00 2001 From: Andrey Zhavoronkov Date: Thu, 10 Dec 2020 15:28:27 +0300 Subject: [PATCH 3/3] Updated CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8f7859642..cb52426c95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added - `CamVid` dataset format () +- Ability to install `opencv-python-headless` dependency with `DATUMARO_HEADLESS=1` + enviroment variable instead of `opencv-python` () ### Changed -