Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate distutils #23

Closed
wants to merge 10 commits into from
Closed

Deprecate distutils #23

wants to merge 10 commits into from

Conversation

stephankramer
Copy link
Contributor

This is firstly to fix the failure to build Debian packages with newer versions of python. I believe this is to do with some of the vagueries of "python setup.py install" not really being recommended/supported anymore. Instead we now pybuild to do the installing during the Debian package build which uses Debian's patched version of distutils/setuptools to circumvent this.

In the process upgrade the setup.py scripts to use setuptools instead of distutils (which is even more deprecated) using the changes in FluidityProject/fluidity#351 by @Patol75

In addition rewrite and simplify debian/rules to make use of debhelper for as much as possible

Summary is that distutils has been deprecated for a while and will be
removed in 3.12. setuptools is its replacement. However its use as an
installation mechanism, e.g. *calling* setup.py install with CLI
arguments is also being deprecated - with no good alternative (yet)
being available. Since the whole world still depends on it I don't
expect the latter to go away any time soon though, but it does seem to
no longer care about fixing things for that frontend
which is what now cause prefix arguments to not work as expected
(installing things in /usr/local/ whilst specifying --prefix=/usr),
which breaks the building of Debian packages. What Debian/Ubuntu seem
to have done is patch setuptools to make it keep on behaving as they want,
but only if you provide --install-layout=deb. So now providing that
argument for all calls of "python setup.py install" in the Debian build.

This would have also worked in combination with distutils, but taking
this opportunity to upgrade to setuptools (since we'll have to soon
anyway). These are changes by @Patol75, taken from
FluidityProject/fluidity#351.
To avoid having to deal with the setup.py install vagueries when installing python for Debian packaging, let pybuild take care of the building and installing of python. Rewrite debian/rules to make use of debhelper for as much as possible and minimize hackery. Also remove Debian-packaging-specific hacks in Makefile.in

The recipe we are now following is to install everything in debian/tmp (instead of straight into the debian/<package>/ directories), and divide the resulting files up over the packages using debian/<package.install> files. Try to clean up some Lintin errors and warnings in the process.
@stephankramer stephankramer force-pushed the deprecate-distutils branch 2 times, most recently from 5df64df to 50b759a Compare October 31, 2022 13:59
Add python3-pip as build dependency
@stephankramer
Copy link
Contributor Author

Closing now because apparently doing things the proper way is broken due to pypa/pip#10978 i.e. prefix installs are broken. It appears only using distutils (instead of setuptools) and "python setup.py install" (instead of pip install) still works - although these are both now deprecated - any other combination of these two fails. This leaves only the rewritten debian/rules and extended testing which I'll PR separately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant