[Python-3000] Removal of os.path.walk

Humberto Diogenes humberto at digi.com.br
Fri May 9 10:27:56 CEST 2008


On 09/05/2008, at 04:45, Humberto Diogenes wrote:

>  I noticed you've already removed os.path.walk in r62909, but there  
> are still some references to it in the code, as I noticed issuing a  
> `make altinstall` on a Mac:
>  AttributeError: 'module' object has no attribute 'walk'


Here's the fix for the installation issue:


Index: setup.py
===================================================================
--- setup.py	(revision 62932)
+++ setup.py	(working copy)
@@ -1574,13 +1574,10 @@

      def set_dir_modes(self, dirname, mode):
          if not self.is_chmod_supported(): return
-        os.path.walk(dirname, self.set_dir_modes_visitor, mode)
+        for root, dirs, files in os.walk(dirname):
+            log.info("changing mode of %s to %o" % (root, mode))
+            if not self.dry_run: os.chmod(root, mode)

-    def set_dir_modes_visitor(self, mode, dirname, names):
-        if os.path.islink(dirname): return
-        log.info("changing mode of %s to %o", dirname, mode)
-        if not self.dry_run: os.chmod(dirname, mode)
-
      def is_chmod_supported(self):
          return hasattr(os, 'chmod')



I don't even know if this is really necessary, as it seems to run in  
one directory only:
changing mode of /usr/local/lib/python3.0/lib-dynload/ to 755


--
Humberto Diógenes
http://humberto.digi.com.br



More information about the Python-3000 mailing list