Skip to content

Commit dfd24d5

Browse files
authored
Merge pull request #104 from pycompression/windowsheader
Include isa-l.h on windows as well
2 parents 3234f28 + a5b0593 commit dfd24d5

File tree

4 files changed

+13
-21
lines changed

4 files changed

+13
-21
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Changelog
99
1010
version 1.0.0-dev
1111
------------------
12+
+ ISA-L library version variables are now available on windows as well.
1213
+ Wheels are now always build with nasm for the x86 architecture. Previously
1314
yasm was used for Linux and MacOS due to build issues that have since been
1415
fixed upstream.

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ def cythonize_modules():
5555
modules = [Extension("isal.isal_zlib", ["src/isal/isal_zlib.pyx"],
5656
**extension_args),
5757
Extension("isal.igzip_lib", ["src/isal/igzip_lib.pyx"],
58+
**extension_args),
59+
Extension("isal._isal", ["src/isal/_isal.pyx"],
5860
**extension_args)]
59-
if SYSTEM_IS_UNIX:
60-
modules.append(Extension("isal._isal", ["src/isal/_isal.pyx"],
61-
**extension_args))
6261
return cythonize(modules, compiler_directives=compiler_directives)
6362

6463

@@ -167,6 +166,8 @@ def build_isa_l(compiler_command: str, compiler_options: str):
167166
Path(temp_prefix, "include", "isa-l"))
168167
shutil.copy(os.path.join(build_dir, "isa-l_static.lib"),
169168
os.path.join(temp_prefix, "isa-l_static.lib"))
169+
shutil.copy(os.path.join(build_dir, "isa-l.h"),
170+
os.path.join(temp_prefix, "include", "isa-l.h"))
170171
else:
171172
raise NotImplementedError(f"Unsupported platform: {sys.platform}")
172173
shutil.rmtree(build_dir)

src/isal/__init__.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,14 @@
1717
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
# SOFTWARE.
20-
from typing import Optional
2120

22-
try:
23-
from . import _isal
24-
ISAL_MAJOR_VERSION: Optional[int] = _isal.ISAL_MAJOR_VERSION
25-
ISAL_MINOR_VERSION: Optional[int] = _isal.ISAL_MINOR_VERSION
26-
ISAL_PATCH_VERSION: Optional[int] = _isal.ISAL_PATCH_VERSION
27-
ISAL_VERSION: Optional[str] = _isal.ISAL_VERSION
28-
except ImportError: # isa-l.h not available on windows
29-
ISAL_MAJOR_VERSION = None
30-
ISAL_MINOR_VERSION = None
31-
ISAL_PATCH_VERSION = None
32-
ISAL_VERSION = None
21+
from . import _isal
22+
23+
ISAL_MAJOR_VERSION: int = _isal.ISAL_MAJOR_VERSION
24+
ISAL_MINOR_VERSION: int = _isal.ISAL_MINOR_VERSION
25+
ISAL_PATCH_VERSION: int = _isal.ISAL_PATCH_VERSION
26+
ISAL_VERSION: str = _isal.ISAL_VERSION
27+
3328

3429
__all__ = [
3530
"ISAL_MAJOR_VERSION",

tests/test_zlib_compliance.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@ def test_library_version(self):
4343
# the minor versions will match (even on the machine on which the
4444
# module was compiled), and the API is stable between minor versions,
4545
# so testing only the major versions avoids spurious failures.
46-
# TODO: Ask for isal current version upstream
47-
if sys.platform.startswith("win"):
48-
# No isa-l.h on windows, so no version information there.
49-
self.assertEqual(isal.ISAL_MAJOR_VERSION, None)
50-
else:
51-
self.assertEqual(isal.ISAL_MAJOR_VERSION, 2)
46+
self.assertEqual(isal.ISAL_MAJOR_VERSION, 2)
5247

5348

5449
class ChecksumTestCase(unittest.TestCase):

0 commit comments

Comments
 (0)