#
#   PyGUI Distutils Setup Script
#

import os, sys
from glob import glob
from distutils.core import setup
from distutils.extension import Extension
from distutils.sysconfig import get_python_lib

have_pyrex = 0
cmdclass = {}
ext_modules = []
dst_gui_dir = os.path.join(get_python_lib(prefix = ""), "GUI")
dst_rsrc_dir = os.path.join(dst_gui_dir, "Resources")
src_rsrc_files = glob(os.path.join("GUI", "Resources", "*/*"))

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

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

#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 = "PyGUI",
    version = version,
    description = "Pythonic GUI Framework",
    author = "Gregory Ewing",
    author_email = "greg.ewing@canterbury.ac.nz",
    url = "http://www.cosc.canterbury.ac.nz/~greg/python_gui",
    packages = ["GUI", "GUI.Generic", "GUI.Cocoa", "GUI.Gtk"],
    ext_modules = ext_modules,
    data_files = [
        (dst_rsrc_dir, src_rsrc_files),
    ],
    cmdclass = cmdclass
)
