ofalk / libdnet

libdnet provides a simplified, portable interface to several low-level networking routines.
Other
153 stars 60 forks source link

libdnet fails to build with Python 3.12: ModuleNotFoundError: No module named 'distutils' #76

Closed rwmjones closed 1 year ago

rwmjones commented 1 year ago

This bug was filed downstream: https://bugzilla.redhat.com/show_bug.cgi?id=2154944

Unfortunately I'm waiting on build logs. However the apparent cause is that libdnet uses a Python module called distutils which will be completely removed in Python 3.12, so it seems like it's a real problem that will affect libdnet in future.

rwmjones commented 1 year ago
+ /usr/bin/python3 setup.py install --skip-build --root /builddir/build/BUILDROOT/libdnet-1.14-7.fc38.x86_64
Traceback (most recent call last):
  File "/builddir/build/BUILD/libdnet-libdnet-1.14/python/setup.py", line 4, in <module>
    from distutils.core import setup, Extension
ModuleNotFoundError: No module named 'distutils'
ofalk commented 1 year ago

Thanks for reporting this issue @rwmjones - I guess it's time to switch to setuptools. If you are fluent in porting from Distutils, I'm happy to accept a PR, but I'll also look into it.

ofalk commented 1 year ago

Well, it looks straight forward... I guess that needs some tests...

diff --git a/python/setup.py.in b/python/setup.py.in
index 7da2812..2596bdd 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -1,7 +1,7 @@
 #!/usr/bin/env python

 import glob, os, sys
-from distutils.core import setup, Extension
+from setuptools import setup, Extension
 from Cython.Build import cythonize

 dnet_srcs = [ '@srcdir@/dnet.pyx' ]
ofalk commented 1 year ago

@rwmjones OK. I anyway planned to update the toolchain and now got rid of distutils (WorksForMe(tm) See latest push to devel. Commit e0374b52421ef291b14fc12bdfa2d3bf65fec3be