def convert_requirement(req):
    """
    Converts a pkg_resources.Requirement object into a list of Rez package
    request strings.
    """
    pkg_name = convert_name(req.project_name)
    if not req.specs:
        return [pkg_name]

    req_strs = []
    for spec in req.specs:
        op, ver = spec
        ver = convert_version(ver)
        if op == "<":
            r = "%s-0+<%s" % (pkg_name, ver)
            req_strs.append(r)
        elif op == "<=":
            r = "%s-0+<%s|%s" % (pkg_name, ver, ver)
            req_strs.append(r)
        elif op == "==":
            r = "%s-%s" % (pkg_name, ver)
            req_strs.append(r)
        elif op == ">=":
            r = "%s-%s+" % (pkg_name, ver)
            req_strs.append(r)
        elif op == ">":
            r1 = "%s-%s+" % (pkg_name, ver)
            r2 = "!%s-%s" % (pkg_name, ver)
            req_strs.append(r1)
            req_strs.append(r2)
        elif op == "!=":
            r = "!%s-%s" % (pkg_name, ver)
            req_strs.append(r)
        else:
            print >> sys.stderr, \
                "Warning: Can't understand op '%s', just depending on unversioned package..." % op
            req_strs.append(pkg_name)

    return req_strs
def convert_requirement ( req ) : pkg_name = convert_name ( req . project_name ) if not req . specs : return [ pkg_name ] req_strs = [ ] for spec in req . specs : op , ver = spec ver = convert_version ( ver ) if op == "<" : r = "%s-0+<%s" % ( pkg_name , ver ) req_strs . append ( r ) elif op == "<=" : r = "%s-0+<%s|%s" % ( pkg_name , ver , ver ) req_strs . append ( r ) elif op == "==" : r = "%s-%s" % ( pkg_name , ver ) req_strs . append ( r ) elif op == ">=" : r = "%s-%s+" % ( pkg_name , ver ) req_strs . append ( r ) elif op == ">" : r1 = "%s-%s+" % ( pkg_name , ver ) r2 = "!%s-%s" % ( pkg_name , ver ) req_strs . append ( r1 ) req_strs . append ( r2 ) elif op == "!=" : r = "!%s-%s" % ( pkg_name , ver ) req_strs . append ( r ) else : print >> sys . stderr , "Warning: Can't understand op '%s', just depending on unversioned package..." % op req_strs . append ( pkg_name ) return req_strs
Converts a pkg_resources.Requirement object into a list of Rez package
    request strings.