ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/pystatgrab/setup.py
Revision: 1.9
Committed: Sat Mar 20 21:29:59 2004 UTC (20 years, 1 month ago) by tdb
Content type: text/x-python
Branch: MAIN
Changes since 1.8: +10 -9 lines
Log Message:
Move the wrapper module to _statgrab, and then add a module to interface
to the user with correct function names.

File Contents

# User Rev Content
1 tdb 1.1 #!/usr/bin/env python
2 tdb 1.7 #
3     # setup.py - distfiles configuration for pystatgrab
4     #
5 tdb 1.9 # $Id: setup.py,v 1.8 2004/03/20 19:45:23 tdb Exp $
6 tdb 1.7 #
7     """Python bindings for libstatgrab."""
8 tdb 1.1
9     from distutils.core import setup, Extension
10 tdb 1.2 from commands import getstatusoutput
11    
12 tdb 1.7 import sys
13     import os
14    
15     # version of pystatgrab
16     VERSION = "0.1"
17    
18     # required version of libstatgrab
19     LIBSTATGRAB = "0.9"
20    
21     # test for pkg-config presence
22     if os.system("pkg-config --version >/dev/null 2>&1"):
23     sys.exit("Error, could not find pkg-config.")
24    
25     # test for libstatgrab presence using pkg-config
26     if os.system("pkg-config --exists libstatgrab"):
27     sys.exit("Error, libstatgrab is not installed (according to pkg-config).")
28    
29     # test for libstatgrab version using pkg-config
30     if os.system("pkg-config --atleast-version=%s libstatgrab" % LIBSTATGRAB):
31     sys.exit("Error, need at least libstatgrab version %s." % LIBSTATGRAB)
32    
33 tdb 1.9 # test for _statgrab.c, and try to generate if not found
34     if not os.path.exists("_statgrab.c"):
35     print "_statgrab.c doesn't exist, trying to use pyrexc to generate it..."
36 tdb 1.7 if os.system("pyrexc --version >/dev/null 2>&1"):
37 tdb 1.9 sys.exit("Error, _statgrab.c not present, and can't find pyrexc to generate it with.")
38 tdb 1.7 else:
39 tdb 1.9 if os.system("pyrexc _statgrab.pyx"):
40     sys.exit("Error, pyrexc failed to generate _statgrab.c")
41 tdb 1.7
42     # get cflags and libs for libstatgrab
43 tdb 1.2 cflags = getstatusoutput("pkg-config --cflags libstatgrab")
44     libs = getstatusoutput("pkg-config --libs libstatgrab")
45    
46     if cflags[0] != 0:
47 tdb 1.7 sys.exit("Failed to get cflags: " + cflags[1])
48 tdb 1.2
49     if libs[0] != 0:
50     exit("Failed to get libs: " + libs[1])
51 tdb 1.1
52 tdb 1.7 # setup information
53 tdb 1.8 setup( name = "pystatgrab",
54 tdb 1.7 version = VERSION,
55 tdb 1.1 description = "Python bindings for libstatgrab",
56     author = "i-scream",
57     author_email = "dev@i-scream.org",
58 tdb 1.7 url = "http://www.i-scream.org/libstatgrab/",
59 tdb 1.1 license = "GNU GPL v2 or later",
60     ext_modules=[Extension(
61 tdb 1.9 "_statgrab",
62     ["_statgrab.c"],
63 tdb 1.2 extra_compile_args = cflags[1].split(),
64     extra_link_args = libs[1].split(),
65 tdb 1.1 )],
66 tdb 1.9 py_modules=["statgrab"],
67 tdb 1.1 )