'When easy_install is about to run bdist_egg on a source dist, that
source dist might have \'setup_requires\' directives, requiring
additional fetching. Ensure the fetcher options given to easy_install
are available to that command as well.'

def _set_fetcher_options(self, base):

    ei_opts = self.distribution.get_option_dict('easy_install').copy()
    fetch_directives = ('find_links', 'site_dirs', 'index_url', 'optimize', 'site_dirs', 'allow_hosts')
    fetch_options = {}
    for (key, val) in ei_opts.items():
        if (key not in fetch_directives):
            continue
        fetch_options[key.replace('_', '-')] = val[1]
    settings = dict(easy_install=fetch_options)
    cfg_filename = os.path.join(base, 'setup.cfg')
    setopt.edit_config(cfg_filename, settings)
