libcap-ng: fix detect python. (#21162)

* libcap-ng: fix detect python.

- add python variant.
- add --with-python and --with-python3 configure option.

* fix style.

* - Add python variant.
- change - to --
This commit is contained in:
Toyohisa Kameyama 2021-01-21 12:42:36 +09:00 committed by GitHub
parent bf3fb8428d
commit c5ed46e026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,4 +21,25 @@ class LibcapNg(AutotoolsPackage):
depends_on('libtool', type='build') depends_on('libtool', type='build')
depends_on('m4', type='build') depends_on('m4', type='build')
depends_on('attr', type='build') depends_on('attr', type='build')
depends_on('python', type=('build', 'run')) depends_on('swig', type='build')
depends_on('python@2.7:', type=('build', 'link', 'run'), when='+python')
variant('python', default=True, description='Enable python')
extends('python', when='+python')
def setup_build_environment(self, env):
if self.spec.satisfies('+python'):
env.set('PYTHON', self.spec['python'].command.path)
def configure_args(self):
args = []
spec = self.spec
if spec.satisfies('+python'):
if spec.satisfies('^python@3:'):
args.extend(['--without-python', '--with-python3'])
else:
args.extend(['--with-python', '--without-python3'])
else:
args.extend(['--without-python', '--without-python3'])
return args