diff --git a/data/bash-completion.sh.in b/data/bash-completion.sh.in index 6b00fa324..feae54674 100644 --- a/data/bash-completion.sh.in +++ b/data/bash-completion.sh.in @@ -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@ diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 000000000..79318e7dd --- /dev/null +++ b/data/meson.build @@ -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 diff --git a/meson.build b/meson.build index c0daed2c1..81e92ca0f 100644 --- a/meson.build +++ b/meson.build @@ -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({ diff --git a/setup.py b/setup.py index 44b675fdb..8963850ba 100755 --- a/setup.py +++ b/setup.py @@ -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")),