From: David Mulder Date: Thu, 6 Aug 2020 21:18:16 +0000 (-0600) Subject: gpo: Avoid using distutils since it will be deprecated X-Git-Tag: talloc-2.3.2~708 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0544237ea2c1cf7d507e60e2757653711be5e308;p=thirdparty%2Fsamba.git gpo: Avoid using distutils since it will be deprecated We shouldn't use distutils.spawn.find-executable here, since its use is discouraged: https://docs.python.org/3/library/distutils.html Signed-off-by: David Mulder Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/gp_sudoers_ext.py b/python/samba/gp_sudoers_ext.py index 5c607564a3f..673b0e131c6 100644 --- a/python/samba/gp_sudoers_ext.py +++ b/python/samba/gp_sudoers_ext.py @@ -19,7 +19,14 @@ from samba.gpclass import gp_pol_ext from base64 import b64encode from tempfile import NamedTemporaryFile from subprocess import Popen, PIPE -from distutils.spawn import find_executable + +def find_executable(executable, path): + paths = path.split(os.pathsep) + for p in paths: + f = os.path.join(p, executable) + if os.path.isfile(f): + return f + return None intro = ''' ### autogenerated by samba