meson: add data files

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2024-10-25 14:48:27 +02:00 committed by Pavel Hrdina
parent 6a462a3f60
commit dd909f20bc
4 changed files with 21 additions and 25 deletions

View File

@ -32,4 +32,4 @@ _python_argcomplete() {
compopt -o nospace
fi
}
complete -o nospace -o default -F _python_argcomplete ::SCRIPTNAME::
complete -o nospace -o default -F _python_argcomplete @SCRIPTNAME@

19
data/meson.build Normal file
View File

@ -0,0 +1,19 @@
fs = import('fs')
install_data(
'org.virt-manager.virt-manager.gschema.xml',
install_dir: datadir / 'glib-2.0' / 'schemas',
)
bash_completion_template = files('bash-completion.sh.in')
foreach script: ['virt-install', 'virt-clone', 'virt-xml']
name = fs.name(script)
configure_file(
input: bash_completion_template,
output: name,
configuration: {'SCRIPTNAME': name},
install: true,
install_dir: datadir / 'bash-completion' / 'completions',
)
endforeach

View File

@ -14,6 +14,7 @@ git = run_command('test', '-e', '.git', check: false).returncode() == 0
subdir('scripts')
subdir('man')
subdir('data')
if git
spec_conf = configuration_data({

View File

@ -178,31 +178,9 @@ from %(pkgname)s import %(filename)s
self.distribution.data_files.append((dest, icons))
def _make_bash_completion_files(self):
scripts = ["virt-install", "virt-clone", "virt-xml"]
srcfile = "data/bash-completion.sh.in"
builddir = "build/bash-completion/"
if not os.path.exists(builddir):
os.makedirs(builddir)
instpaths = []
for script in scripts:
genfile = os.path.join(builddir, script)
print("Generating %s" % genfile)
src = open(srcfile, "r")
dst = open(genfile, "w")
dst.write(src.read().replace("::SCRIPTNAME::", script))
dst.close()
instpaths.append(genfile)
bashdir = "share/bash-completion/completions/"
self.distribution.data_files.append((bashdir, instpaths))
def run(self):
self._make_bin_wrappers()
self._build_icons()
self._make_bash_completion_files()
self.run_command("build_i18n")
super().run()
@ -474,8 +452,6 @@ setuptools.setup(
"build/virt-xml"]),
data_files=[
("share/glib-2.0/schemas",
["data/org.virt-manager.virt-manager.gschema.xml"]),
("share/virt-manager/ui", glob.glob("ui/*.ui")),
("share/virt-manager/virtManager", glob.glob("virtManager/*.py")),