changeset 527:fa9eb8f866cd

bug: Fix file-system wrappers for non-Mac systems.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 28 Jul 2015 21:50:57 -0700
parents 9b8b47fb1068
children cf3218766fe2
files piecrust/osutil.py
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/osutil.py	Tue Jul 28 21:36:59 2015 -0700
+++ b/piecrust/osutil.py	Tue Jul 28 21:50:57 2015 -0700
@@ -1,23 +1,28 @@
 import os
 import sys
-import glob as _glob
+import glob as _system_glob
 import unicodedata
 
 
+walk = os.walk
+listdir = os.listdir
+glob = _system_glob.glob
+
+
 if sys.platform == 'darwin':
-    def walk(top, **kwargs):
+    def _walk(top, **kwargs):
         for dirpath, dirnames, filenames in os.walk(top, **kwargs):
             dirpath = _from_osx_fs(dirpath)
             dirnames = list(map(_from_osx_fs, dirnames))
             filenames = list(map(_from_osx_fs, filenames))
             yield dirpath, dirnames, filenames
 
-    def listdir(path='.'):
+    def _listdir(path='.'):
         for name in os.listdir(path):
             name = _from_osx_fs(name)
             yield name
 
-    def glob(pathname):
+    def _glob(pathname):
         pathname = _to_osx_fs(pathname)
         matches = _glob.glob(pathname)
         return list(map(_from_osx_fs, matches))
@@ -28,8 +33,7 @@
     def _to_osx_fs(s):
         return unicodedata.ucd_3_2_0.normalize('NFD', s)
 
-else:
-    walk = sys.walk
-    listdir = sys.listdir
-    glob = _glob.glob
+    walk = _walk
+    listdir = _listdir
+    glob = _glob