view src/SConscript @ 16:e07f0c7abdc0

Changed the notification messages sent by the key notifier to be more descriptive.
author Atul Varma <varmaa@toolness.com>
date Sun, 24 Feb 2008 20:15:57 -0600
parents af72a81169aa
children df405fded717
line wrap: on
line source

# ----------------------------------------------------------------------------
#
#   enso_osx.graphics SConscript
#
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------------

Import( "env" )

import os
import sys
import subprocess


# ----------------------------------------------------------------------------
# Helper Functions
# ----------------------------------------------------------------------------

def getOutput( params ):
    """
    Runs the given program, as specified by the parameter list.  Raises an
    exception with stderr output if the process has a nonzero return
    code.  Otherwise, it returns the stdout of the process as a string.
    """

    popen = subprocess.Popen( params,
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE )
    output, errors = popen.communicate()
    if popen.returncode != 0:
        sys.stderr.write( "Running '%s' failed.\n" % " ".join(params) )
        sys.stderr.write( "Output was:\n%s\n(end of output)\n" % errors )
        raise SystemError()
    return output


# ----------------------------------------------------------------------------
# Build Actions
# ----------------------------------------------------------------------------

# quartz cairo bridge

cairoLibFlags = getOutput( ["pkg-config", "cairo", "--libs"] )
cairoIncludeFlags = getOutput( ["pkg-config", "cairo", "--cflags"] )

qcbEnv = env.Copy()

qcbEnv.Append(
    CPPPATH=[os.path.join( sys.prefix, "include/pycairo" )],
    CCFLAGS=cairoIncludeFlags.split(),
    LINKFLAGS=cairoLibFlags,
    LIBS=["python", "cairo"],
    FRAMEWORKS=["AppKit"],
    )

quartzCairoBridge = qcbEnv.LoadableModule(
    source = ["quartz_cairo_bridge.m"],
    target = ["quartz_cairo_bridge.so"],
    )

qcbEnv.Install( "#enso_osx", quartzCairoBridge )

# key notifier

keyNotifier = env.Program(
    source = ["EnsoKeyNotifier.m"],
    FRAMEWORKS = ["ApplicationServices", "Foundation"]
    )

env.Install( "#bin", keyNotifier )