ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/pystatgrab/setup.py
Revision: 1.10
Committed: Sat Mar 20 22:43:26 2004 UTC (20 years, 8 months ago) by tdb
Content type: text/x-python
Branch: MAIN
Changes since 1.9: +18 -2 lines
Log Message:
Add more documentation to the README file.

File Contents

# User Rev Content
1 tdb 1.1 #!/usr/bin/env python
2 tdb 1.7 #
3 tdb 1.10 # i-scream central monitoring system
4     # http://www.i-scream.org
5     # Copyright (C) 2000-2004 i-scream
6 tdb 1.7 #
7 tdb 1.10 # This program is free software; you can redistribute it and/or
8     # modify it under the terms of the GNU General Public License
9     # as published by the Free Software Foundation; either version 2
10     # of the License, or (at your option) any later version.
11     #
12     # This program is distributed in the hope that it will be useful,
13     # but WITHOUT ANY WARRANTY; without even the implied warranty of
14     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     # GNU General Public License for more details.
16     #
17     # You should have received a copy of the GNU General Public License
18     # along with this program; if not, write to the Free Software
19     # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20     #
21     # $Id$
22 tdb 1.7 #
23     """Python bindings for libstatgrab."""
24 tdb 1.1
25     from distutils.core import setup, Extension
26 tdb 1.2 from commands import getstatusoutput
27    
28 tdb 1.7 import sys
29     import os
30    
31     # version of pystatgrab
32     VERSION = "0.1"
33    
34     # required version of libstatgrab
35     LIBSTATGRAB = "0.9"
36    
37     # test for pkg-config presence
38     if os.system("pkg-config --version >/dev/null 2>&1"):
39     sys.exit("Error, could not find pkg-config.")
40    
41     # test for libstatgrab presence using pkg-config
42     if os.system("pkg-config --exists libstatgrab"):
43     sys.exit("Error, libstatgrab is not installed (according to pkg-config).")
44    
45     # test for libstatgrab version using pkg-config
46     if os.system("pkg-config --atleast-version=%s libstatgrab" % LIBSTATGRAB):
47     sys.exit("Error, need at least libstatgrab version %s." % LIBSTATGRAB)
48    
49 tdb 1.9 # test for _statgrab.c, and try to generate if not found
50     if not os.path.exists("_statgrab.c"):
51     print "_statgrab.c doesn't exist, trying to use pyrexc to generate it..."
52 tdb 1.7 if os.system("pyrexc --version >/dev/null 2>&1"):
53 tdb 1.9 sys.exit("Error, _statgrab.c not present, and can't find pyrexc to generate it with.")
54 tdb 1.7 else:
55 tdb 1.9 if os.system("pyrexc _statgrab.pyx"):
56     sys.exit("Error, pyrexc failed to generate _statgrab.c")
57 tdb 1.7
58     # get cflags and libs for libstatgrab
59 tdb 1.2 cflags = getstatusoutput("pkg-config --cflags libstatgrab")
60     libs = getstatusoutput("pkg-config --libs libstatgrab")
61    
62     if cflags[0] != 0:
63 tdb 1.7 sys.exit("Failed to get cflags: " + cflags[1])
64 tdb 1.2
65     if libs[0] != 0:
66     exit("Failed to get libs: " + libs[1])
67 tdb 1.1
68 tdb 1.7 # setup information
69 tdb 1.8 setup( name = "pystatgrab",
70 tdb 1.7 version = VERSION,
71 tdb 1.1 description = "Python bindings for libstatgrab",
72     author = "i-scream",
73     author_email = "dev@i-scream.org",
74 tdb 1.7 url = "http://www.i-scream.org/libstatgrab/",
75 tdb 1.1 license = "GNU GPL v2 or later",
76     ext_modules=[Extension(
77 tdb 1.9 "_statgrab",
78     ["_statgrab.c"],
79 tdb 1.2 extra_compile_args = cflags[1].split(),
80     extra_link_args = libs[1].split(),
81 tdb 1.1 )],
82 tdb 1.9 py_modules=["statgrab"],
83 tdb 1.1 )