Re: [ovs-dev] [PATCH v2] python: use setuptools instead of distutils

2022-08-04 Thread Ilya Maximets
On 7/11/22 14:24, Mike Pattrick wrote:
> On Wed, Jun 29, 2022 at 11:31 AM Timothy Redaelli  
> wrote:
>>
>> On Python 3.12, distutils will be removed and it's currently (3.10+)
>> deprecated (see PEP 632).
>>
>> Since the suggested and simplest replacement is setuptools, this commit
>> replaces distutils to use setuptools instead.
>>
>> setuptools < 59.0 doesn't have setuptools.errors and so, in this case,
>> distutils.errors is still used.
>>
>> Signed-off-by: Timothy Redaelli 
> 
> LGTM!
> 
> Acked-by: Mike Pattrick 

Thanks!  Applied and backported down to 2.17 to avoid
issues on a future LTS branch.

Best regards, Ilya Maximets.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] python: use setuptools instead of distutils

2022-07-11 Thread Mike Pattrick
On Wed, Jun 29, 2022 at 11:31 AM Timothy Redaelli  wrote:
>
> On Python 3.12, distutils will be removed and it's currently (3.10+)
> deprecated (see PEP 632).
>
> Since the suggested and simplest replacement is setuptools, this commit
> replaces distutils to use setuptools instead.
>
> setuptools < 59.0 doesn't have setuptools.errors and so, in this case,
> distutils.errors is still used.
>
> Signed-off-by: Timothy Redaelli 

LGTM!

Acked-by: Mike Pattrick 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] python: use setuptools instead of distutils

2022-06-29 Thread Timothy Redaelli
On Python 3.12, distutils will be removed and it's currently (3.10+)
deprecated (see PEP 632).

Since the suggested and simplest replacement is setuptools, this commit
replaces distutils to use setuptools instead.

setuptools < 59.0 doesn't have setuptools.errors and so, in this case,
distutils.errors is still used.

Signed-off-by: Timothy Redaelli 
---

v1 -> v2:
 - As reported by Mike Pattrick, use distutils.errors if setuptools.errors is
   not available (for setuptools < 59.0).

---
 python/setup.py | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/python/setup.py b/python/setup.py
index cfe01763f..8ff5bb0e9 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -12,9 +12,13 @@
 
 import sys
 
-from distutils.command.build_ext import build_ext
-from distutils.errors import CCompilerError, DistutilsExecError, \
-DistutilsPlatformError
+from setuptools.command.build_ext import build_ext
+try:
+from setuptools.errors import CCompilerError, ExecError, PlatformError
+except ImportError:  # Needed for setuptools < 59.0
+from distutils.errors import CCompilerError
+from distutils.errors import DistutilsExecError as ExecError
+from distutils.errors import DistutilsPlatformError as PlatformError
 
 import setuptools
 
@@ -37,7 +41,7 @@ except IOError:
   file=sys.stderr)
 sys.exit(-1)
 
-ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
+ext_errors = (CCompilerError, ExecError, PlatformError)
 if sys.platform == 'win32':
 ext_errors += (IOError, ValueError)
 
@@ -53,7 +57,7 @@ class try_build_ext(build_ext):
 def run(self):
 try:
 build_ext.run(self)
-except DistutilsPlatformError:
+except PlatformError:
 raise BuildFailed()
 
 def build_extension(self, ext):
-- 
2.36.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev