Skip to content
Closed
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
43 changes: 33 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
# This deliberately is not "python" as a work-around to support
# multi-os builds with custom Python versions in Travis CI.
language: cpp

os:
- osx
- linux
language: python

env:
matrix:
- PYTHON_EXE="`pyenv install -s 2.7.13 && pyenv local 2.7.13`"
- PYTHON_EXE="`pyenv install -s 3.5.3 && pyenv local 3.5.3`"
- PYTHON_EXE="`pyenv install -s 2.7.14 && pyenv local 2.7.14`"
- PYTHON_EXE="`pyenv install -s 3.6.1 && pyenv local 3.6.1`"


# Travis does not offer OSX with arbitrary python versions (like 2.7.13 above)
# So, you cannot simply have the following section in your build matrix:
# os:
# - linux
# - osx
# Instead, you have to include OSX entries into the build matrix manually.
# In particular, this means specifying the environment variables again.

# The following was adapted from here:
# https://docs.travis-ci.com/user/multi-os/
# Set `language: generic` to clear `language: python` from above
# Set `python:` (to empty) to clear it from the travis-ci web interface
# Set `osx_image: xcode7.3` to pin OSX version see here:
# https://docs.travis-ci.com/user/osx-ci-environment/

matrix:
include:
- os: osx
language: generic
python:
osx_image: xcode7.3
env: PYTHON_EXE="`pyenv install -s 2.7.14 && pyenv local 2.7.14`"
- os: osx
language: generic
python:
osx_image: xcode7.3
env: PYTHON_EXE="`pyenv install -s 3.6.1 && pyenv local 3.6.1`"


install:
- pyenv install --list
- ./configure
Expand All @@ -32,4 +55,4 @@ notifications:
use_notice: true
skip_join: true
template:
- "%{repository_slug}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} : %{build_url}"
- "%{repository_slug}#%{build_number} (%{branch}-%{commit}:%{author})-%{message}- %{build_url}"
18 changes: 9 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ license-expression

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`.
`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
Expand Down Expand Up @@ -102,27 +102,27 @@ 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)'
>>> 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)'
>>> assert str(parsed2.simplify()) == 'BSD OR GPL-2.0 OR (LGPL-2.1 AND mit)'

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 ')
>>> expr1 = licensing.parse(' GPL-2.0 or (LGPL-2.1 and mit) ')
>>> expr2 = licensing.parse(' (mit and LGPL-2.1) or GPL-2.0 ')
>>> licensing.is_equivalent(expr1, expr2)
True
>>> licensing.is_equivalent(' GPL-2.0 or (LGPL 2.1 and mit) ',
... ' (mit and LGPL 2.1) or GPL-2.0 ')
>>> licensing.is_equivalent(' GPL-2.0 or (LGPL-2.1 and mit) ',
... ' (mit and LGPL-2.1) or GPL-2.0 ')
True
>>> expr1.simplify() == expr2.simplify()
True
>>> expr3 = licensing.parse(' GPL-2.0 or mit or LGPL 2.1')
>>> expr3 = licensing.parse(' GPL-2.0 or mit or LGPL-2.1')
>>> licensing.is_equivalent(expr2, expr3)
False
>>> expr4 = licensing.parse('mit and LGPL 2.1')
>>> expr4 = licensing.parse('mit and LGPL-2.1')
>>> expr4.simplify() in expr2.simplify()
True
>>> licensing.contains(expr2, expr4)
Expand Down
12 changes: 5 additions & 7 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ CONF_DEFAULT="etc/conf/dev"

CFG_CMD_LINE_ARGS="$@"

if [ "$1" == "--init" ]; then
CFG_CMD_LINE_ARGS=$CONF_INIT
fi

if [ "$1" == "" ]; then
if [[ "$1" == "" ]]; then
# default for dev conf if not argument is provided
CFG_CMD_LINE_ARGS=$CONF_DEFAULT
fi

if [ "$PYTHON_EXE" == "" ]; then
CONFIGURE_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [[ "$PYTHON_EXE" == "" ]]; then
PYTHON_EXE=python
fi

$PYTHON_EXE etc/configure.py $CFG_CMD_LINE_ARGS
$PYTHON_EXE "$CONFIGURE_ROOT_DIR/etc/configure.py" $CFG_CMD_LINE_ARGS
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

setup(
name='license-expression',
version='0.98',
version='0.99',
license='apache-2.0',
description=desc,
long_description=desc,
Expand Down
Loading