]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gpo: Avoid using distutils since it will be deprecated
authorDavid Mulder <dmulder@suse.com>
Thu, 6 Aug 2020 21:18:16 +0000 (15:18 -0600)
committerDavid Mulder <dmulder@samba.org>
Thu, 27 Aug 2020 15:59:33 +0000 (15:59 +0000)
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 <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/gp_sudoers_ext.py

index 5c607564a3fd037d4edc1c6f45ca1c5afc7759a9..673b0e131c604331948b2742871268135e5fcb49 100644 (file)
@@ -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