On 04/21/2015 07:46 AM, Petr Lautrbach wrote: > From: Miro Hrončok <mhroncok@xxxxxxxxxx> > > os.path.walk() function is deprecated and has been removed in Python 3 > > Signed-off-by: Petr Lautrbach <plautrba@xxxxxxxxxx> Acked-by: Steve Lawrence <slawrence@xxxxxxxxxx> Thanks! > --- > > A simple fix which allows to use same construction in Python 2 and Python 3. > It's reported and proposed in https://bugzilla.redhat.com/show_bug.cgi?id=1195004 > > > libselinux/src/selinuxswig_python.i | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/libselinux/src/selinuxswig_python.i b/libselinux/src/selinuxswig_python.i > index ae72246..c9a2341 100644 > --- a/libselinux/src/selinuxswig_python.i > +++ b/libselinux/src/selinuxswig_python.i > @@ -31,9 +31,9 @@ def restorecon(path, recursive=False): > lsetfilecon(path, context) > > if recursive: > - os.path.walk(path, lambda arg, dirname, fnames: > - map(restorecon, [os.path.join(dirname, fname) > - for fname in fnames]), None) > + for root, dirs, files in os.walk(path): > + for name in files + dirs: > + restorecon(os.path.join(root, name)) > > def chcon(path, context, recursive=False): > """ Set the SELinux context on a given path """ > _______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.