def generate_requirements(extras_require):
    """
    Convert requirements from a setup()-style dictionary to ('Requires-Dist', 'requirement')
    and ('Provides-Extra', 'extra') tuples.

    extras_require is a dictionary of {extra: [requirements]} as passed to setup(),
    using the empty extra {'': [requirements]} to hold install_requires.
    """
    for extra, depends in extras_require.items():
        condition = ''
        if extra and ':' in extra:  # setuptools extra:condition syntax
            extra, condition = extra.split(':', 1)
            extra = pkg_resources.safe_extra(extra)
        if extra:
            yield ('Provides-Extra', extra)
            if condition:
                condition = "(" + condition + ") and "
            condition += "extra == '%s'" % extra
        if condition:
            condition = '; ' + condition
        for new_req in convert_requirements(depends):
            yield ('Requires-Dist', new_req + condition)
def generate_requirements ( extras_require ) : for extra , depends in extras_require . items ( ) : condition = '' if extra and ':' in extra : extra , condition = extra . split ( ':' , 1 ) extra = pkg_resources . safe_extra ( extra ) if extra : yield ( 'Provides-Extra' , extra ) if condition : condition = "(" + condition + ") and " condition += "extra == '%s'" % extra if condition : condition = '; ' + condition for new_req in convert_requirements ( depends ) : yield ( 'Requires-Dist' , new_req + condition )
Convert requirements from a setup()-style dictionary to ('Requires-Dist', 'requirement')
    and ('Provides-Extra', 'extra') tuples.

    extras_require is a dictionary of {extra: [requirements]} as passed to setup(),
    using the empty extra {'': [requirements]} to hold install_requires.