hsnr-gamera / gamera-4

Gamera 4 for Python 3
GNU General Public License v2.0
10 stars 8 forks source link

Deprecation of distutils #51

Closed FriedrichFroebel closed 1 year ago

FriedrichFroebel commented 2 years ago

When building the package with some recent Python version (3.10.5 in my case), there are warnings about distutils being used, but deprecated:

$ python setup.py --nowx build
/home/runner/work/didjvu/didjvu/deps/gamera-4-4.0.0/setup.py:27: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.ccompiler import CCompiler
Gamera version: 4.0.0
Compiling genetic algorithms with parallelization (OpenMP)
generating wrappers for string_io plugin
[...]
cdalitz commented 2 years ago

Thanks for the info. Hopefully, there is a simple replacement or workaround: a port to a completely different build system would presumably be too expensive. Any suggestions are appreciated.

FriedrichFroebel commented 2 years ago

Unfortunately, the migration docs are a bit sparse and I am not familiar enough with building C/C++ code. There is some guidance at https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html, but for the CCompiler part, there is still some discussion in https://github.com/pypa/setuptools/issues/2806.

The corresponding imports have been introduced in https://github.com/hsnr-gamera/gamera-4/commit/904faa99252927fe19b79ae87f0a9d6788d77d1c by @Cyperghost as part of multithread building support - maybe he can tell more about why monkey-patching CCompiler.compile is required, which is not really clear to me without deeper insights.

cdalitz commented 2 years ago

As we do not have funding for Gamera, we must always consider whether just porting without any benefit, but just for the sake of keeping pace with the moving target Python is worth the time and money. There is also the pending deprecation of the old buffer protocol. Maybe it's time to pull the plug. We will briefly estimate the effort and then decide whether we will reallocate the ressources to other projects.

cdalitz commented 2 years ago

Cyberghost will have a closer look into this issue and hopefully work on the port to setuptool.

cdalitz commented 1 year ago

The build process has been ported to setuptools with the latest commit.