Return a new license expression string from an ``expression`` string replacing subexpressions using the DECLARED_TO_SPDX_SUBS expression subsitution table.
(expression)
| 1721 | |
| 1722 | |
| 1723 | def apply_expressions_mapping(expression): |
| 1724 | """ |
| 1725 | Return a new license expression string from an ``expression`` string |
| 1726 | replacing subexpressions using the DECLARED_TO_SPDX_SUBS expression |
| 1727 | subsitution table. |
| 1728 | """ |
| 1729 | licensing = Licensing() |
| 1730 | |
| 1731 | global DECLARED_TO_SPDX_SUBS |
| 1732 | if not DECLARED_TO_SPDX_SUBS: |
| 1733 | DECLARED_TO_SPDX_SUBS = { |
| 1734 | licensing.parse(src, simple=True): licensing.parse(tgt, simple=True) |
| 1735 | for src, tgt in DECLARED_TO_SPDX.items() |
| 1736 | } |
| 1737 | |
| 1738 | try: |
| 1739 | expression = licensing.parse(expression, simple=True) |
| 1740 | except: |
| 1741 | raise Exception(expression) |
| 1742 | return str(expression.subs(DECLARED_TO_SPDX_SUBS)) |
| 1743 | |
| 1744 | |
| 1745 | def apkbuild_options_handler(value, **kwargs): |
no test coverage detected