def _setup_flavor(env, flavor):
    """Setup a flavor, providing customization hooks to modify CloudBioLinux installs.

    Specify flavor as a name, in which case we look it up in the standard
    flavor directory (contrib/flavor/your_flavor), or as an absolute path to a
    flavor directory outside of cloudbiolinux.
    """
    env.flavor = Flavor(env)
    env.flavor_dir = None
    if flavor:
        # set the directory for flavor customizations
        if os.path.isabs(flavor) or os.path.exists(flavor):
            flavor_dir = flavor
        else:
            flavor_dir = os.path.join(os.path.dirname(__file__), '..', 'contrib', 'flavor', flavor)
        assert os.path.exists(flavor_dir), \
            "Did not find directory {0} for flavor {1}".format(flavor_dir, flavor)
        env.flavor_dir = flavor_dir
        flavor_name = os.path.split(flavor_dir)[-1]
        # Reinstantiate class if custom defined
        import cloudbio.flavor
        try:
            env.flavor = getattr(cloudbio.flavor, flavor_name.capitalize())(env)
        except __HOLE__:
            pass
        env.flavor.name = flavor_name
        # Load python customizations to base configuration if present
        for ext in ["", "flavor"]:
            py_flavor = os.path.split(os.path.realpath(flavor_dir))[1] + ext
            flavor_custom_py = os.path.join(flavor_dir, "{0}.py".format(py_flavor))
            if os.path.exists(flavor_custom_py):
                sys.path.append(flavor_dir)
                mod = __import__(py_flavor, fromlist=[py_flavor])
        env.logger.info(env.flavor)
        env.logger.info("This is a %s flavor" % env.flavor.name)
dataset/ETHPy150Open chapmanb/cloudbiolinux/cloudbio/utils.py/_setup_flavor