1#!/usr/bin/env python
2import os,sys
3
4from distutils.core import setup
5
6## This is where module 'antlr' resides in the installed package
7dstdir = '@prefix@/share/@PACKAGE_NAME@-@PACKAGE_VERSION@'
8
9## This is where module 'antlr' resides in the source distribution'
10srcdir = '@abs_top_srcdir@/lib/python/antlr'
11moddir = None
12
13for d in [ dstdir, srcdir ] :
14   moddir = d
15   for f in [ '__init__.py','antlr.py' ] :
16      if moddir :
17         x = "%s/%s" % (moddir,f)
18         if not os.path.exists(x) :
19            sys.stderr.write('notice: "%s" does not exist - going to skip dir "%s")\n' % (x,moddir))
20            sys.stderr.flush()
21            moddir = None
22   if moddir:
23      break
24
25if not moddir:
26   sys.stderr.write('error: unable to find module "antlr".\n')
27   sys.stderr.flush()
28   sys.exit(1)
29else:
30   sys.stderr.write('notice: module "antlr" found in "%s"\n' % (moddir))
31
32setup(name="antlr",
33      version="@PACKAGE_VERSION@",
34      description="Python runtime support for ANTLR-generated parsers",
35      author="Wolfgang Haefelinger / Marq Kole",
36      author_email="ora.et.labora@web.de",
37      url="http://www.antlr.org/",
38      packages=['antlr'],
39      package_dir={'antlr' : moddir }
40     )
41