[Python-checkins] distutils2: [datafiles] use os.path instead of osp

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


tarek.ziade pushed b4c14d0649dd to distutils2:

http://hg.python.org/distutils2/rev/b4c14d0649dd
changeset:   1048:b4c14d0649dd
user:        Pierre-Yves David <pierre-yves.david at ens-lyon.org>
date:        Sat Jan 29 15:44:26 2011 +0100
summary:
  [datafiles] use os.path instead of osp

files:
  distutils2/datafiles.py
  distutils2/tests/test_datafiles.py

diff --git a/distutils2/datafiles.py b/distutils2/datafiles.py
--- a/distutils2/datafiles.py
+++ b/distutils2/datafiles.py
@@ -1,6 +1,5 @@
 import os
 import re
-from os import path as osp
 from glob import iglob as simple_iglob
 
 __all__ = ['iglob', 'resources_dests']
@@ -14,16 +13,16 @@
 
     def expand(self, basepath, destination):
         if self.base:
-            base = osp.join(basepath, self.base)
+            base = os.path.join(basepath, self.base)
         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)
-        absglob = osp.join(base, self.suffix)
+        absglob = os.path.join(base, self.suffix)
         for file in iglob(absglob):
             path_suffix = file[len(base):].lstrip('/')
             relpath = file[len(basepath):].lstrip('/')
-            dest = osp.join(destination, path_suffix)
+            dest = os.path.join(destination, path_suffix)
             yield relpath, dest
 
 RICH_GLOB = re.compile(r'\{([^}]*)\}')
@@ -51,7 +50,7 @@
             else:
                 radical = radical.lstrip('/')
             for (path, dir, files) in os.walk(prefix):
-                for file in iglob(osp.join(prefix, path, radical)):
+                for file in iglob(os.path.join(prefix, path, radical)):
                    yield os.path.join(prefix, file)
 
 def resources_dests(resources_dir, rules):
diff --git a/distutils2/tests/test_datafiles.py b/distutils2/tests/test_datafiles.py
--- a/distutils2/tests/test_datafiles.py
+++ b/distutils2/tests/test_datafiles.py
@@ -7,7 +7,6 @@
 from distutils2.tests import unittest, support, run_unittest
 from distutils2.datafiles import resources_dests, RICH_GLOB
 import re
-from os import path as osp
 
 
 
@@ -25,9 +24,9 @@
     def build_spec(self, spec, clean=True):
         tempdir = self.mkdtemp()
         for filepath in spec:
-            filepath = osp.join(tempdir, *filepath.split('/'))
-            dirname = osp.dirname(filepath)
-            if dirname and not osp.exists(dirname):
+            filepath = os.path.join(tempdir, *filepath.split('/'))
+            dirname = os.path.dirname(filepath)
+            if dirname and not os.path.exists(dirname):
                 os.makedirs(dirname)
             self.write_file(filepath, 'babar')
         if clean:

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


More information about the Python-checkins mailing list