X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fc_client.py;h=1c6ad16e4d7ce5836a7c8029f91e8314b45e390e;hb=1bbdba52116f127bed3ce812a00240b4009bbf22;hp=7bcf5e7e79859c00f687efb93aa0c0c2fddbecbd;hpb=5ee915e12a102e86e141981bbce60ed81037dfdc;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/c_client.py b/src/c_client.py index 7bcf5e7..1c6ad16 100755 --- a/src/c_client.py +++ b/src/c_client.py @@ -1,7 +1,8 @@ #!/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 @@ -182,7 +183,7 @@ def c_open(self): _h('extern xcb_extension_t %s;', _ns.c_ext_global_name) _c('') - _c('xcb_extension_t %s = { "%s" };', _ns.c_ext_global_name, _ns.ext_xname) + _c('xcb_extension_t %s = { "%s", 0 };', _ns.c_ext_global_name, _ns.ext_xname) def c_close(self): ''' @@ -982,6 +983,18 @@ output = {'open' : c_open, # 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 @@ -989,13 +1002,14 @@ except ImportError: print '' print 'Failed to load the xcbgen Python package!' print 'Make sure that xcb/proto installed it on your Python path.' - print 'If not, you will need to create a .pth file to extend the path.' + print 'If not, you will need to create a .pth file or define $PYTHONPATH' + print 'to extend the path.' print 'Refer to the README file in xcb/proto for more info.' print '' raise # Parse the xml header -module = Module(argv[1], output) +module = Module(args[0], output) # Build type-registry and resolve type dependencies module.register()