def refine_from_user_input(parent_requirements, specification, jamfile_module,
                           location):
    """Refines requirements with requirements provided by the user.
    Specially handles "-<property>value" syntax in specification
     to remove given requirements.
     - parent-requirements -- property-set object with requirements
       to refine
     - specification -- string list of requirements provided by the use
     - project-module -- the module to which context indirect features
       will be bound.
     - location -- the path to which path features are relative."""
    assert isinstance(parent_requirements, PropertySet)
    assert is_iterable_typed(specification, basestring)
    assert isinstance(jamfile_module, basestring)
    assert isinstance(location, basestring)

    if not specification:
        return parent_requirements


    add_requirements = []
    remove_requirements = []

    for r in specification:
        if r[0] == '-':
            remove_requirements.append(r[1:])
        else:
            add_requirements.append(r)

    if remove_requirements:
        # Need to create property set, so that path features
        # and indirect features are translated just like they
        # are in project requirements.
        ps = create_from_user_input(remove_requirements,
                                    jamfile_module, location)

        parent_requirements = create(difference(parent_requirements.all(),
                                                ps.all()))
        specification = add_requirements

    requirements = create_from_user_input(specification,
                                          jamfile_module, location)

    return parent_requirements.refine(requirements)