summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/py-mmcv/opencv_for0.5.1.patch28
-rw-r--r--var/spack/repos/builtin/packages/py-mmcv/package.py2
2 files changed, 30 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/py-mmcv/opencv_for0.5.1.patch b/var/spack/repos/builtin/packages/py-mmcv/opencv_for0.5.1.patch
new file mode 100644
index 0000000000..ed139b084b
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-mmcv/opencv_for0.5.1.patch
@@ -0,0 +1,28 @@
+--- spack-src/setup.py.old 2020-10-28 10:48:02.800927663 +0900
++++ spack-src/setup.py 2020-10-28 10:49:44.755977753 +0900
+@@ -24,12 +24,20 @@
+
+ install_requires = ['addict', 'numpy', 'pyyaml']
+
+-# If first not installed install second package
+-CHOOSE_INSTALL_REQUIRES = [('opencv-python-headless>=3', 'opencv-python>=3')]
+-
+-for main, secondary in CHOOSE_INSTALL_REQUIRES:
+- install_requires.append(choose_requirement(main, secondary))
+
++try:
++ # OpenCV installed via conda.
++ import cv2 # NOQA: F401
++ major, minor, *rest = cv2.__version__.split('.')
++ if int(major) < 3:
++ raise RuntimeError(
++ f'OpenCV >=3 is required but {cv2.__version__} is installed')
++except ImportError:
++ # If first not installed install second package
++ CHOOSE_INSTALL_REQUIRES = [('opencv-python-headless>=3',
++ 'opencv-python>=3')]
++ for main, secondary in CHOOSE_INSTALL_REQUIRES:
++ install_requires.append(choose_requirement(main, secondary))
+
+ def readme():
+ with open('README.rst', encoding='utf-8') as f:
diff --git a/var/spack/repos/builtin/packages/py-mmcv/package.py b/var/spack/repos/builtin/packages/py-mmcv/package.py
index fbe0fdfe0a..c98d9014fc 100644
--- a/var/spack/repos/builtin/packages/py-mmcv/package.py
+++ b/var/spack/repos/builtin/packages/py-mmcv/package.py
@@ -22,3 +22,5 @@ class PyMmcv(PythonPackage):
depends_on('py-pyyaml', type=('build', 'run'))
depends_on('opencv+python', type=('build', 'run'))
depends_on('py-cython', type='build')
+
+ patch('opencv_for0.5.1.patch', when='@0.5.1')