openwsman: fix detect python executable (#20317)
* openwsman: fix detect python executable - use spack's python insted of system's python - Add variant to use python. - fix dependency. - support python2. * format fixed. * fix python command.
This commit is contained in:
parent
a7017f8e38
commit
1daf6d3df7
@ -16,10 +16,66 @@ class Openwsman(CMakePackage):
|
|||||||
version('2.6.11', sha256='895eaaae62925f9416766ea3e71a5368210e6cfe13b23e4e0422fa0e75c2541c')
|
version('2.6.11', sha256='895eaaae62925f9416766ea3e71a5368210e6cfe13b23e4e0422fa0e75c2541c')
|
||||||
version('2.6.10', sha256='d3c624a03d7bc1835544ce1af56efd010f77cbee0c02b34e0755aa9c9b2c317b')
|
version('2.6.10', sha256='d3c624a03d7bc1835544ce1af56efd010f77cbee0c02b34e0755aa9c9b2c317b')
|
||||||
|
|
||||||
depends_on('python@3:', type='build')
|
variant('python', default=True, description='Enable python')
|
||||||
depends_on('curl')
|
|
||||||
depends_on('libxml2')
|
extends('python', when='+python')
|
||||||
depends_on('sblim-sfcc')
|
|
||||||
|
depends_on('python', type=('build', 'link', 'run'))
|
||||||
|
depends_on('curl', type='link')
|
||||||
|
depends_on('swig', type='build')
|
||||||
|
depends_on('libxml2', type='link')
|
||||||
|
depends_on('openssl', type='link')
|
||||||
|
depends_on('sblim-sfcc', type='link')
|
||||||
|
|
||||||
|
def patch(self):
|
||||||
|
""" Change python install directory. """
|
||||||
|
if self.spec.satisfies('+python'):
|
||||||
|
python_spec = self.spec['python']
|
||||||
|
python_libdir = join_path(
|
||||||
|
self.spec.prefix.lib,
|
||||||
|
'python' + str(python_spec.version.up_to(2)),
|
||||||
|
'site-packages'
|
||||||
|
)
|
||||||
|
filter_file(
|
||||||
|
'DESTINATION .*',
|
||||||
|
'DESTINATION {0} )'.format(python_libdir),
|
||||||
|
join_path('bindings', 'python', 'CMakeLists.txt')
|
||||||
|
)
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
return ['-DBUILD_PYTHON=OFF', '-DUSE_PAM=NO']
|
define = self.define
|
||||||
|
spec = self.spec
|
||||||
|
arg = [
|
||||||
|
define('BUILD_PERL', False),
|
||||||
|
define('BUILD_JAVA', False),
|
||||||
|
define('BUILD_CSHARP', False),
|
||||||
|
define('USE_PAM', 'OFF'),
|
||||||
|
]
|
||||||
|
if spec.satisfies('+python'):
|
||||||
|
if spec.satisfies('^python@3:'):
|
||||||
|
arg.extend([
|
||||||
|
define('BUILD_PYTHON', False),
|
||||||
|
define('BUILD_PYTHON3', True)
|
||||||
|
])
|
||||||
|
else:
|
||||||
|
arg.extend([
|
||||||
|
define('BUILD_PYTHON', True),
|
||||||
|
define('BUILD_PYTHON3', False)
|
||||||
|
])
|
||||||
|
arg.append(define('PYTHON_EXECUTABLE',
|
||||||
|
spec['python'].command.path))
|
||||||
|
else:
|
||||||
|
arg.extend([
|
||||||
|
define('BUILD_PYTHON', False),
|
||||||
|
define('BUILD_PYTHON3', False)
|
||||||
|
])
|
||||||
|
return arg
|
||||||
|
|
||||||
|
def flag_handler(self, name, flags):
|
||||||
|
flags = list(flags)
|
||||||
|
if name == 'cflags':
|
||||||
|
if self.spec.satisfies('%gcc'):
|
||||||
|
flags.append('-std=gnu99')
|
||||||
|
else:
|
||||||
|
flags.append(self.compiler.c99_flag)
|
||||||
|
return (None, None, flags)
|
||||||
|
Loading…
Reference in New Issue
Block a user