Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
pip-log.txt

# Unit test / coverage reports
.tox
.cache
.coverage
.coverage.*
Expand Down
47 changes: 27 additions & 20 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
===============================
==================
license-expression
===============================
==================

license-expression is small utility library to parse, compare, simplify and normalize
license-expression is a small utility library to parse, compare, simplify and normalize
license expressions (e.g. SPDX license expressions) using boolean logic such as:
`GPL-2.0 or later WITH Classpath Exception AND MIT`.


See also for details:
https://spdx.org/sites/cpstandard/files/pages/files/spdxversion2.1.pdf#page=95&zoom=auto

license: apache-2.0

Python: 2.7 and 3.4+


Build and tests status
======================

+-------+-------------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+
|Branch | **Linux (Travis)** | **MacOSX (Travis)** | **Windows (AppVeyor)** |
+=======+===============================================================================+===============================================================================+=============================================================================================================+
| |.. image:: https://api.travis-ci.org/nexB/license-expression.png?branch=master |.. image:: https://api.travis-ci.org/nexB/license-expression.png?branch=master |.. image:: https://ci.appveyor.com/api/projects/status/github/nexB/license-expression?svg=true |
|Master | :target: https://travis-ci.org/nexB/license-expression | :target: https://travis-ci.org/nexB/license-expression | :target: https://ci.appveyor.com/project/nexB/license-expression |
| | :alt: Linux Master branch tests status | :alt: MacOSX Master branch tests status | :alt: Windows Master branch tests status |
+-------+-------------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+
+-------+-------------------------------------------+--------------------------------------------+---------------------------------------------+
|Branch | **Linux (Travis)** | **MacOSX (Travis)** | **Windows (AppVeyor)** |
+=======+===========================================+============================================+=============================================+
| |.. image:: travis-master-icon_ |.. image:: travis-master-icon_ |.. image:: appveyor-master-icon_ |
|Master | :target: travis-master-link_ | :target: travis-master-link_ | :target: appveyor-master-link_ |
| | :alt: Linux Master branch tests status | :alt: MacOSX Master branch tests status | :alt: Windows Master branch tests status |
+-------+-------------------------------------------+--------------------------------------------+---------------------------------------------+

.. _travis-master-icon: https://api.travis-ci.org/nexB/license-expression.png?branch=master
.. _travis-master-link: https://travis-ci.org/nexB/license-expression

.. _appveyor-master-icon: https://ci.appveyor.com/api/projects/status/github/nexB/license-expression?svg=true
.. _appveyor-master-link: https://ci.appveyor.com/project/nexB/license-expression


Source code and download
Expand All @@ -42,6 +46,7 @@ Submit bugs and questions at:

Description
===========

This module defines a mini language to parse, validate, simplify, normalize and
compare license expressions using a boolean logic engine.

Expand All @@ -53,11 +58,12 @@ equivalence and can be normalized or simplified.

The main entry point is the Licensing object.


Usage examples
==============

For example::
For example:

.. code-block:: python

>>> from license_expression import Licensing, LicenseSymbol
>>> licensing = Licensing()
Expand Down Expand Up @@ -89,15 +95,17 @@ For example::
>>> assert expected == licensing.license_symbols(parsed)
>>> assert expected == licensing.license_symbols(expression)

And expression can be simplified:

And expression can be simplified::
.. code-block:: python

>>> expression2 = ' GPL-2.0 or (mit and LGPL 2.1) or bsd Or GPL-2.0 or (mit and LGPL 2.1)'
>>> parsed2 = licensing.parse(expression2)
>>> assert str(parsed2.simplify()) == 'BSD OR GPL-2.0 OR (LGPL 2.1 AND mit)'


Two expressions can be compared for equivalence and containment::
Two expressions can be compared for equivalence and containment:

.. code-block:: python

>>> expr1 = licensing.parse(' GPL-2.0 or (LGPL 2.1 and mit) ')
>>> expr2 = licensing.parse(' (mit and LGPL 2.1) or GPL-2.0 ')
Expand All @@ -117,11 +125,10 @@ Two expressions can be compared for equivalence and containment::
>>> licensing.contains(expr2, expr4)
True


Development
===========

* Checkout a clone from https://github.com/nexB/license-expression.git
* Then run `./configure` (or `configure.bat`) and then `source bin/activate`. This will
* Then run ``./configure`` (or ``configure.bat``) and then ``source bin/activate``. This will
install all vendored dependencies in a local virtualenv, including development deps.
* To run the tests, run `py.test -vvs`
* To run the tests, run ``py.test -vvs``
2 changes: 2 additions & 0 deletions etc/conf/dev/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
py
colorama
pytest
pluggy
tox
Binary file not shown.
Binary file not shown.
8 changes: 4 additions & 4 deletions thirdparty/base/certifi.ABOUT
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
about_resource: certifi-2016.8.8-py2.py3-none-any.whl
version: 2016.8.8
about_resource: certifi-2017.4.17-py2.py3-none-any.whl
version: 2017.4.17
description: Python package for providing Mozilla's CA Bundle.

download_url: hhttps://pypi.python.org/packages/dd/ed/e9bf6a9dc79e23c68385c4ea692f0e9e1a7880518872564f88be013b552f/certifi-2016.8.8-py2.py3-none-any.whl#md5=cd6b969efda72327c5178c3ef0946ff2
download_url: https://pypi.python.org/packages/eb/01/c1f58987b777d6c4ec535b4e004a4a07bfc9db06f0c7533367ca6da8f2a6/certifi-2017.4.17-py2.py3-none-any.whl#md5=7d6198f160686046fd727900adf39f5b

name: certifi
owner: Kenneth Reitz
contact: me@kennethreitz.com
home_url: http://certifi.io/
name: certifi

dje_license: mpl-2.0
license_text_file: mpl-2.0.LICENSE
Expand Down
Binary file removed thirdparty/base/pip-8.1.2-py2.py3-none-any.whl
Binary file not shown.
Binary file added thirdparty/base/pip-9.0.1-py2.py3-none-any.whl
Binary file not shown.
8 changes: 4 additions & 4 deletions thirdparty/base/pip.ABOUT
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
about_resource: pip-8.1.2-py2.py3-none-any.whl
version: 8.1.2
download_url: https://pypi.python.org/packages/9c/32/004ce0852e0a127f07f358b715015763273799bd798956fa930814b60f39/pip-8.1.2-py2.py3-none-any.whl#md5=0570520434c5b600d89ec95393b2650b
about_resource: pip-9.0.1-py2.py3-none-any.whl (1.3MB)
download_url: https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144
version: 9.0.1

name: pip
owner: The pip developers
contact: python-virtualenv@groups.google.com
home_url: http://www.pip-installer.org

author_file: pip.AUTHORS
dje_license: mit, lgpl-2.1
dje_license: mit, OTHER TODO
license_text_file: pip.LICENSE

vcs_tool: git
Expand Down
Binary file not shown.
16 changes: 9 additions & 7 deletions thirdparty/base/setuptools.ABOUT
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
about_resource: setuptools-25.2.0-py2.py3-none-any.whl
name: setuptools
version: 25.2.0
about_resource: setuptools-36.0.1-py2.py3-none-any.whl
version: 36.0.1
description: Easily download, build, install, upgrade, and uninstall Python packages

download_url: setuptools-25.2.0-py2.py3-none-any.whl
download_url: https://pypi.python.org/packages/fc/cb/748dcabb152fbc7eceaf585d052b8bc11cf028b917a7d2343cf1e0c092c3/setuptools-36.0.1-py2.py3-none-any.whl#md5=7a52500dcfd7c4f37f5d20e462c93560

home_url: https://pypi.python.org/pypi/setuptools
name: setuptools
owner: Python Packaging Authority
contact: distutils-sig@python.org
home_url: https://pypi.python.org/pypi/setuptools

dje_license: psf
license_text_file: PSF.LICENSE
dje_license: mit
license_text_file: setuptools.LICENSE
19 changes: 19 additions & 0 deletions thirdparty/base/setuptools.LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (C) 2016 Jason R Coombs <jaraco@jaraco.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions thirdparty/base/virtualenv.ABOUT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
about_resource: virtualenv-12.0.5-py2.py3-none-any.whl
version: 12.0.5
download_url: https://pypi.python.org/packages/py2.py3/v/virtualenv/virtualenv-12.0.5-py2.py3-none-any.whl#md5=01551e6cd34a9e5fde66c937c56d0193
about_resource: virtualenv-15.1.0-py2.py3-none-any.whl
version: 15.1.0
download_url: https://pypi.python.org/packages/6f/86/3dc328ee7b1a6419ebfac7896d882fba83c48e3561d22ddddf38294d3e83/virtualenv-15.1.0-py2.py3-none-any.whl#md5=aa7e5b86cc8cdb99794c4b99e8d670f3

vcs_tool: git
vcs_repository: https://github.com/pypa/virtualenv.git
Expand Down
Binary file removed thirdparty/base/wheel-0.29.0-py2.py3-none-any.whl
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions thirdparty/base/wheel.ABOUT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
about_resource: wheel-0.29.0-py2.py3-none-any.whl
version: 0.29.0
download_url: https://pypi.python.org/packages/py2.py3/w/wheel/wheel-0.29.0-py2.py3-none-any.whl#md5=d7db45db5c131af262b8ffccde46a88a
about_resource: wheel-0.30.0a0-py2.py3-none-any.whl
version: 0.30.0a0
download_url: https://pypi.python.org/packages/83/53/e120833aa2350db333df89a40dea3b310dd9dabf6f29eaa18934a597dc79/wheel-0.30.0a0-py2.py3-none-any.whl#md5=ffa1ee60be515c04b4c13fd13feea27a

name: wheel
home_url: https://bitbucket.org/pypa/wheel
Expand Down
Binary file removed thirdparty/dev/colorama-0.3.7-py2.py3-none-any.whl
Binary file not shown.
Binary file not shown.
10 changes: 5 additions & 5 deletions thirdparty/dev/colorama.ABOUT
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
about_resource: colorama-0.3.7-py2.py3-none-any.whl
download_url: https://pypi.python.org/packages/b7/8e/ddb32ddaabd431813e180ca224e844bab8ad42fbb47ee07553f0ec44cd86/colorama-0.3.7-py2.py3-none-any.whl#md5=7d474974709d63d1f249ec61f8e62663
version: 0.3.7
about_resource: colorama-0.3.9-py2.py3-none-any.whl
download_url: https://pypi.python.org/packages/db/c8/7dcf9dbcb22429512708fe3a547f8b6101c0d02137acbd892505aee57adf/colorama-0.3.9-py2.py3-none-any.whl#md5=cc0c01c7b3b34d0354d813e9ab26aca3
version: 0.3.9

name: colorama
description: Cross-platform colored terminal text.
home_url: https://pypi.python.org/pypi/colorama
home_url: https://github.com/tartley/colorama
owner: Jonathan Hartley
contains: tartley@tartley.com
contact: tartley@tartley.com
dje_license: bds-new
keywords: color colour terminal text ansi windows crossplatform xplatform
license_text_file: colorama.LICENSE
Binary file added thirdparty/dev/pluggy-0.4.0-py2.py3-none-any.whl
Binary file not shown.
11 changes: 11 additions & 0 deletions thirdparty/dev/pluggy.ABOUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
about_resource: pluggy-0.4.0-py2.py3-none-any.whl
download_url: https://pypi.python.org/packages/52/5e/3e63895c9730f37195db7d3f3a6465b7ffce08871ca217947b81f452ce62/pluggy-0.4.0-py2.py3-none-any.whl#md5=df144953fde470f504573b32655259e2
version: 0.4.0

name: pluggy
description: plugin and hook calling mechanisms for python
home_url: https://github.com/pytest-dev/pluggy
owner: Holger Krekel
contact: holger at merlinux.eu
dje_license: mit
license_text_file: pluggy.LICENSE
22 changes: 22 additions & 0 deletions thirdparty/dev/pluggy.LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 holger krekel (rather uses bitbucket/hpk42)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Binary file removed thirdparty/dev/py-1.4.32-py2.py3-none-any.whl
Binary file not shown.
Binary file added thirdparty/dev/py-1.4.34-py2.py3-none-any.whl
Binary file not shown.
8 changes: 4 additions & 4 deletions thirdparty/dev/py.ABOUT
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
about_resource: py-1.4.32-py2.py3-none-any.whl
version: 1.4.32
download_url: https://pypi.python.org/packages/02/79/ea0c2750dde4b19bf2e305d201e4dd488f6671b51f52d8cf87aba174a158/py-1.4.32-py2.py3-none-any.whl#md5=b032575d68c53dca60b8bdd8ffb8716b
about_resource: py-1.4.34-py2.py3-none-any.whl
version: 1.4.34
download_url: https://pypi.python.org/packages/53/67/9620edf7803ab867b175e4fd23c7b8bd8eba11cb761514dcd2e726ef07da/py-1.4.34-py2.py3-none-any.whl#md5=0cb02dbd9cf647f97b8963d4def97a7f

name: py
description: library with cross-python path, ini-parsing, io, code, log facilities
home_url: http://pylib.readthedocs.org/
home_url: http://py.readthedocs.org/
owner: holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others
contatct: pytest-dev@python.org
dje_license: mit
Expand Down
Binary file removed thirdparty/dev/pytest-3.0.5-py2.py3-none-any.whl
Binary file not shown.
Binary file added thirdparty/dev/pytest-3.1.1-py2.py3-none-any.whl
Binary file not shown.
6 changes: 3 additions & 3 deletions thirdparty/dev/pytest.ABOUT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
about_resource: pytest-3.0.5-py2.py3-none-any.whl
download_url: https://pypi.python.org/packages/dd/28/4abc547194d8e6ff93d3ef186cb809a413d719cdc21e524af08fe986f7c2/pytest-3.0.5-py2.py3-none-any.whl#md5=790888ee21cfd19c104155b0ae9b84e5
version: 3.0.5
about_resource: pytest-3.1.1-py2.py3-none-any.whl
download_url: https://pypi.python.org/packages/43/67/bd3a6148fc8a2d989ded3af319100e30fb6908f2d0a284e5cd9d20fbeb6d/pytest-3.1.1-py2.py3-none-any.whl#md5=34f4a39d5265dfc895c19796fd3b0dc1
version: 3.1.1

name: pytest
description: pytest: simple powerful testing with Python
Expand Down
Binary file added thirdparty/dev/tox-2.7.0-py2.py3-none-any.whl
Binary file not shown.
11 changes: 11 additions & 0 deletions thirdparty/dev/tox.ABOUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
about_resource: tox-2.7.0-py2.py3-none-any.whl
download_url: https://pypi.python.org/packages/89/86/82cdd5ac460bdc4021da26ec978028a45bd840e626a4854605e6a1055533/tox-2.7.0-py2.py3-none-any.whl#md5=5a25e74c20d13f1644086de850a2d987
version: 2.7.0

name: tox
description: virtualenv-based automation of test activities
home_url: https://tox.readthedocs.org/
owner: Holger Krekel
contact: holger@merlinux.eu
dje_license: mit
license_text_file: tox.LICENSE
20 changes: 20 additions & 0 deletions thirdparty/dev/tox.LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tox]
envlist=py27,py36
[testenv]
commands=pytest -vvs