General formatting clean-up.
[xiph/unicode.git] / ogg-python / setup.py
blobbb4df592d7aa8b29164284981c25581c4a875fbf
1 #!/usr/bin/env python
3 """Setup script for the Ogg module distribution."""
5 import os
6 import re
7 import sys
8 import string
10 from distutils.core import setup
11 from distutils.extension import Extension
13 VERSION_MAJOR = 1
14 VERSION_MINOR = 4
15 pyogg_version = str(VERSION_MAJOR) + "." + str(VERSION_MINOR)
17 def get_setup():
18 data = {}
19 r = re.compile(r'(\S+)\s*?=\s*(.+)')
21 if not os.path.isfile('Setup'):
22 print "No 'Setup' file. Perhaps you need to run the configure script."
23 sys.exit(1)
25 f = open('Setup', 'r')
27 for line in f.readlines():
28 m = r.search(line)
29 if not m:
30 print "Error in setup file:", line
31 sys.exit(1)
32 key = m.group(1)
33 val = m.group(2)
34 data[key] = val
36 return data
38 data = get_setup()
39 ogg_include_dir = data['ogg_include_dir']
40 ogg_lib_dir = data['ogg_lib_dir']
41 ogg_libs = string.split(data['ogg_libs'])
43 _oggmodule = Extension(name='_ogg',
44 sources=['src/_oggmodule.c',
45 'src/pyoggpacket.c',
46 'src/pyoggstreamstate.c',
47 'src/pyoggpage.c',
48 'src/pyoggpackbuff.c',
49 'src/pyoggsyncstate.c',
50 'src/general.c'],
51 define_macros = [('VERSION_MAJOR', VERSION_MAJOR),
52 ('VERSION_MINOR', VERSION_MINOR),
53 ('VERSION', '"%s"' % pyogg_version)],
55 include_dirs=[ogg_include_dir, 'include'],
56 library_dirs=[ogg_lib_dir],
57 libraries=ogg_libs)
59 setup ( name = "pyogg",
60 version = pyogg_version,
61 description = "A wrapper for the Ogg libraries.",
62 author = "Andrew Chatham",
63 author_email = "andrew.chatham@duke.edu",
64 url = "http://dulug.duke.edu/~andrew/pyogg",
66 headers = ['include/pyogg/pyogg.h'],
67 packages = ['ogg'],
68 package_dir = {'ogg' : 'pysrc'},
69 ext_package = 'ogg',
70 ext_modules = [_oggmodule])