From cf0f5756f55a0bb3390975950a7f12b18833262d Mon Sep 17 00:00:00 2001 From: mwilliammyers Date: Tue, 12 Jul 2016 20:27:21 -0600 Subject: [PATCH] opencv : Fix python extensions issues --- .../repos/builtin/packages/opencv/package.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/var/spack/repos/builtin/packages/opencv/package.py b/var/spack/repos/builtin/packages/opencv/package.py index 9c17cff591..3d887f0775 100644 --- a/var/spack/repos/builtin/packages/opencv/package.py +++ b/var/spack/repos/builtin/packages/opencv/package.py @@ -58,6 +58,8 @@ class Opencv(Package): depends_on('eigen', when='+eigen') depends_on('cuda', when='+cuda') + extends('python') + # FIXME : GUI extensions missing def install(self, spec, prefix): @@ -70,6 +72,19 @@ def install(self, spec, prefix): '-DWITH_IPP:BOOL=%s' % ('ON' if '+ipp' in spec else 'OFF'), '-DWITH_CUDA:BOOL=%s' % ('ON' if '+cuda' in spec else 'OFF')]) + python_prefix = spec['python'].prefix + python_lib = python_prefix.lib + if spec.satisfies('^python@3:'): + python = join_path(python_prefix.bin, 'python3') + cmake_options.extend(['-DBUILD_opencv_python3=ON', + '-DPYTHON_EXECUTABLE={0}'.format(python), + '-DPYTHON_LIBRARIES={0}'.format(python_lib)]) + elif spec.satisfies('^python@2:3'): + python = join_path(python_prefix.bin, 'python2') + cmake_options.extend(['-DBUILD_opencv_python2=ON', + '-DPYTHON_EXECUTABLE={0}'.format(python), + '-DPYTHON_LIBRARIES={0}'.format(python_lib)]) + with working_dir('spack_build', create=True): cmake('..', *cmake_options) make('VERBOSE=1')