forked from tych0/xpyb-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
57 lines (48 loc) · 1.27 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import shutil, os
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext as _build_ext
from tools import py_client
CFLAGS=["-Wall"]
XCB_PATHS = [
"/usr/share/xcb",
"/usr/local/share/xcb",
]
def find_xcb():
for i in XCB_PATHS:
if os.path.isdir(i):
return i
raise ValueError("Could not detect xcb protocol definition location...")
xmlfiles = [
"bigreq", "composite", "damage", "dpms", "glx",
"randr", "record", "render", "res", "screensaver",
"shape", "shm", "sync", "xc_misc", "xevie",
"xf86dri", "xfixes", "xinerama", "xprint", "xproto",
"xtest", "xvmc", "xv"
]
extensions = [
"conn", "constant", "cookie",
"except", "ext", "extkey", "list", "module",
"protobj", "void"
]
ext_modules = [
Extension(
"xcb.xcb",
sources = ["xcb/%s.c" % i for i in extensions],
libraries = ["xcb"],
extra_compile_args=CFLAGS
)
]
class build_ext(_build_ext):
def run(self):
for i in xmlfiles:
py_client.build(os.path.join(find_xcb(), "%s.xml"%i))
return _build_ext.run(self)
setup(
name = 'xpyb',
version = "1.3",
ext_modules = ext_modules,
packages = ["xcb"],
cmdclass = {
"build_ext": build_ext
}
)