Closed chinyeungli closed 3 years ago
The new Licensing.dedup() (that you did contribute ;) ) does exactly that: a license-specific simplification without reordering.
AH! I thought I did it but obviously forgotten. Need to look into the code to see if there is enough test for it.
>>> licensing = Licensing()
>>> exp = 'mit or apache-2.0 or public-domain or apache-2.0'
>>> licensing.dedup(exp)
OR(LicenseSymbol('mit', is_exception=False), LicenseSymbol('apache-2.0', is_exception=False), LicenseSymbol('public-domain', is_exception=False))
>>> licensing.dedup(exp).render()
'mit OR apache-2.0 OR public-domain'
>>>
It's working 👯 and we have test for it. Closing it.
Most of the time, the left most license key in the license expression is considered as the primary license (or primary license choice if both fall into the same license category). However, the simplify() break the order.
In my opinion, the simplify should not modify/break the order of a license_expression.