On Tue, May 19, 2015 at 4:12 PM, salil GK wrote:
> I will provide more details about what I need to achieve
>
> I need to create a package for a tool that I create. Actually the tool
> that I created is a wrapper over ovftool which is provided by VMWare.
> ovftool install binary is provided as a bundle hence there is no package
> installed in the system ( `dpkg -l` will not list ovftool package ).
> ovftool will be installed in /usr/bin/ location.
>
>While creating the package I need to check if ovftool is available in
> the system and the version is 4.1.0. If it is not compatible, I need to
> fail the package installation with proper message. So how do I write
> setup.py for achieving the same.
>
you can put arbitrary python code in setup.py. so before you call setup()
in the file, put something like:
import subprocess
try:
version = subprocess.check_output(['/usr/bin/ovftool','--version'])
except subprocess.CalledProcessError:
print "ovftool is not properly installed"
raise
if not is_this_the_right_version(version):
raise ValueError("ovftool is not the right version")
of course, you'd probably want better error messages, etc, but hopefully
you get the idea.
-CHB
> Thanks
> Salil
>
> On 19 May 2015 at 07:54, salil GK wrote:
>
>> Hello
>>
>>I was trying to create my package for distribution. I have a
>> requirement that I need to check if one particular command is available in
>> the system ( this command is not installed through a package - but a bundle
>> is installed to get the command in the system ). I am using Ubuntu 14.04
>>
>> Thanks in advance
>> Salil
>>
>
>
> ___
> Distutils-SIG maillist - Distutils-SIG@python.org
> https://mail.python.org/mailman/listinfo/distutils-sig
>
>
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
chris.bar...@noaa.gov
___
Distutils-SIG maillist - Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig