Message ID | 20250211202432.20356-1-tahbertschinger@gmail.com (mailing list archive) |
---|---|
State | Handled Elsewhere, archived |
Headers | show |
Series | [pynfs] build: convert from deprecated distutils to setuptools | expand |
From: Thomas Bertschinger <tahbertschinger@gmail.com> > According to PEP 632 [1], distutils is obsolete and removed after Python > v3.12. Setuptools is the replacement. > There is a migration guide at [2] that suggests the following > replacements: > {distutils.core => setuptools}.setup > {distutils => setuptools}.command > distutils.dep_util => setuptools.modified > Prior to setuptools v69.0.0 [3], `newer_group` was exposed through > the now-deprecated `setuptools.dep_util` instead of > `setuptools.modified`. > Rather than updating distutils.core.Extension, I remove it as it does > not appear to be used. Hi Thomas, Thanks! Reviewed-by: Petr Vorel <pvorel@suse.cz> Tested-by: Petr Vorel <pvorel@suse.cz> Kind regards, Petr > Link: https://peps.python.org/pep-0632/ [1] > Link: https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html [2] > Link: https://setuptools.pypa.io/en/latest/history.html#v69-0-0 [3] > Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com> > --- > I'm not deeply familiar with the Python ecosystem, so it'd be good to > have this patch reviewed by someone who is. > I needed these changes to get pynfs to build on an Arch linux system > with Python version 3.13.1. > I also tested on an AlmaLinux 8.10 system with Python version 3.6.8 and > setuptools version 59.6.0, and it built succesfully for me there. > --- > nfs4.0/setup.py | 8 ++++++-- > nfs4.1/setup.py | 4 ++-- > rpc/setup.py | 4 ++-- > setup.py | 2 +- > xdr/setup.py | 2 +- > 5 files changed, 12 insertions(+), 8 deletions(-) > diff --git a/nfs4.0/setup.py b/nfs4.0/setup.py > index 58349d9..0f8380e 100755 > --- a/nfs4.0/setup.py > +++ b/nfs4.0/setup.py > @@ -3,8 +3,12 @@ > from __future__ import print_function > from __future__ import absolute_import > import sys > -from distutils.core import setup, Extension > -from distutils.dep_util import newer_group > +from setuptools import setup > +try: > + from setuptools.modified import newer_group > +except ImportError: > + # for older (before v69.0.0) versions of setuptools: > + from setuptools.dep_util import newer_group > import os > import glob > try: > diff --git a/nfs4.1/setup.py b/nfs4.1/setup.py > index e13170e..bfadea1 100644 > --- a/nfs4.1/setup.py > +++ b/nfs4.1/setup.py > @@ -1,5 +1,5 @@ > -from distutils.core import setup > +from setuptools import setup > DESCRIPTION = """ > nfs4 > @@ -8,7 +8,7 @@ nfs4 > Add stuff here. > """ > -from distutils.command.build_py import build_py as _build_py > +from setuptools.command.build_py import build_py as _build_py > import os > from glob import glob > try: > diff --git a/rpc/setup.py b/rpc/setup.py > index 99dad5a..922838f 100644 > --- a/rpc/setup.py > +++ b/rpc/setup.py > @@ -1,5 +1,5 @@ > -from distutils.core import setup > +from setuptools import setup > DESCRIPTION = """ > rpc > @@ -8,7 +8,7 @@ rpc > Add stuff here. > """ > -from distutils.command.build_py import build_py as _build_py > +from setuptools.command.build_py import build_py as _build_py > import os > from glob import glob > try: > diff --git a/setup.py b/setup.py > index 83dc6b5..203514d 100755 > --- a/setup.py > +++ b/setup.py > @@ -2,7 +2,7 @@ > from __future__ import print_function > -from distutils.core import setup > +from setuptools import setup > import sys > import os > diff --git a/xdr/setup.py b/xdr/setup.py > index 3acb8a2..3778abb 100644 > --- a/xdr/setup.py > +++ b/xdr/setup.py > @@ -1,6 +1,6 @@ > #!/usr/bin/env python3 > -from distutils.core import setup > +from setuptools import setup > DESCRIPTION = """ > xdrgen
On 11/02/2025 8:24 pm, Thomas Bertschinger wrote: > According to PEP 632 [1], distutils is obsolete and removed after Python > v3.12. Setuptools is the replacement. > > There is a migration guide at [2] that suggests the following > replacements: > > {distutils.core => setuptools}.setup > {distutils => setuptools}.command > distutils.dep_util => setuptools.modified > > Prior to setuptools v69.0.0 [3], `newer_group` was exposed through > the now-deprecated `setuptools.dep_util` instead of > `setuptools.modified`. > > Rather than updating distutils.core.Extension, I remove it as it does > not appear to be used. > > Link: https://peps.python.org/pep-0632/ [1] > Link: https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html [2] > Link: https://setuptools.pypa.io/en/latest/history.html#v69-0-0 [3] > Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com> > --- > I'm not deeply familiar with the Python ecosystem, so it'd be good to > have this patch reviewed by someone who is. > > I needed these changes to get pynfs to build on an Arch linux system > with Python version 3.13.1. > > I also tested on an AlmaLinux 8.10 system with Python version 3.6.8 and > setuptools version 59.6.0, and it built succesfully for me there. Applied. I asked a colleague with greater Python expertise than me to review it: Reviewed-by: Stephen Brennan <stephen.s.brennan@oracle.com> thanks very much for this, Thomas. cheers, c. > --- > nfs4.0/setup.py | 8 ++++++-- > nfs4.1/setup.py | 4 ++-- > rpc/setup.py | 4 ++-- > setup.py | 2 +- > xdr/setup.py | 2 +- > 5 files changed, 12 insertions(+), 8 deletions(-) > > diff --git a/nfs4.0/setup.py b/nfs4.0/setup.py > index 58349d9..0f8380e 100755 > --- a/nfs4.0/setup.py > +++ b/nfs4.0/setup.py > @@ -3,8 +3,12 @@ > from __future__ import print_function > from __future__ import absolute_import > import sys > -from distutils.core import setup, Extension > -from distutils.dep_util import newer_group > +from setuptools import setup > +try: > + from setuptools.modified import newer_group > +except ImportError: > + # for older (before v69.0.0) versions of setuptools: > + from setuptools.dep_util import newer_group > import os > import glob > try: > diff --git a/nfs4.1/setup.py b/nfs4.1/setup.py > index e13170e..bfadea1 100644 > --- a/nfs4.1/setup.py > +++ b/nfs4.1/setup.py > @@ -1,5 +1,5 @@ > > -from distutils.core import setup > +from setuptools import setup > > DESCRIPTION = """ > nfs4 > @@ -8,7 +8,7 @@ nfs4 > Add stuff here. > """ > > -from distutils.command.build_py import build_py as _build_py > +from setuptools.command.build_py import build_py as _build_py > import os > from glob import glob > try: > diff --git a/rpc/setup.py b/rpc/setup.py > index 99dad5a..922838f 100644 > --- a/rpc/setup.py > +++ b/rpc/setup.py > @@ -1,5 +1,5 @@ > > -from distutils.core import setup > +from setuptools import setup > > DESCRIPTION = """ > rpc > @@ -8,7 +8,7 @@ rpc > Add stuff here. > """ > > -from distutils.command.build_py import build_py as _build_py > +from setuptools.command.build_py import build_py as _build_py > import os > from glob import glob > try: > diff --git a/setup.py b/setup.py > index 83dc6b5..203514d 100755 > --- a/setup.py > +++ b/setup.py > @@ -2,7 +2,7 @@ > > from __future__ import print_function > > -from distutils.core import setup > +from setuptools import setup > > import sys > import os > diff --git a/xdr/setup.py b/xdr/setup.py > index 3acb8a2..3778abb 100644 > --- a/xdr/setup.py > +++ b/xdr/setup.py > @@ -1,6 +1,6 @@ > #!/usr/bin/env python3 > > -from distutils.core import setup > +from setuptools import setup > > DESCRIPTION = """ > xdrgen
diff --git a/nfs4.0/setup.py b/nfs4.0/setup.py index 58349d9..0f8380e 100755 --- a/nfs4.0/setup.py +++ b/nfs4.0/setup.py @@ -3,8 +3,12 @@ from __future__ import print_function from __future__ import absolute_import import sys -from distutils.core import setup, Extension -from distutils.dep_util import newer_group +from setuptools import setup +try: + from setuptools.modified import newer_group +except ImportError: + # for older (before v69.0.0) versions of setuptools: + from setuptools.dep_util import newer_group import os import glob try: diff --git a/nfs4.1/setup.py b/nfs4.1/setup.py index e13170e..bfadea1 100644 --- a/nfs4.1/setup.py +++ b/nfs4.1/setup.py @@ -1,5 +1,5 @@ -from distutils.core import setup +from setuptools import setup DESCRIPTION = """ nfs4 @@ -8,7 +8,7 @@ nfs4 Add stuff here. """ -from distutils.command.build_py import build_py as _build_py +from setuptools.command.build_py import build_py as _build_py import os from glob import glob try: diff --git a/rpc/setup.py b/rpc/setup.py index 99dad5a..922838f 100644 --- a/rpc/setup.py +++ b/rpc/setup.py @@ -1,5 +1,5 @@ -from distutils.core import setup +from setuptools import setup DESCRIPTION = """ rpc @@ -8,7 +8,7 @@ rpc Add stuff here. """ -from distutils.command.build_py import build_py as _build_py +from setuptools.command.build_py import build_py as _build_py import os from glob import glob try: diff --git a/setup.py b/setup.py index 83dc6b5..203514d 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from __future__ import print_function -from distutils.core import setup +from setuptools import setup import sys import os diff --git a/xdr/setup.py b/xdr/setup.py index 3acb8a2..3778abb 100644 --- a/xdr/setup.py +++ b/xdr/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from distutils.core import setup +from setuptools import setup DESCRIPTION = """ xdrgen
According to PEP 632 [1], distutils is obsolete and removed after Python v3.12. Setuptools is the replacement. There is a migration guide at [2] that suggests the following replacements: {distutils.core => setuptools}.setup {distutils => setuptools}.command distutils.dep_util => setuptools.modified Prior to setuptools v69.0.0 [3], `newer_group` was exposed through the now-deprecated `setuptools.dep_util` instead of `setuptools.modified`. Rather than updating distutils.core.Extension, I remove it as it does not appear to be used. Link: https://peps.python.org/pep-0632/ [1] Link: https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html [2] Link: https://setuptools.pypa.io/en/latest/history.html#v69-0-0 [3] Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com> --- I'm not deeply familiar with the Python ecosystem, so it'd be good to have this patch reviewed by someone who is. I needed these changes to get pynfs to build on an Arch linux system with Python version 3.13.1. I also tested on an AlmaLinux 8.10 system with Python version 3.6.8 and setuptools version 59.6.0, and it built succesfully for me there. --- nfs4.0/setup.py | 8 ++++++-- nfs4.1/setup.py | 4 ++-- rpc/setup.py | 4 ++-- setup.py | 2 +- xdr/setup.py | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-)