cgohlke / imagecodecs

Image transformation, compression, and decompression codecs
https://pypi.org/project/imagecodecs
BSD 3-Clause "New" or "Revised" License
111 stars 21 forks source link

Checking for distributions (Arch in this case) should be done in a more reliable way #92

Closed WildPenquin closed 6 months ago

WildPenquin commented 6 months ago

Hi!

In setup.py, on line 249:

if 'arch' not in platform.platform():

This does not work on many Arch installations. The kernel version reported by platform.platform() is really independent of the distribution.

On my system:

>>> platform.platform()
'Linux-6.6.9-zen1-1-zen-x86_64-with-glibc2.38'

Also see discussion in AUR.

Cheers!

WildPenquin commented 6 months ago

I suggest using platform.freedesktop_os_release(). I haven't red the freedesktop standard (just found it), but something like: platform.freedesktop_os_release()['ID'] != 'arch' could work.

See:

EDIT: Of course this test should be only done to test for the distribution(s), and would be an improvement. But that is not enough to determine which libraries are available, as that might change at any time.

cgohlke commented 6 months ago

The project provides pre-compiled wheels for manylinux_aarch64 on PyPI. AArch64 binaries are also available on conda-forge. If you must build imagecodecs form source and the default configuration does not work, provide a customize_build function in an importable imagecodecs_distributor_setup module. That allows to define which extensions are built and to modify library names, include paths, compiler options, etc.