Makefile:
[dbus-python-phuang.git] / setup.py
blobd7bf8fcd0d84709e0c47a27f9354295d62870d52
1 # Copyright (C) 2003, 2004, 2005, 2006 Red Hat Inc. <http://www.redhat.com/>
2 # Copyright (C) 2003 David Zeuthen
3 # Copyright (C) 2004 Rob Taylor
4 # Copyright (C) 2005, 2006 Collabora Ltd. <http://www.collabora.co.uk/>
5 # Copyright (C) 2006 Osvaldo Santana Neto
6 # Copyright (C) 2006 Joseph Sacco
8 # Licensed under the Academic Free License version 2.1
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 import os
28 import sys
30 sys.path.append("dbus")
32 from distutils.core import setup
33 from distutils.extension import Extension
34 from distutils.command.clean import clean
36 sys.path.append("test")
37 from dbus_python_check import dbus_python_check
39 def remove(filename):
40 if os.path.exists(filename):
41 os.remove(filename)
43 class full_clean(clean):
44 def run(self):
45 clean.run(self)
46 remove("ChangeLog")
48 includedirs_flag = ['-I.']
49 dbus_includes = ['.', 'include']
50 dbus_glib_includes = ['.', 'include']
52 pipe = os.popen3("pkg-config --cflags dbus-1")
53 output = pipe[1].read().strip()
54 error = pipe[2].read().strip()
55 for p in pipe:
56 p.close()
57 if error:
58 print "ERROR: running pkg-config (%s)" % (error)
59 raise SystemExit
60 includedirs_flag.extend(output.split())
61 dbus_includes.extend([ x.replace("-I", "") for x in output.split() ])
63 pipe = os.popen3("pkg-config --cflags dbus-glib-1")
64 output = pipe[1].read().strip()
65 error = pipe[2].read().strip()
66 for p in pipe:
67 p.close()
68 if error:
69 print "ERROR: running pkg-config (%s)" % (error)
70 raise SystemExit
71 includedirs_flag.extend(output.split())
72 dbus_glib_includes.extend([ x.replace("-I", "") for x in output.split() ])
74 #create ChangeLog only if this is a git repo
75 if os.path.exists(".git"):
76 pipe = ""
77 pipe = os.popen3("git-log --stat")
79 output = pipe[1].read().strip()
80 error = pipe[2].read().strip()
82 if error:
83 for p in pipe:
84 p.close()
86 pipe = os.popen3("git-log")
87 output = pipe[1].read().strip()
88 error = pipe[2].read().strip()
90 if error:
91 print "ERROR: running git-log (%s)" % (error)
92 raise SystemExit
94 for p in pipe:
95 p.close()
97 file = open("ChangeLog", "w")
98 file.writelines(output)
99 file.close()
101 dbus_libs = []
102 dbus_glib_libs = []
104 pipe = os.popen3("pkg-config --libs-only-L dbus-1")
105 output = pipe[1].read().strip()
106 error = pipe[2].read().strip()
107 for p in pipe:
108 p.close()
109 if error:
110 print "ERROR: running pkg-config (%s)" % (error)
111 raise SystemExit
112 dbus_libs.extend([ x.replace("-L", "") for x in output.split() ])
114 pipe = os.popen3("pkg-config --libs-only-L dbus-glib-1")
115 output = pipe[1].read().strip()
116 error = pipe[2].read().strip()
117 for p in pipe:
118 p.close()
119 if error:
120 print "ERROR: running pkg-config (%s)" % (error)
121 raise SystemExit
122 dbus_glib_libs.extend([ x.replace("-L", "") for x in output.split() ])
124 long_desc = '''D-BUS is a message bus system, a simple way for applications to
125 talk to one another.
127 D-BUS supplies both a system daemon (for events such as "new hardware device
128 added" or "printer queue changed") and a per-user-login-session daemon (for
129 general IPC needs among user applications). Also, the message bus is built on
130 top of a general one-to-one message passing framework, which can be used by any
131 two apps to communicate directly (without going through the message bus daemon).
132 Currently the communicating applications are on one computer, but TCP/IP option
133 is available and remote support planned.'''
135 extra_ext_args = {}
137 if 'CFLAGS' in os.environ:
138 extra_ext_args['extra_compile_args'] = os.environ['CFLAGS'].split()
140 setup(
141 name='dbus-python',
142 version='0.71',
143 description='D-Bus Python bindings',
144 long_description=long_desc,
145 url='http://dbus.freedesktop.org/',
146 author='John (J5) Palmieri',
147 author_email='johnp@redhat.com',
148 maintainer='John (J5) Palmieri',
149 maintainer_email='johnp@redhat.com',
150 package_dir={'dbus':'dbus'},
151 py_modules=[
152 "dbus/_dbus",
153 "dbus/exceptions",
154 "dbus/glib",
155 "dbus/__init__",
156 "dbus/matchrules",
157 "dbus/service",
158 "dbus/types",
159 "dbus/decorators",
160 "dbus/introspect_parser",
161 "dbus/proxies",
163 ext_modules=[
164 Extension("_dbus_bindings", ["_dbus_bindings/module.c"],
165 include_dirs=dbus_includes,
166 library_dirs=dbus_libs,
167 libraries=["dbus-1"],
168 **extra_ext_args
170 Extension("_dbus_glib_bindings", ["_dbus_glib_bindings/module.c"],
171 include_dirs=dbus_glib_includes,
172 library_dirs=dbus_glib_libs,
173 libraries=["dbus-glib-1", "dbus-1", "glib-2.0"],
174 **extra_ext_args
177 cmdclass={'clean': full_clean, 'check': dbus_python_check}
180 # vim:ts=4:sw=4:tw=80:si:ai:showmatch:et