Skip to content

Commit

Permalink
Restore bash completions
Browse files Browse the repository at this point in the history
05f9481 removed these as the shortest
path to preserving hermeticity of the build, but this solution was
overly aggressive. Restore the bash completions (and the config file) by
placing them in directories inside the package (rather than
system-wide).

Downstream distro packaging can move place the content of ./etc/ in
/etc/ and ./share/ in /usr/share/.
  • Loading branch information
tamird committed Oct 17, 2024
1 parent bba9360 commit 907bb11
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import platform
import sys
import sysconfig
from subprocess import check_call
import argcomplete
from build_manpages import build_manpages, get_build_py_cmd, get_install_cmd
from setuptools import setup
from setuptools.command.build_py import build_py
from setuptools.command.egg_info import egg_info
from subprocess import check_call
from virtme_ng.version import get_version_string

os.environ["__VNG_LOCAL"] = "1"
Expand Down Expand Up @@ -57,6 +58,12 @@ def run(self):
cwd=cwd,
)

# Generate bash autocompletion scripts
with open("virtme-ng-prompt", "w") as f:
f.write(argcomplete.shellcode(["virtme-ng"]))
with open("vng-prompt", "w") as f:
f.write(argcomplete.shellcode(["vng"]))

# Run the rest of virtme-ng build
build_py.run(self)

Expand Down Expand Up @@ -97,7 +104,8 @@ def run(self):
packages.append("virtme.guest.bin")

data_files = [
("/etc", ["cfg/virtme-ng.conf"]),
("etc", ["cfg/virtme-ng.conf"]),
("share/bash-completion/completions", ["virtme-ng-prompt", "vng-prompt"]),
]

setup(
Expand Down Expand Up @@ -137,6 +145,7 @@ def run(self):
},
packages=packages,
package_data={"virtme.guest": package_files},
data_files=data_files,
scripts=[
"bin/virtme-prep-kdir-mods",
],
Expand Down

0 comments on commit 907bb11

Please sign in to comment.