changeset 638:a4ac464a45b3

internal: Remove SyntaxWarning from MacOS wrappers.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 14 Feb 2016 19:44:25 -0800
parents 7940861ff9bc
children 91dd760950ad
files piecrust/osutil.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/osutil.py	Tue Feb 09 21:52:17 2016 -0800
+++ b/piecrust/osutil.py	Sun Feb 14 19:44:25 2016 -0800
@@ -9,7 +9,11 @@
 glob = _system_glob.glob
 
 
-if sys.platform == 'darwin':
+def _wrap_fs_funcs():
+    global walk
+    global listdir
+    global glob
+
     def _walk(top, **kwargs):
         for dirpath, dirnames, filenames in os.walk(top, **kwargs):
             dirpath = _from_osx_fs(dirpath)
@@ -33,9 +37,11 @@
     def _to_osx_fs(s):
         return unicodedata.ucd_3_2_0.normalize('NFD', s)
 
-    global walk, listdir, glob
-
     walk = _walk
     listdir = _listdir
     glob = _glob
 
+
+if sys.platform == 'darwin':
+    _wrap_fs_funcs()
+