#
#   PyGUI Distutils Setup Script
#

import os, sys
from distutils.core import setup
from distutils.extension import Extension

have_pyrex = 0
cmdclass = {}
ext_modules = []

try:
    import Pyrex.Distutils
    print "Pyrex available"
    have_pyrex = 1
    cmdclass = {'build_ext': Pyrex.Distutils.build_ext}
except ImportError:
    pass

execfile(os.path.join("GUI", "Version.py"))

if sys.platform == "darwin":
    if have_pyrex:
        agl_source = "GUI/Mac/AGL.pyx"
    else:
        agl_source = "GUI/Mac/AGL.c"
    agl_module = Extension("GUI.Mac.AGL", [agl_source], 
        include_dirs = ["/System/Library/Frameworks/AGL.framework/Headers"],
        extra_link_args = ["-Wl,-w", "-framework", "AGL", "-framework", "Carbon"])
    ext_modules.append(agl_module)

setup(
    name = "foo",
    version = version,
    description = "Pythonic GUI Framework",
    author = "Greg Ewing",
    author_email = "greg@cosc.canterbury.ac.nz",
    url = "http://www.cosc.canterbury.ac.nz/~greg/python_gui",
    packages = ["GUI", "GUI.Generic", "GUI.Mac", "GUI.Gtk"],
    ext_modules = ext_modules,
    cmdclass = cmdclass
)
