| 1 |  | #!/usr/bin/env python | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 2 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 3 |  | from distutils.core import setup, Extension | 
 
 
 
 
 
 
 
 | 4 | + | from commands import getstatusoutput | 
 
 
 
 
 
 
 
 | 5 | + | from sys import exit | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 6 |  |  | 
 
 
 
 
 
 
 
 | 7 | + | cflags = getstatusoutput("pkg-config --cflags libstatgrab") | 
 
 
 
 
 
 
 
 | 8 | + | libs = getstatusoutput("pkg-config --libs libstatgrab") | 
 
 
 
 
 
 
 
 | 9 | + |  | 
 
 
 
 
 
 
 
 | 10 | + | if cflags[0] != 0: | 
 
 
 
 
 
 
 
 | 11 | + | exit("Failed to get cflags: " + cflags[1]) | 
 
 
 
 
 
 
 
 | 12 | + |  | 
 
 
 
 
 
 
 
 | 13 | + | if libs[0] != 0: | 
 
 
 
 
 
 
 
 | 14 | + | exit("Failed to get libs: " + libs[1]) | 
 
 
 
 
 
 
 
 | 15 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 16 |  | setup(  name = "statgrab", | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 17 |  | version = "0.8.1", | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 18 |  | description = "Python bindings for libstatgrab", | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 23 |  | ext_modules=[Extension( | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 24 |  | "statgrab", | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 25 |  | ["statgrab.c"], | 
 
 
 
 
 
 
 
 
 
 
 | 26 | < | libraries = ["statgrab", "kvm", "devstat"], | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 27 | < | include_dirs = ["/usr/local/include"], | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 17 | < | library_dirs = ["/usr/local/lib"], | 
 
 
 
 
 
 
 
 
 | 26 | > | extra_compile_args = cflags[1].split(), | 
 
 
 
 
 | 27 | > | extra_link_args = libs[1].split(), | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 28 |  | )], | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 29 |  | ) |