OOF2: The Manual

Name

oof2setuputils.check_exec — Check that an external program exists

Synopsis

from oof2setuputils import check_exec
check_exec(xfile)
	

Description

check_exec checks that the given file exists and is executable. The file must be in the user's PATH. check_exec can be used in the set_clib_flags function in a DIR.py file to ensure that the functions called by other utility functions exist.

Parameters

xfile

The name of the executable file to check.

Example

The examples used in the reference pages for add_third_party_includes and add_third_party_libs can be combined and written more robustly like this:

import oof2setuputils
def set_clib_flags(clib):
   if oof2setuputils.check_exec('Magick++-config'):
      oof2setuputils.add_third_party_includes('Magick++-config --cppflags', clib)
      oof2setuputils.add_third_party_libs('Magick++-config --ldflags --libs', clib)
   else:
      print "Can't find Magick++-config!"