def compile (pluginConfig):

    # hacky crap to get directory of currently running script file
    pluginConfig['script_dir'] = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    sys.path.insert(0, pluginConfig['script_dir'])

    # try to load images.yaml in a few different places
    locations = [
        'images.yaml',
        '../images.yaml',
        os.path.join(pluginConfig['script_dir'], 'images.yaml'),
        os.path.join(pluginConfig['project_dir'], 'images.yaml')
    ]

    for location in locations:
        try:
            test = yaml.load(open(location, 'r'))
            # Save the correct path to images.yaml
            yaml_path = location
            break
        except Exception:
            pass
    else:
        raise Exception('images.yaml file not found!')

    modCheck = ModCheck()

    backends = {}
    backends['illustrator'] = illustrator
    backends['inkscape'] = inkscape

    for name, desc in test.items():
        print 'Rendering group', name

        # Load up renderizer plugins for this backend
        plugins = []
        if 'plugins' in desc:
            for plugin in desc['plugins']:
                module = __import__(plugin)
                plugins.append(module.plugin(desc))

        # Explode image paths
        replacers = []
        for line in desc['images']:
            if '*' in line or '?' in line or '[' in line:
                replacers.append(line)
        for line in replacers:
            desc['images'].remove(line)
            desc['images'].extend(glob.glob(os.path.join(pluginConfig['project_dir'], 'images', line)))

        for outputConfig in desc['output']:

            # validation
            if 'backend' not in desc:
                raise Exception(
                    "You must specify a render backend for output number " +
                    str(desc['output'].index(outputConfig)) + " in image group "
                    + name
                )

            if desc['backend'] not in backends :
                raise Exception(
                    "Invalid backend " + outputConfig['backend'] +
                    "specified in image group " + name
                )

            groupMatchesTiProps = False

            # check properties on the group itself; if these don't match we set
            # groupMatchesTiProps to false.  This will cause the output files
            # for this group to be removed, thereby cleaning the output
            # directory of links which dont match the current build
            # configuration
            if checkProps(TiBuildProps, pluginConfig, desc):
                groupMatchesTiProps = True

            # ensure the outputConfig directory exists
            try:
                os.makedirs(os.path.join(
                    pluginConfig['project_dir'],
                    outputConfig['path']
                ))
            except os.error:
                pass

            # ensure build directory exists
            try:
                os.makedirs(os.path.join(
                    pluginConfig['project_dir'],
                    'build', 'images',
                    outputConfig['path']
                ))
            except os.error:
                pass

            # render each sourceImage
            for sourceImage in desc['images']:

                # handle `rename` and `append` properties
                if 'rename' in outputConfig:
                    basename = outputConfig['rename']
                else:
                    basename = os.path.splitext(os.path.basename(sourceImage))[0]
                    if 'append' in outputConfig:
                        basename += outputConfig['append']
                    if 'prepend' in outputConfig:
                        basename = outputConfig['prepend'] + basename
                    basename += '.png'

                # compute filename and temp filename
                computedFilename = os.path.join(
                    pluginConfig['project_dir'],
                    outputConfig['path'],
                    basename
                )

                tempFilename = os.path.join(
                    pluginConfig['project_dir'],
                    'build', 'images',
                    outputConfig['path'],
                    basename
                )

                # generate path of source image
                sourceImage = os.path.join(
                    pluginConfig['project_dir'],
                    "images",
                    sourceImage
                )

                # check to see if we need to re-render the image; if so, render
                if not modCheck.check(sourceImage, tempFilename, outputConfig):
                    print sourceImage, 'not modified, not rendering'
                else:
                    # if we've gotten to this point, we're ready to render
                    renderBackend = backends[desc['backend']]

                    # loop over renderizer plugins, call the beforeRender function
                    for plugin in plugins:
                        plugin.beforeRender(sourceImage, tempFilename, outputConfig, pluginConfig)

                    renderBackend(
                        sourceImage,
                        tempFilename,
                        outputConfig,
                        pluginConfig
                    )

                    for plugin in plugins:
                        ret = plugin.afterRender(sourceImage, tempFilename, outputConfig, pluginConfig, computedFilename)
                        if ret != None:
                            computedFilename = ret

                # remove the output file; it will be replaced with a symlink to
                # the rendered image, if applicable
                try:
                    os.remove(computedFilename)
                except:
                    pass

                # replace the output file with a symlink to the rendered image
                # in build/images/, if the property check suceeds
                if checkProps(TiBuildProps, pluginConfig, outputConfig) and groupMatchesTiProps:
                    os.symlink(tempFilename, computedFilename)
Given a file path, determine whether we should read/send it.
dataset/ETHPy150Open rf/renderizer/plugin.py/compile--crossover with--dataset/ETHPy150Open gtaylor/EVE-Market-Data-Uploader/emdu/cache_watcher/crude_watcher.py/CrudeCacheWatcher.see_if_file_has_new_data