ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/pystatgrab/setup.py
Revision: 1.8
Committed: Sat Mar 20 19:45:23 2004 UTC (20 years, 8 months ago) by tdb
Content type: text/x-python
Branch: MAIN
Changes since 1.7: +2 -2 lines
Log Message:
Package should be pystatgrab, not statgrab.
Add ChangeLog to MANIFEST.

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.8 # $Id: setup.py,v 1.7 2004/03/20 19:25:02 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     # 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     if os.system("pyrexc --version >/dev/null 2>&1"):
37     sys.exit("Error, statgrab.c not present, and can't find pyrexc to generate it with.")
38     else:
39     if os.system("pyrexc statgrab.pyx"):
40     sys.exit("Error, pyrexc failed to generate statgrab.c")
41    
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     "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     )