def deps_from_pydit_json(requires, runtime=True):
    """Parses dependencies returned by pydist.json, since versions
    uses brackets we can't use pkg_resources to parse and we need a separate
    method
    Args:
        requires: list of dependencies as written in pydist.json of the package
        runtime: are the dependencies runtime (True) or build time (False)
    Returns:
        List of semi-SPECFILE dependecies (see dependency_to_rpm for format)
    """
    parsed = []
    for req in requires:
        # req looks like 'some-name (>=X.Y,!=Y.X)' or 'someme-name' where
        # 'some-name' is the name of required package and '(>=X.Y,!=Y.X)'
        # are specs
        name, specs = None, None
        # len(reqs) == 1 if there are not specified versions, 2 otherwise
        reqs = req.split(' ')
        name = reqs[0]
        if len(reqs) == 2:
            specs = reqs[1]
            # try if there are more specs in spec part of the requires
            specs = specs.split(",")
            # strip brackets
            specs = [re.sub('[()]', '', spec) for spec in specs]
            # this will divide (>=0.1.2) to ['>=', '0', '.1.2']
            # or (0.1.2) into ['', '0', '.1.2']
            specs = [re.split('([0-9])', spec, 1) for spec in specs]
            # we have separated specs based on number as delimiter
            # so we need to join it back to rest of version number
            # e.g ['>=', '0', '.1.2'] to ['>=', '0.1.2']
            for spec in specs:
                spec[1:3] = [''.join(spec[1:3])]
        if specs:
            for spec in specs:
                if '!' in spec[0]:
                    parsed.append(['Conflicts', name, '=', spec[1]])
                elif specs[0] == '==':
                    parsed.append(['Requires', name, '=', spec[1]])
                else:
                    parsed.append(['Requires', name, spec[0], spec[1]])
        else:
            parsed.append(['Requires', name])

    if not runtime:
        for pars in parsed:
            pars[0] = 'Build' + pars[0]

    return parsed
Parses dependencies returned by pydist.json, since versions
    uses brackets we can't use pkg_resources to parse and we need a separate
    method
    Args:
        requires: list of dependencies as written in pydist.json of the package
        runtime: are the dependencies runtime (True) or build time (False)
    Returns:
        List of semi-SPECFILE dependecies (see dependency_to_rpm for format)