AC_MSG_RESULT($XCBPROTO_XCBINCLUDEDIR)
AC_SUBST(XCBPROTO_XCBINCLUDEDIR)
+# Find the xcbgen Python package
+AC_MSG_CHECKING(XCBPROTO_XCBPYTHONDIR)
+XCBPROTO_XCBPYTHONDIR=`$PKG_CONFIG --variable=pythondir xcb-proto`
+AC_MSG_RESULT($XCBPROTO_XCBPYTHONDIR)
+AC_SUBST(XCBPROTO_XCBPYTHONDIR)
+
AC_HEADER_STDC
AC_SEARCH_LIBS(getaddrinfo, socket)
AC_SEARCH_LIBS(connect, socket)
SUFFIXES = .xml
.xml.h:
- $(PYTHON) c_client.py $(XCBPROTO_XCBINCLUDEDIR)/$<
+ $(PYTHON) c_client.py -p $(XCBPROTO_XCBPYTHONDIR) $(XCBPROTO_XCBINCLUDEDIR)/$<
.xml.c:
- $(PYTHON) c_client.py $(XCBPROTO_XCBINCLUDEDIR)/$<
+ $(PYTHON) c_client.py -p $(XCBPROTO_XCBPYTHONDIR) $(XCBPROTO_XCBINCLUDEDIR)/$<
$(EXTENSION_XML):
$(LN_S) -f $(XCBPROTO_XCBINCLUDEDIR)/$@ $@
#!/usr/bin/env python
from xml.etree.cElementTree import *
-from sys import argv
from os.path import basename
+import getopt
+import sys
import re
# Jump to the bottom of this file for the main routine
# Boilerplate below this point
+# Check for the argument that specifies path to the xcbgen python package.
+try:
+ opts, args = getopt.getopt(sys.argv[1:], 'p:')
+except getopt.GetoptError, err:
+ print str(err)
+ print 'Usage: c_client.py [-p path] file.xml'
+ sys.exit(1)
+
+for (opt, arg) in opts:
+ if opt == '-p':
+ sys.path.append(arg)
+
# Import the module class
try:
from xcbgen.state import Module
raise
# Parse the xml header
-module = Module(argv[1], output)
+module = Module(args[0], output)
# Build type-registry and resolve type dependencies
module.register()