pigpio icon indicating copy to clipboard operation
pigpio copied to clipboard

Python distutils module is being discontinued

Open chrisl8 opened this issue 2 years ago • 1 comments

According to https://peps.python.org/pep-0632/, and text output when running make install, the use of distutils is deprecated and distutils will soon be removed from Python.

distutils is used in setup.py

https://github.com/joan2937/pigpio/blob/c33738a320a3e28824af7807edafda440952c05d/setup.py#L3

Once distutils is gone make install will nolonger work as the Makefile calls setup.py https://github.com/joan2937/pigpio/blob/c33738a320a3e28824af7807edafda440952c05d/Makefile#L107

Further digging:

Oddly, it looks like their recommendation is to use setuptools, which was how setup.py was written in 2016, and then it was changed. Perhaps, at the time, distutls was part of the standard Python install and setuptools was not? See discussion here: https://github.com/joan2937/pigpio/pull/103 and commit here: https://github.com/joan2937/pigpio/commit/a939b8b0e6f07a40246b49d5961f3ba697ea1153#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7

As it stands today, to run make install on any recent Raspberry Pi install, you will first have to run sudo apt install python3-distutils so distutils isn't standard anymore, if it ever was.

I'm not sure if reverting setup.py to the old version would be an "easy fix" or if that would just bring up other issues as that code might also might not be "up to date."

I can do some tests on my end, but if @bennuttall is still working in the Pi GPIO space, I'd like to hear their input too.

chrisl8 avatar Sep 14 '22 14:09 chrisl8

Yep, would recommend moving to setup.py or better, setup.cfg like so: https://github.com/piwheels/hostedpi/blob/main/setup.cfg

bennuttall avatar Sep 14 '22 16:09 bennuttall