dbus/_dbus_bindings.pyx: More docstrings
[dbus-python-phuang.git] / setup.py
bloba295c6a10c712e68bad4c744df9897fa26741364
1 import os
2 import sys
4 sys.path.append("dbus")
6 from distutils.core import setup
7 from distutils.extension import Extension
8 from distutils.command.clean import clean
9 from Pyrex.Distutils import build_ext
11 import extract
13 sys.path.append("test")
14 from dbus_python_check import dbus_python_check
16 def remove(filename):
17 if os.path.exists(filename):
18 os.remove(filename)
20 class full_clean(clean):
21 def run(self):
22 clean.run(self)
23 remove("dbus/extract.pyo")
24 remove("dbus/_dbus_bindings.pxd")
25 remove("dbus/_dbus_bindings.c")
26 remove("dbus/_dbus_glib_bindings.c")
27 remove("ChangeLog")
29 includedirs_flag = ['-I.']
30 dbus_includes = ['.']
31 dbus_glib_includes = ['.']
33 pipe = os.popen3("pkg-config --cflags dbus-1")
34 output = pipe[1].read().strip()
35 error = pipe[2].read().strip()
36 for p in pipe:
37 p.close()
38 if error:
39 print "ERROR: running pkg-config (%s)" % (error)
40 raise SystemExit
41 includedirs_flag.extend(output.split())
42 dbus_includes.extend([ x.replace("-I", "") for x in output.split() ])
44 pipe = os.popen3("pkg-config --cflags dbus-glib-1")
45 output = pipe[1].read().strip()
46 error = pipe[2].read().strip()
47 for p in pipe:
48 p.close()
49 if error:
50 print "ERROR: running pkg-config (%s)" % (error)
51 raise SystemExit
52 includedirs_flag.extend(output.split())
53 dbus_glib_includes.extend([ x.replace("-I", "") for x in output.split() ])
55 #create ChangeLog only if this is a git repo
56 if os.path.exists(".git"):
57 pipe = ""
58 pipe = os.popen3("git-log --stat")
60 output = pipe[1].read().strip()
61 error = pipe[2].read().strip()
63 if error:
64 for p in pipe:
65 p.close()
67 pipe = os.popen3("git-log")
68 output = pipe[1].read().strip()
69 error = pipe[2].read().strip()
71 if error:
72 print "ERROR: running git-log (%s)" % (error)
73 raise SystemExit
75 for p in pipe:
76 p.close()
78 file = open("ChangeLog", "w")
79 file.writelines(output)
80 file.close()
82 dbus_libs = []
83 dbus_glib_libs = []
85 pipe = os.popen3("pkg-config --libs-only-L dbus-1")
86 output = pipe[1].read().strip()
87 error = pipe[2].read().strip()
88 for p in pipe:
89 p.close()
90 if error:
91 print "ERROR: running pkg-config (%s)" % (error)
92 raise SystemExit
93 dbus_libs.extend([ x.replace("-L", "") for x in output.split() ])
95 pipe = os.popen3("pkg-config --libs-only-L dbus-glib-1")
96 output = pipe[1].read().strip()
97 error = pipe[2].read().strip()
98 for p in pipe:
99 p.close()
100 if error:
101 print "ERROR: running pkg-config (%s)" % (error)
102 raise SystemExit
103 dbus_glib_libs.extend([ x.replace("-L", "") for x in output.split() ])
105 output = open("dbus/_dbus_bindings.pxd", 'w')
106 includedirs_flag.append('-Idbus/')
107 extract.main("dbus/_dbus_bindings.pxd.in", includedirs_flag, output)
108 output.close()
110 long_desc = '''D-BUS is a message bus system, a simple way for applications to
111 talk to one another.
113 D-BUS supplies both a system daemon (for events such as "new hardware device
114 added" or "printer queue changed") and a per-user-login-session daemon (for
115 general IPC needs among user applications). Also, the message bus is built on
116 top of a general one-to-one message passing framework, which can be used by any
117 two apps to communicate directly (without going through the message bus daemon).
118 Currently the communicating applications are on one computer, but TCP/IP option
119 is available and remote support planned.'''
121 setup(
122 name='dbus-python',
123 version='0.71',
124 description='D-Bus Python bindings',
125 long_description=long_desc,
126 url='http://dbus.freedesktop.org/',
127 author='John (J5) Palmieri',
128 author_email='johnp@redhat.com',
129 maintainer='John (J5) Palmieri',
130 maintainer_email='johnp@redhat.com',
131 package_dir={'dbus':'dbus'},
132 py_modules=[
133 "dbus/_dbus",
134 "dbus/exceptions",
135 "dbus/glib",
136 "dbus/__init__",
137 "dbus/matchrules",
138 "dbus/service",
139 "dbus/types",
140 "dbus/decorators",
141 "dbus/introspect_parser",
142 "dbus/proxies",
143 "dbus/_util",
145 ext_modules=[
146 Extension("_dbus_bindings", ["dbus/_dbus_bindings.pyx"],
147 include_dirs=dbus_includes,
148 library_dirs=dbus_libs,
149 libraries=["dbus-1"],
152 Extension("_dbus_glib_bindings", ["dbus/_dbus_glib_bindings.pyx"],
153 include_dirs=dbus_glib_includes,
154 library_dirs=dbus_glib_libs,
155 libraries=["dbus-glib-1", "dbus-1", "glib-2.0"],
156 define_macros=[
157 ('DBUS_API_SUBJECT_TO_CHANGE', '1')
161 cmdclass={'build_ext': build_ext, 'clean': full_clean, 'check': dbus_python_check}
164 # vim:ts=4:sw=4:tw=80:si:ai:showmatch:et