Hello community, here is the log from the commit of package python-license-expression for openSUSE:Leap:15.2 checked in at 2020-04-20 12:55:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/python-license-expression (Old) and /work/SRC/openSUSE:Leap:15.2/.python-license-expression.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-license-expression" Mon Apr 20 12:55:33 2020 rev:2 rq:795540 version:1.2 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/python-license-expression/python-license-expression.changes 2020-03-27 16:48:07.943933615 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.python-license-expression.new.2738/python-license-expression.changes 2020-04-20 12:55:48.316758290 +0200 @@ -1,0 +2,9 @@ +Wed Apr 15 11:55:39 UTC 2020 - pgaj...@suse.com + +- version update to 1.2 + * Fix anomalous backslashes in strings + * Update the thirdparty directory structure. + * New version of boolean.py library + * Add ability to leave license expressions unsorted when simplifying + +------------------------------------------------------------------- Old: ---- license-expression-0.999.tar.gz New: ---- license-expression-1.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-license-expression.spec ++++++ --- /var/tmp/diff_new_pack.sPtvbK/_old 2020-04-20 12:55:48.632758786 +0200 +++ /var/tmp/diff_new_pack.sPtvbK/_new 2020-04-20 12:55:48.636758792 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-license-expression # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-license-expression -Version: 0.999 +Version: 1.2 Release: 0 Summary: Library to parse, compare, simplify and normalize license expressions License: Apache-2.0 ++++++ license-expression-0.999.tar.gz -> license-expression-1.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/.travis.yml new/license-expression-1.2/.travis.yml --- old/license-expression-0.999/.travis.yml 2019-04-29 16:19:42.000000000 +0200 +++ new/license-expression-1.2/.travis.yml 2019-11-15 01:47:43.000000000 +0100 @@ -1,51 +1,67 @@ -language: generic - -env: - matrix: - - 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 + env: + - PYTHON="3.6.8" + - TEST_SUITE="bin/py.test -vvs" language: generic python: - osx_image: xcode7.3 - env: PYTHON_EXE="`pyenv install -s 2.7.14 && pyenv local 2.7.14`" + - os: osx + env: + - PYTHON="2.7.15" + - TEST_SUITE="bin/py.test -vvs" language: generic python: - osx_image: xcode7.3 - env: PYTHON_EXE="`pyenv install -s 3.6.1 && pyenv local 3.6.1`" + - os: linux + sudo: required + env: TEST_SUITE="bin/py.test -vvs" + language: python + python: "2.7" + dist: xenial + + - os: linux + sudo: required + env: TEST_SUITE="bin/py.test -vvs" + language: python + python: "2.7" + dist: bionic + + - os: linux + sudo: required + env: TEST_SUITE="bin/py.test -vvs" + language: python + python: "3.6" + dist: xenial + + - os: linux + sudo: required + env: TEST_SUITE="bin/py.test -vvs" + language: python + python: "3.6" + dist: bionic + +addons: + homebrew: + packages: + - openssl + - readline + - sqlite3 + - xz + - zlib + - pyenv + update: true install: - - pyenv install --list - - echo $PYTHON_EXE - - python --version - ./configure -before_script: - - bin/about-code check --verbose . - script: - - "bin/py.test -vvs" + # If debugging, use a subset of tests to wait less: + # - ./bin/py.test -n 2 -vvs --cov=src tests/scancode + # - echo $TEST_SUITE + - bin/about check --verbose . + - $TEST_SUITE notifications: irc: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/PKG-INFO new/license-expression-1.2/PKG-INFO --- old/license-expression-0.999/PKG-INFO 2019-04-29 17:24:35.000000000 +0200 +++ new/license-expression-1.2/PKG-INFO 2019-11-15 01:54:19.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: license-expression -Version: 0.999 +Version: 1.2 Summary: license-expression is small utility library to parse, compare, simplify and normalize license expressions (such as SPDX license expressions) using boolean logic. Home-page: https://github.com/nexB/license-expression Author: nexB Inc. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/README.rst new/license-expression-1.2/README.rst --- old/license-expression-0.999/README.rst 2019-04-29 16:19:42.000000000 +0200 +++ new/license-expression-1.2/README.rst 2019-11-15 01:47:43.000000000 +0100 @@ -39,6 +39,7 @@ * https://github.com/nexB/license-expression.git * https://pypi.python.org/pypi/license-expression +* https://aur.archlinux.org/packages/python-license-expression/ (Arch Linux through AUR) Support ======= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/appveyor.yml new/license-expression-1.2/appveyor.yml --- old/license-expression-0.999/appveyor.yml 2018-05-03 15:46:32.000000000 +0200 +++ new/license-expression-1.2/appveyor.yml 2019-10-14 16:47:24.000000000 +0200 @@ -4,10 +4,6 @@ matrix: - PYTHON_EXE: "C:\\Python27\\python.exe" - PYTHON_EXE: "C:\\Python27-x64\\python.exe" - - PYTHON_EXE: "C:\\Python34\\python.exe" - - PYTHON_EXE: "C:\\Python34-x64\\python.exe" - - PYTHON_EXE: "C:\\Python35\\python.exe" - - PYTHON_EXE: "C:\\Python35-x64\\python.exe" - PYTHON_EXE: "C:\\Python36\\python.exe" - PYTHON_EXE: "C:\\Python36-x64\\python.exe" @@ -21,8 +17,5 @@ - 'bin\python -c "from __future__ import print_function;import sys;print(sys.getdefaultencoding())"' - 'bin\py.test -vvs' -on_success: - - "python etc/scripts/irc-notify.py aboutcode [{project_name}:{branch}] {short_commit}: \"{message}\" ({author}) {color_green}Succeeded,Details: {build_url},Commit: {commit_url}" - on_failure: - "python etc/scripts/irc-notify.py aboutcode [{project_name}:{branch}] {short_commit}: \"{message}\" ({author}) {color_red}Failed,Details: {build_url},Commit: {commit_url}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/configure new/license-expression-1.2/configure --- old/license-expression-0.999/configure 2019-04-29 16:19:42.000000000 +0200 +++ new/license-expression-1.2/configure 2019-11-15 01:47:43.000000000 +0100 @@ -6,9 +6,7 @@ # change these variables to customize this script locally ################################ # you can define one or more thirdparty dirs, each prefixed with TPP_DIR -export TPP_DIR_BASE="thirdparty/base" -export TPP_DIR_DEV="thirdparty/dev" -export TPP_DIR_PROD="thirdparty/prod" +export TPP_DIR_BASE="thirdparty" # default configurations for dev CONF_DEFAULT="etc/conf/dev" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/configure.bat new/license-expression-1.2/configure.bat --- old/license-expression-0.999/configure.bat 2016-12-21 13:18:55.000000000 +0100 +++ new/license-expression-1.2/configure.bat 2019-11-15 01:47:43.000000000 +0100 @@ -1,54 +1,54 @@ -@echo OFF - -@rem Copyright (c) 2016 nexB Inc. http://www.nexb.com/ - All rights reserved. - -@rem ################################ -@rem # change these variables to customize this script locally -@rem ################################ -@rem # you can define one or more thirdparty dirs, each prefixed with TPP_DIR -set TPP_DIR_BASE=thirdparty/base -set TPP_DIR_DEV=thirdparty/dev -set TPP_DIR_PROD=thirdparty/prod - -set DEFAULT_PYTHON=python - -@rem # default configurations -set CONF_DEFAULT="etc/conf/dev" -@rem ################################# - -set DJ_ROOT_DIR=%~dp0 - -set CFG_CMD_LINE_ARGS= -@rem Collect/Slurp all command line arguments in a variable -:collectarg - if ""%1""=="""" ( - goto continue - ) - call set CFG_CMD_LINE_ARGS=%CFG_CMD_LINE_ARGS% %1 - shift - goto collectarg - -:continue - -@rem default to dev configuration when no args are passed -if "%CFG_CMD_LINE_ARGS%"==" " ( - set CFG_CMD_LINE_ARGS="%CONF_DEFAULT%" - goto configure -) - -if "%CFG_CMD_LINE_ARGS%"==" --init" ( - set CFG_CMD_LINE_ARGS="%CONF_INIT%" - goto configure -) - -if "%PYTHON_EXE%"==" " ( - set PYTHON_EXE="%DEFAULT_PYTHON%" - goto configure -) - - -:configure -call "%PYTHON_EXE%" etc/configure.py %CFG_CMD_LINE_ARGS% -goto EOS - -:EOS \ No newline at end of file +@echo OFF +setlocal +@rem Copyright (c) nexB Inc. http://www.nexb.com/ - All rights reserved. + +@rem ################################ +@rem # Defaults. change these variables to customize this script locally +@rem ################################ +@rem # you can define one or more thirdparty dirs, each prefixed with TPP_DIR +set TPP_DIR=thirdparty + +set DEFAULT_PYTHON=python + +@rem # default configurations for dev +set CONF_DEFAULT="etc/conf/dev" +@rem ################################# + +set CFG_ROOT_DIR=%~dp0 + +@rem Collect all command line arguments in a variable +set CFG_CMD_LINE_ARGS= + +@rem a possible alternative way and simpler way to slurp args +@rem set CFG_CMD_LINE_ARGS=%* + + +:collectarg + if ""%1""=="""" goto continue + call set CFG_CMD_LINE_ARGS=%CFG_CMD_LINE_ARGS% %1 + shift + goto collectarg + +:continue + +@rem Set defaults when no args are passed +if "%CFG_CMD_LINE_ARGS%"=="" set CFG_CMD_LINE_ARGS="%CONF_DEFAULT%" +if "%PYTHON_EXE%"=="" set PYTHON_EXE=%DEFAULT_PYTHON% + + +call "%PYTHON_EXE%" "%CFG_ROOT_DIR%etc\configure.py" %CFG_CMD_LINE_ARGS% +@rem Return a proper return code on failure + +if %errorlevel% neq 0 ( + exit /b %errorlevel% +) + + +@rem Activate the virtualenv +endlocal +if exist "%CFG_ROOT_DIR%bin\activate" ( + "%CFG_ROOT_DIR%bin\activate" +) +goto EOS + +:EOS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/etc/ci/azure-container-deb.yml new/license-expression-1.2/etc/ci/azure-container-deb.yml --- old/license-expression-0.999/etc/ci/azure-container-deb.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/license-expression-1.2/etc/ci/azure-container-deb.yml 2019-10-14 16:47:24.000000000 +0200 @@ -0,0 +1,40 @@ +parameters: + name: '' + container: '' + python_path: '' + package_manager: apt-get + install_python: '' + install_packages: | + set -e -x + sudo apt-get -y update + sudo apt-get -y install \ + build-essential \ + xz-utils zlib1g bzip2 libbz2-1.0 tar \ + sqlite3 libxml2-dev libxslt1-dev \ + software-properties-common openssl + +jobs: +- job: ${{ parameters.name }} + + pool: + vmImage: 'ubuntu-16.04' + + container: + image: ${{ parameters.container }} + options: '--name ${{ parameters.name }} -v /usr/bin/docker:/tmp/docker:ro' + + steps: + - script: /tmp/docker exec -t -u 0 ${{ parameters.name }} $(Build.SourcesDirectory)/etc/ci/install_sudo.sh ${{ parameters.package_manager }} + displayName: Install sudo + + - script: ${{ parameters.install_packages }} + displayName: Install required packages + + - script: ${{ parameters.install_python }} + displayName: Install Python + + - script: PYTHON_EXE=${{ parameters.python_path }} ./configure + displayName: 'Configure' + + - script: bin/py.test -vvs + displayName: 'Run tests' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/etc/ci/azure-container-rpm.yml new/license-expression-1.2/etc/ci/azure-container-rpm.yml --- old/license-expression-0.999/etc/ci/azure-container-rpm.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/license-expression-1.2/etc/ci/azure-container-rpm.yml 2019-10-14 16:47:24.000000000 +0200 @@ -0,0 +1,40 @@ +parameters: + name: '' + container: '' + python_path: '' + package_manager: yum + install_python: '' + install_packages: | + set -e -x + sudo yum groupinstall -y "Development Tools" + sudo yum install -y \ + openssl openssl-devel \ + sqlite-devel zlib-devel xz-devel bzip2-devel \ + bzip2 tar unzip zip \ + libxml2-devel libxslt-devel + +jobs: +- job: ${{ parameters.name }} + + pool: + vmImage: 'ubuntu-16.04' + + container: + image: ${{ parameters.container }} + options: '--name ${{ parameters.name }} -v /usr/bin/docker:/tmp/docker:ro' + + steps: + - script: /tmp/docker exec -t -u 0 ${{ parameters.name }} $(Build.SourcesDirectory)/etc/ci/install_sudo.sh ${{ parameters.package_manager }} + displayName: Install sudo + + - script: ${{ parameters.install_packages }} + displayName: Install required packages + + - script: ${{ parameters.install_python }} + displayName: Install Python + + - script: PYTHON_EXE=${{ parameters.python_path }} ./configure + displayName: 'Configure' + + - script: bin/py.test -vvs + displayName: 'Run tests' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/etc/ci/azure-posix.yml new/license-expression-1.2/etc/ci/azure-posix.yml --- old/license-expression-0.999/etc/ci/azure-posix.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/license-expression-1.2/etc/ci/azure-posix.yml 2019-11-15 01:47:43.000000000 +0100 @@ -0,0 +1,28 @@ +parameters: + name: '' + image_name: '' + matrix: [] + +jobs: +- job: ${{ parameters.name }} + + pool: + vmImage: ${{ parameters.image_name }} + + strategy: + matrix: + ${{ insert }}: ${{ parameters.matrix }} + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(python_version)' + + - script: ./configure + displayName: 'Configure' + + - script: bin/about check --verbose . + displayName: 'Check ABOUT files' + + - script: bin/py.test -vvs + displayName: 'Run tests' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/etc/ci/azure-win.yml new/license-expression-1.2/etc/ci/azure-win.yml --- old/license-expression-0.999/etc/ci/azure-win.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/license-expression-1.2/etc/ci/azure-win.yml 2019-11-15 01:47:43.000000000 +0100 @@ -0,0 +1,29 @@ +parameters: + name: '' + image_name: '' + matrix: [] + +jobs: +- job: ${{ parameters.name }} + + pool: + vmImage: ${{ parameters.image_name }} + + strategy: + matrix: + ${{ insert }}: ${{ parameters.matrix }} + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(python_version)' + architecture: '$(python_architecture)' + + - script: configure + displayName: 'Configure' + + - script: bin\about check --verbose . + displayName: 'Check ABOUT files' + + - script: bin\py.test -vvs + displayName: 'Run tests' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/etc/ci/install_sudo.sh new/license-expression-1.2/etc/ci/install_sudo.sh --- old/license-expression-0.999/etc/ci/install_sudo.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/license-expression-1.2/etc/ci/install_sudo.sh 2019-10-14 16:47:24.000000000 +0200 @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + + +if [[ "$1" == "apt-get" ]]; then + apt-get update -y + apt-get -o DPkg::Options::="--force-confold" install -y sudo + +elif [[ "$1" == "yum" ]]; then + yum install -y sudo + +elif [[ "$1" == "dnf" ]]; then + dnf install -y sudo + +fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/setup.cfg new/license-expression-1.2/setup.cfg --- old/license-expression-0.999/setup.cfg 2019-04-29 17:24:35.000000000 +0200 +++ new/license-expression-1.2/setup.cfg 2019-11-15 01:54:19.000000000 +0100 @@ -22,6 +22,7 @@ include Lib lib + lib64 Scripts thirdparty tmp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/setup.py new/license-expression-1.2/setup.py --- old/license-expression-0.999/setup.py 2019-04-29 17:22:24.000000000 +0200 +++ new/license-expression-1.2/setup.py 2019-11-15 01:47:43.000000000 +0100 @@ -17,7 +17,7 @@ setup( name='license-expression', - version='0.999', + version='1.2', license='apache-2.0', description=desc, long_description=desc, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/src/license_expression/__init__.py new/license-expression-1.2/src/license_expression/__init__.py --- old/license-expression-0.999/src/license_expression/__init__.py 2019-04-29 17:22:24.000000000 +0200 +++ new/license-expression-1.2/src/license_expression/__init__.py 2019-11-15 01:47:43.000000000 +0100 @@ -103,6 +103,10 @@ pass +class ExpressionParseError(ParseError, ExpressionError): + pass + + # Used for tokenizing Keyword = namedtuple('Keyword', 'value type') Keyword.__len__ = lambda self: len(self.value) @@ -124,7 +128,7 @@ # mapping of lowercase operator strings to an operator object OPERATORS = {'and': KW_AND, 'or': KW_OR, 'with': KW_WITH} -_simple_tokenizer = re.compile(''' +_simple_tokenizer = re.compile(r''' (?P<symop>[^\s\(\)]+) | (?P<space>\s+) @@ -380,7 +384,7 @@ """ Return a new license LicenseExpression object by parsing a license `expression` string. Check that the expression syntax is valid and raise - an Exception, an ExpressionError or a ParseError on errors. + an ExpressionError or an ExpressionParseError on errors. Return None for empty expressions. `expression` is either a string or a LicenseExpression object. If this is a LicenseExpression it is returned as-is. @@ -433,9 +437,11 @@ # this will raise a ParseError on errors tokens = list(self.tokenize(expression, strict=strict, simple=simple)) expression = super(Licensing, self).parse(tokens) - except TypeError as e: - msg = 'Invalid expression syntax: ' + repr(e) - raise ExpressionError(msg) + except ParseError as e: + new_error = ExpressionParseError( + token_type=e.token_type, token_string=e.token_string, + position=e.position, error_code=e.error_code) + raise new_error if not isinstance(expression, LicenseExpression): raise ExpressionError('expression must be a LicenseExpression once parsed.') @@ -821,6 +827,19 @@ """ return NotImplementedError + def render_as_readable(self, template='{symbol.key}', *args, **kwargs): + """ + Return a formatted string rendering for this expression using the + `template` format string to render each symbol. Add extra parenthesis + around WITH sub-expressions for improved readbility. See `render()` for + other arguments. + """ + if isinstance(self, LicenseWithExceptionSymbol): + return self.render( + template=template, wrap_with_in_parens=False, *args, **kwargs) + else: + return self.render(template=template, wrap_with_in_parens=True, *args, **kwargs) + class BaseSymbol(Renderable, boolean.Symbol): """ @@ -1069,10 +1088,19 @@ yield self.license_symbol yield self.exception_symbol - def render(self, template='{symbol.key}', *args, **kwargs): + def render(self, template='{symbol.key}', wrap_with_in_parens=False, *args, **kwargs): + """ + Return a formatted WITH expression. If `wrap_with_in_parens`, wrap in + parens a WITH expression, unless it is alone and not used with other AND + or OR sub-expressions. + """ lic = self.license_symbol.render(template, *args, **kwargs) exc = self.exception_symbol.render(template, *args, **kwargs) - return '%(lic)s WITH %(exc)s' % locals() + if wrap_with_in_parens: + temp = '(%(lic)s WITH %(exc)s)' + else: + temp = '%(lic)s WITH %(exc)s' + return temp % locals() def __hash__(self, *args, **kwargs): return hash((self.license_symbol, self.exception_symbol,)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/src/license_expression/_pyahocorasick.py new/license-expression-1.2/src/license_expression/_pyahocorasick.py --- old/license-expression-0.999/src/license_expression/_pyahocorasick.py 2019-04-29 16:19:42.000000000 +0200 +++ new/license-expression-1.2/src/license_expression/_pyahocorasick.py 2019-11-15 01:47:43.000000000 +0100 @@ -608,7 +608,7 @@ # tokenize to separate text from parens -_tokenizer = re.compile(''' +_tokenizer = re.compile(r''' (?P<text>[^\s\(\)]+) | (?P<space>\s+) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/src/license_expression.egg-info/SOURCES.txt new/license-expression-1.2/src/license_expression.egg-info/SOURCES.txt --- old/license-expression-0.999/src/license_expression.egg-info/SOURCES.txt 2019-04-29 17:24:35.000000000 +0200 +++ new/license-expression-1.2/src/license_expression.egg-info/SOURCES.txt 2019-11-15 01:54:19.000000000 +0100 @@ -10,6 +10,11 @@ setup.cfg setup.py etc/configure.py +etc/ci/azure-container-deb.yml +etc/ci/azure-container-rpm.yml +etc/ci/azure-posix.yml +etc/ci/azure-win.yml +etc/ci/install_sudo.sh etc/conf/base.txt etc/conf/win.txt etc/conf/dev/base.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/license-expression-0.999/tests/test_license_expression.py new/license-expression-1.2/tests/test_license_expression.py --- old/license-expression-0.999/tests/test_license_expression.py 2019-04-29 17:22:24.000000000 +0200 +++ new/license-expression-1.2/tests/test_license_expression.py 2019-11-15 01:47:43.000000000 +0100 @@ -552,6 +552,16 @@ expr3 = licensing.parse('mit and LGPL2.1') self.assertTrue(expr3 in expr2) + def test_parse_simplify_no_sort(self): + licensing = Licensing() + expr = licensing.parse('gpl-2.0 OR apache-2.0') + expr2 = licensing.parse('apache-2.0 OR gpl-2.0') + + self.assertEqual(expr, expr2) + self.assertEqual(expr.simplify(), expr2.simplify()) + self.assertEqual(expr.simplify(sort=False), expr2.simplify()) + self.assertNotEqual(expr.simplify(sort=False).pretty(), expr2.pretty()) + def test_license_expression_is_equivalent(self): lic = Licensing() is_equiv = lic.is_equivalent @@ -1655,6 +1665,30 @@ assert expected == licensing.primary_license_symbol( parsed, decompose=False).render('{symbol.key}') + def test_render_plain(self): + l = Licensing() + result = l.parse('gpl-2.0 WITH exception-gpl-2.0-plus or MIT').render() + expected = 'gpl-2.0 WITH exception-gpl-2.0-plus OR MIT' + assert expected == result + + def test_render_as_readable_does_not_wrap_in_parens_single_with(self): + l = Licensing() + result = l.parse('gpl-2.0 WITH exception-gpl-2.0-plus').render_as_readable() + expected = 'gpl-2.0 WITH exception-gpl-2.0-plus' + assert expected == result + + def test_render_as_readable_wraps_in_parens_with_and_other_subexpressions(self): + l = Licensing() + result = l.parse('mit AND gpl-2.0 WITH exception-gpl-2.0-plus').render_as_readable() + expected = 'mit AND (gpl-2.0 WITH exception-gpl-2.0-plus)' + assert expected == result + + def test_render_as_readable_does_not_wrap_in_parens_if_no_with(self): + l = Licensing() + result1 = l.parse('gpl-2.0 and exception OR that').render_as_readable() + result2 = l.parse('gpl-2.0 and exception OR that').render() + assert result1 == result2 + class SplitAndTokenizeTest(TestCase):