Commit 07b3ed49 authored by Jérome Perrin's avatar Jérome Perrin

component/aspell: create wrapper for dictionnaries

this allow to share aspell component. Users needs to install the part
with dictionnaries, ie. aspell-en-dictionary instead of simply aspell
parent 2d75e2dd
import os
import textwrap
import glob
def post_make_hook(options, buildout, environment):
prefix = options['prefix']
dict_dir = options['dict-dir']
aspell_bin = os.path.join(
buildout['aspell']['location'],
'bin',
'aspell')
aspell_bin_wrapper = options['bin-aspell']
bin_folder = os.path.dirname(aspell_bin_wrapper)
if not os.path.isdir(bin_folder):
os.mkdir(bin_folder)
# install a ./bin/aspell set to use the dict from this part
with open(aspell_bin_wrapper, 'w') as wrapper:
wrapper.write('''#!/bin/sh
export ASPELL_CONF="dict-dir {dict_dir}"
exec {aspell_bin} "$@"
'''.format(**locals()))
os.chmod(aspell_bin_wrapper, 0o755)
[buildout]
parts =
aspell
aspell-en-dictonary
aspell-en-dictionary
extends =
../ncurses/buildout.cfg
../patch/buildout.cfg
../perl/buildout.cfg
buildout.hash.cfg
[aspell-dictionary-common]
# Macro to install an aspell dictionnary and create an aspell wrapper using
# this dictionnary.
# The aspell wrapper is exported as ${:bin-aspell}
bin-aspell = @@LOCATION@@/bin/aspell
recipe = slapos.recipe.cmmi
shared = false
shared = true
configure-command = ./configure --vars ASPELL=${aspell:location}/bin/aspell PREZIP=${aspell:location}/bin/prezip-bin
dict-dir = @@LOCATION@@/lib/aspell/
data-dir = @@LOCATION@@/lib/aspell/
make-options =
dictdir=${:dict-dir}
datadir=${:data-dir}
make-targets = install
post-make-hook = ${:_profile_base_location_}/${aspell-create-wrapper:filename}#${aspell-create-wrapper:md5sum}:post_make_hook
[aspell]
recipe = slapos.recipe.cmmi
shared = false
shared = true
url = https://ftp.gnu.org/gnu/aspell/aspell-0.60.7.tar.gz
md5sum = 8ef2252609c511cd2bb26f3a3932ef28
environment =
......
[aspell-create-wrapper]
filename = aspell-create-wrapper.py
md5sum = 5b7cc325032f8588870fd2c6b8bd1b6d
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment