_dbus_bindings: Expose name-validation functions to Python code.
[dbus-python-phuang.git] / setup.py
blobb380fa96579561b42c29c8f33f71226376a82edf
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
10 import extract
12 sys.path.append("test")
13 from dbus_python_check import dbus_python_check
15 def remove(filename):
16 if os.path.exists(filename):
17 os.remove(filename)
19 class full_clean(clean):
20 def run(self):
21 clean.run(self)
22 remove("ChangeLog")
24 includedirs_flag = ['-I.']
25 dbus_includes = ['.', 'include']
26 dbus_glib_includes = ['.', 'include']
28 pipe = os.popen3("pkg-config --cflags dbus-1")
29 output = pipe[1].read().strip()
30 error = pipe[2].read().strip()
31 for p in pipe:
32 p.close()
33 if error:
34 print "ERROR: running pkg-config (%s)" % (error)
35 raise SystemExit
36 includedirs_flag.extend(output.split())
37 dbus_includes.extend([ x.replace("-I", "") for x in output.split() ])
39 pipe = os.popen3("pkg-config --cflags dbus-glib-1")
40 output = pipe[1].read().strip()
41 error = pipe[2].read().strip()
42 for p in pipe:
43 p.close()
44 if error:
45 print "ERROR: running pkg-config (%s)" % (error)
46 raise SystemExit
47 includedirs_flag.extend(output.split())
48 dbus_glib_includes.extend([ x.replace("-I", "") for x in output.split() ])
50 #create ChangeLog only if this is a git repo
51 if os.path.exists(".git"):
52 pipe = ""
53 pipe = os.popen3("git-log --stat")
55 output = pipe[1].read().strip()
56 error = pipe[2].read().strip()
58 if error:
59 for p in pipe:
60 p.close()
62 pipe = os.popen3("git-log")
63 output = pipe[1].read().strip()
64 error = pipe[2].read().strip()
66 if error:
67 print "ERROR: running git-log (%s)" % (error)
68 raise SystemExit
70 for p in pipe:
71 p.close()
73 file = open("ChangeLog", "w")
74 file.writelines(output)
75 file.close()
77 dbus_libs = []
78 dbus_glib_libs = []
80 pipe = os.popen3("pkg-config --libs-only-L dbus-1")
81 output = pipe[1].read().strip()
82 error = pipe[2].read().strip()
83 for p in pipe:
84 p.close()
85 if error:
86 print "ERROR: running pkg-config (%s)" % (error)
87 raise SystemExit
88 dbus_libs.extend([ x.replace("-L", "") for x in output.split() ])
90 pipe = os.popen3("pkg-config --libs-only-L dbus-glib-1")
91 output = pipe[1].read().strip()
92 error = pipe[2].read().strip()
93 for p in pipe:
94 p.close()
95 if error:
96 print "ERROR: running pkg-config (%s)" % (error)
97 raise SystemExit
98 dbus_glib_libs.extend([ x.replace("-L", "") for x in output.split() ])
100 long_desc = '''D-BUS is a message bus system, a simple way for applications to
101 talk to one another.
103 D-BUS supplies both a system daemon (for events such as "new hardware device
104 added" or "printer queue changed") and a per-user-login-session daemon (for
105 general IPC needs among user applications). Also, the message bus is built on
106 top of a general one-to-one message passing framework, which can be used by any
107 two apps to communicate directly (without going through the message bus daemon).
108 Currently the communicating applications are on one computer, but TCP/IP option
109 is available and remote support planned.'''
111 setup(
112 name='dbus-python',
113 version='0.71',
114 description='D-Bus Python bindings',
115 long_description=long_desc,
116 url='http://dbus.freedesktop.org/',
117 author='John (J5) Palmieri',
118 author_email='johnp@redhat.com',
119 maintainer='John (J5) Palmieri',
120 maintainer_email='johnp@redhat.com',
121 package_dir={'dbus':'dbus'},
122 py_modules=[
123 "dbus/_dbus",
124 "dbus/exceptions",
125 "dbus/glib",
126 "dbus/__init__",
127 "dbus/matchrules",
128 "dbus/service",
129 "dbus/types",
130 "dbus/decorators",
131 "dbus/introspect_parser",
132 "dbus/proxies",
133 "dbus/_util",
135 ext_modules=[
136 Extension("_dbus_bindings", ["_dbus_bindings/module.c"],
137 include_dirs=dbus_includes,
138 library_dirs=dbus_libs,
139 libraries=["dbus-1"],
141 Extension("_dbus_glib_bindings", ["_dbus_glib_bindings/module.c"],
142 include_dirs=dbus_glib_includes,
143 library_dirs=dbus_glib_libs,
144 libraries=["dbus-glib-1", "dbus-1", "glib-2.0"],
147 cmdclass={'clean': full_clean, 'check': dbus_python_check}
150 # vim:ts=4:sw=4:tw=80:si:ai:showmatch:et