diff --git a/configure b/configure index ac5ed590991..f4f1c14c2c0 100755 --- a/configure +++ b/configure @@ -118,7 +118,7 @@ CFG_ROOT_DIR="$( cd "$( dirname "${CFG_BIN}" )" && pwd )" CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin -# force relaunching under X86-64 architecture on macOS M1/ARM +# force relaunching under X86-64 architecture on macOS M1/ARM if [[ $OSTYPE == 'darwin'* && $(uname -m) == 'arm64' && $(sysctl -in sysctl.proc_translated) == 0 ]]; then arch -x86_64 /bin/bash -c "$CFG_ROOT_DIR/configure $*" exit $? @@ -253,7 +253,6 @@ install_packages() { # be reinstalled a second time and reused from the virtualenv and this # speeds up the installation. # We always have the PEP517 build dependencies installed already. - "$CFG_BIN_DIR/pip" install \ --upgrade \ --no-build-isolation \ diff --git a/pyproject.toml b/pyproject.toml index 8af0e040a8b..e2656e8f647 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ include = [ "." ] -# ignore test data and testfiles: they should never be linted nor formatted +# ignore test data and testfiles: they should never be linted nor formatted exclude = [ # main style "**/tests/data/**/*", diff --git a/setup.cfg b/setup.cfg index b0954ef901b..325fca3b833 100644 --- a/setup.cfg +++ b/setup.cfg @@ -117,6 +117,7 @@ install_requires = typecode >= 30.0.1 typecode[full] >= 30.0.1 extractcode[full] >= 31.0.0 + cyseq; platform_system == 'Linux' [options.packages.find] diff --git a/src/licensedcode/index.py b/src/licensedcode/index.py index 69a76da6130..a791024c13e 100644 --- a/src/licensedcode/index.py +++ b/src/licensedcode/index.py @@ -28,13 +28,19 @@ from licensedcode import match_spdx_lid from licensedcode import match_unknown from licensedcode.dmp import match_blocks as match_blocks_dmp -from licensedcode.seq import match_blocks as match_blocks_seq from licensedcode import query from licensedcode import tokenize from licensedcode.spans import Span from typing import NamedTuple from typing import Callable +try: + # Use Cython seq.py implementation + from cyseq import match_blocks as match_blocks_seq +except ImportError: + # Use Python seq.py if it is not available + from licensedcode.seq import match_blocks as match_blocks_seq + """ Main license index construction, query processing and matching entry points for license detection. diff --git a/src/licensedcode/match_seq.py b/src/licensedcode/match_seq.py index 6e297398021..c3904550098 100644 --- a/src/licensedcode/match_seq.py +++ b/src/licensedcode/match_seq.py @@ -63,7 +63,12 @@ def match_sequence( return [] if not match_blocks: - from licensedcode.seq import match_blocks + try: + # Use Cython seq.py implementation + from cyseq import match_blocks + except ImportError: + # Use Python seq.py if it is not available + from licensedcode.seq import match_blocks rid = rule.rid itokens = idx.tids_by_rid[rid]