[Python-checkins] distutils2: Improve compatibility with pep8 for file datafiles.py

tarek.ziade python-checkins at python.org
Wed Feb 16 22:23:58 CET 2011


tarek.ziade pushed 7e820b8fe5ca to distutils2:

http://hg.python.org/distutils2/rev/7e820b8fe5ca
changeset:   1072:7e820b8fe5ca
user:        FELD Boris <lothiraldan at gmail.com>
date:        Mon Jan 31 17:37:12 2011 +0100
summary:
  Improve compatibility with pep8 for file datafiles.py

files:
  distutils2/datafiles.py

diff --git a/distutils2/datafiles.py b/distutils2/datafiles.py
--- a/distutils2/datafiles.py
+++ b/distutils2/datafiles.py
@@ -1,5 +1,4 @@
 import os
-import re
 from distutils2.util import iglob
 
 __all__ = ['iglob', 'resources_dests']
@@ -17,11 +16,12 @@
         else:
             base = basepath
         if '*' in base or '{' in base or '}'  in base:
-            raise NotImplementedError('glob are not supported into base part of datafiles definition. %r is an invalide basepath' % base)
+            raise NotImplementedError('glob are not supported into base part\
+                of datafiles definition. %r is an invalide basepath' % base)
         absglob = os.path.join(base, self.suffix)
-        for file in iglob(absglob):
-            path_suffix = file[len(base):].lstrip('/')
-            relpath = file[len(basepath):].lstrip('/')
+        for glob_file in iglob(absglob):
+            path_suffix = glob_file[len(base):].lstrip('/')
+            relpath = glob_file[len(basepath):].lstrip('/')
             dest = os.path.join(destination, path_suffix)
             yield relpath, dest
 
@@ -35,9 +35,9 @@
         else:
             delete = False
             dest = glob_dest
-        for file, file_dest in sglob.expand(resources_dir, dest):
-            if delete and file in destinations:
-                del destinations[file]
+        for resource_file, file_dest in sglob.expand(resources_dir, dest):
+            if delete and resource_file in destinations:
+                del destinations[resource_file]
             else:
-                destinations[file] = file_dest
+                destinations[resource_file] = file_dest
     return destinations

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list