glib: Fix python handling (#6910)
Newer versions of glib require python. Fix up the python sbangs the same way we already fix up the perl ones. Fixes #6899
This commit is contained in:
parent
e8df0ddce4
commit
d8b03d1e37
@ -48,6 +48,7 @@ class Glib(AutotoolsPackage):
|
|||||||
depends_on('zlib')
|
depends_on('zlib')
|
||||||
depends_on('gettext')
|
depends_on('gettext')
|
||||||
depends_on('perl', type=('build', 'run'))
|
depends_on('perl', type=('build', 'run'))
|
||||||
|
depends_on('python', type=('build', 'run'), when='@2.53.4:')
|
||||||
depends_on('pcre+utf', when='@2.48:')
|
depends_on('pcre+utf', when='@2.48:')
|
||||||
depends_on('util-linux', when='+libmount')
|
depends_on('util-linux', when='+libmount')
|
||||||
|
|
||||||
@ -73,10 +74,30 @@ def configure_args(self):
|
|||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
@run_before('install')
|
@run_before('configure')
|
||||||
def filter_sbang(self):
|
def fix_python_path(self):
|
||||||
# Filter sbang before install so Spack's sbang hook can fix it up
|
if not self.spec.satisfies('@2.53.4:'):
|
||||||
perl = join_path(self.spec['perl'].prefix.bin, 'perl')
|
return
|
||||||
files = ['gobject/glib-mkenums']
|
|
||||||
|
|
||||||
filter_file('^#! /usr/bin/perl', '#!{0}'.format(perl), *files)
|
files = ['gobject/glib-genmarshal.in', 'gobject/glib-mkenums.in']
|
||||||
|
|
||||||
|
filter_file('^#!/usr/bin/env @PYTHON@',
|
||||||
|
'#!/usr/bin/env python',
|
||||||
|
*files)
|
||||||
|
|
||||||
|
@run_after('install')
|
||||||
|
def filter_sbang(self):
|
||||||
|
# Revert sbang, so Spack's sbang hook can fix it up (we have to do
|
||||||
|
# this after install because otherwise the install target will try
|
||||||
|
# to rebuild files as filter_file updates the timestamps)
|
||||||
|
if self.spec.satisfies('@2.53.4:'):
|
||||||
|
pattern = '^#!/usr/bin/env python'
|
||||||
|
repl = '#!{0}'.format(self.spec['python'].command.path)
|
||||||
|
files = ['glib-genmarshal', 'glib-mkenums']
|
||||||
|
else:
|
||||||
|
pattern = '^#! /usr/bin/perl'
|
||||||
|
repl = '#!{0}'.format(self.spec['perl'].command.path)
|
||||||
|
files = ['glib-mkenums']
|
||||||
|
|
||||||
|
files = [join_path(self.prefix.bin, file) for file in files]
|
||||||
|
filter_file(pattern, repl, *files, backup=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user