renpy
renpy copied to clipboard
Switch to using setuptools (with fallback to distutils.core) instead of distutils
Ren'Py should switch to using setuptools for setup style building over the older distutils.
Since the build instructions recommend using virtualenv and virtualenv effectively depends on setuptools this means most users will be able to use the newer setuptools. Switching to setuptools while still having the distutils.core as a fallback seems to be the best solution.
For reference, I notice has already been implemented in pygame_sdl2:
- 2014-10-22 renpy/pygame_sdl2@4d765d43bb010da6806793b937366272b00e0582 distutils first use
- 2015-12-13 renpy/pygame_sdl2@4d7e6b3b8cc003e855b9bf2aea4c35ce52cb1265 switch to setuptools
- 2015-12-16 renpy/pygame_sdl2@8b1b075d61b97cf20fec79bb3e428c533010dcc7 return to distutils.core as a fallback when importing setuptools fails
What benefits does this give? I routinely build Ren'Py in a virtualenv, so I'm not sure what I'd be gaining from the change.
Building in a virtualenv does not cause setuptools to be used for building. It does mean that setuptools is usually available (because by default virtualenv installs setuptools in new virtual environments meaning if the code is changed, the fallback should rarely be used).
I am sure there are topics elsewhere with better coverage of the advantages of moving to setuptools over the Python included distutils, however, some things might be better metadata (with egg and wheel) and more (and updated) setup commands, (e.g., improved build_clib with timestamp-based dependency system).
As a side note, instead of catching all exceptions (as was done renpy/pygame_sdl2@8b1b075d61b97cf20fec79bb3e428c533010dcc7) just catch ImportError like:
except ImportError:
The distutils module is deprecated, and scheduled to be removed in Python 3.12 (so in november 2023 if all goes well).
This has been taken care of a while back.