Skip to content

Commit

Permalink
Assume latest version with Windows header and zlib patch is available
Browse files Browse the repository at this point in the history
  • Loading branch information
rhpvorderman committed Jan 24, 2024
1 parent 40267e1 commit dde3819
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 29 deletions.
11 changes: 3 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,11 @@
DEFAULT_CACHE_FILE))

EXTENSIONS = [
Extension("isal.isal_zlib", ["src/isal/isal_zlibmodule.c"]),
Extension("isal.igzip_lib", ["src/isal/igzip_libmodule.c"]),
Extension("isal.isal_zlib", ["src/isal/isal_zlibmodule.c"]),
Extension("isal.igzip_lib", ["src/isal/igzip_libmodule.c"]),
Extension("isal._isal", ["src/isal/_isalmodule.c"]),
]

# This does not add the extension on windows for dynamic linking. The required
# header file might be missing.
if not (SYSTEM_IS_WINDOWS and
os.getenv("PYTHON_ISAL_LINK_DYNAMIC") is not None):
EXTENSIONS.append(Extension("isal._isal", ["src/isal/_isalmodule.c"]))


class BuildIsalExt(build_ext):
def build_extension(self, ext):
Expand Down
15 changes: 2 additions & 13 deletions src/isal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,8 @@
# This file is part of python-isal which is distributed under the
# PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2.

from typing import Optional

try:
from . import _isal
ISAL_MAJOR_VERSION: Optional[int] = _isal.ISAL_MAJOR_VERSION
ISAL_MINOR_VERSION: Optional[int] = _isal.ISAL_MINOR_VERSION
ISAL_PATCH_VERSION: Optional[int] = _isal.ISAL_PATCH_VERSION
ISAL_VERSION: Optional[str] = _isal.ISAL_VERSION
except ImportError:
ISAL_MAJOR_VERSION = None
ISAL_MINOR_VERSION = None
ISAL_PATCH_VERSION = None
ISAL_VERSION = None
from ._isal import (ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION,
ISAL_VERSION)

__all__ = [
"ISAL_MAJOR_VERSION",
Expand Down
4 changes: 0 additions & 4 deletions tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
# Wbits for ZLIB compression, GZIP compression, and RAW compressed streams
WBITS_RANGE = list(range(9, 16)) + list(range(25, 32)) + list(range(-15, -8))

DYNAMICALLY_LINKED = os.getenv("PYTHON_ISAL_LINK_DYNAMIC") is not None


@pytest.mark.parametrize(["data_size", "value"],
itertools.product(DATA_SIZES, SEEDS))
Expand Down Expand Up @@ -93,8 +91,6 @@ def test_decompress_isal_zlib(data_size, level):
@pytest.mark.parametrize(["data_size", "level", "wbits", "memLevel"],
itertools.product([128 * 1024], range(4),
WBITS_RANGE, range(1, 10)))
@pytest.mark.xfail(condition=DYNAMICALLY_LINKED,
reason="Dynamically linked version may not have patch.")
def test_compress_compressobj(data_size, level, wbits, memLevel):
data = DATA[:data_size]
compressobj = isal_zlib.compressobj(level=level,
Expand Down
4 changes: 0 additions & 4 deletions tests/test_zlib_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@


class VersionTestCase(unittest.TestCase):

@unittest.skipIf(os.getenv("PYTHON_ISAL_LINK_DYNAMIC") is not None and
sys.platform.startswith("win"),
"Header file missing on windows")
def test_library_version(self):
# Test that the major version of the actual library in use matches the
# major version that we were compiled against. We can't guarantee that
Expand Down

0 comments on commit dde3819

Please sign in to comment.