X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fc_client.py;h=19c8015a019d63b2f8bffeccb81669e891ce8ab3;hb=a9d15a08451c76a9250642c9f662f296196f60a0;hp=7bcf5e7e79859c00f687efb93aa0c0c2fddbecbd;hpb=5ee915e12a102e86e141981bbce60ed81037dfdc;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/c_client.py b/src/c_client.py index 7bcf5e7..19c8015 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 @@ -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()