[virt-tools-list] [virt-manager] [RFC PATCH 9/9] setup.py: Install and link the bash completion scripts

Lin Ma lma at suse.com
Fri Dec 7 08:03:33 UTC 2018


On 11/18/18 10:24 AM, Cole Robinson wrote:
> On 11/14/2018 03:12 AM, Lin Ma wrote:
>> Signed-off-by: Lin Ma <lma at suse.com>
>> ---
>>   setup.py | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/setup.py b/setup.py
>> index 658e6503..1c4b4340 100755
>> --- a/setup.py
>> +++ b/setup.py
>> @@ -273,6 +273,15 @@ class 
>> my_install_data(distutils.command.install_data.install_data):
>>                   "share/glib-2.0/schemas")
>>               self.spawn(["glib-compile-schemas", gschema_install])
>>   +        self.spawn(["rm", "-f", 
>> "/usr/share/bash-completion/completions/virt-install"])
>> +        self.spawn(["rm", "-f", 
>> "/usr/share/bash-completion/completions/virt-clone"])
>> +        self.spawn(["rm", "-f", 
>> "/usr/share/bash-completion/completions/virt-xml"])
>> +        self.spawn(["rm", "-f", 
>> "/usr/share/bash-completion/completions/virt-convert"])
>> +        self.spawn(["ln", "-s", "virtmanager", 
>> "/usr/share/bash-completion/completions/virt-install"])
>> +        self.spawn(["ln", "-s", "virtmanager", 
>> "/usr/share/bash-completion/completions/virt-clone"])
>> +        self.spawn(["ln", "-s", "virtmanager", 
>> "/usr/share/bash-completion/completions/virt-xml"])
>> +        self.spawn(["ln", "-s", "virtmanager", 
>> "/usr/share/bash-completion/completions/virt-convert"])
>> +
>>
>
> I don't really like the linking and deleting here. I think my_build 
> should basically copy data/bash-completion/virtmanager to 
> {virt-install,virt-clone,virt-xml,virt-convert}, then the glob will do 
> the right thing.

ok, will do.
>
> Also, bash completion install location might vary per distro. I see 
> code like this in the fedpkg project for finding the install location:
>
>
> def bash_completion_dir():
>     (sts, output) = getstatusoutput(
>         'pkg-config --variable=completionsdir bash-completion')
>     return output if not sts and output else '/etc/bash_completion.d'

ok, I'll add this function to detect the location instead of hard code.




More information about the virt-tools-list mailing list