[Python-checkins] distutils2: [datafiles] rename modules and function

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


tarek.ziade pushed b15201b9e015 to distutils2:

http://hg.python.org/distutils2/rev/b15201b9e015
changeset:   1030:b15201b9e015
user:        Pierre-Yves David <pierre-yves.david at ens-lyon.org>
date:        Thu Jan 27 19:57:44 2011 +0100
summary:
  [datafiles] rename modules and function

files:
  distutils2/data/__init__.py
  distutils2/data/tools.py
  distutils2/datafiles.py
  distutils2/tests/test_data_files.py
  distutils2/tests/test_datafiles.py

diff --git a/distutils2/data/__init__.py b/distutils2/data/__init__.py
deleted file mode 100644
--- a/distutils2/data/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-"""distutils2.data
-
-contains tools for processing data files paths."""
\ No newline at end of file
diff --git a/distutils2/data/tools.py b/distutils2/datafiles.py
rename from distutils2/data/tools.py
rename to distutils2/datafiles.py
--- a/distutils2/data/tools.py
+++ b/distutils2/datafiles.py
@@ -8,16 +8,16 @@
     else:
         return simple_glob(path_glob)
 
-def check_glob(ressources):
+def find_glob(ressources):
     destinations = {}
     for (path_glob,category) in ressources:
         project_path = os.getcwd()
         abspath_glob = osp.join(project_path, path_glob)
-        
+
         for file in glob(abspath_glob):
             file = file[len(project_path):].lstrip('/')
             destinations.setdefault(file, set()).add(category)
-            
+
     return destinations
 
 def rglob(path_glob):
@@ -28,9 +28,9 @@
         radical = '*'
     else:
         radical = radical.lstrip('/')
-    glob_files = []    
+    glob_files = []
     for (path, dir, files) in os.walk(prefix):
         for file in glob(osp.join(prefix, path, radical)):
            glob_files.append(os.path.join(prefix, file))
-        
-    return glob_files
\ No newline at end of file
+
+    return glob_files
diff --git a/distutils2/tests/test_data_files.py b/distutils2/tests/test_datafiles.py
rename from distutils2/tests/test_data_files.py
rename to distutils2/tests/test_datafiles.py
--- a/distutils2/tests/test_data_files.py
+++ b/distutils2/tests/test_datafiles.py
@@ -5,24 +5,24 @@
 from StringIO import StringIO
 
 from distutils2.tests import unittest, support, run_unittest
-from distutils2.data.tools import check_glob
+from distutils2.datafiles import find_glob
 
 class DataFilesTestCase(support.TempdirManager,
                             support.LoggingCatcher,
                             unittest.TestCase):
-                            
+
     def setUp(self):
         super(DataFilesTestCase, self).setUp()
         self.addCleanup(setattr, sys, 'stdout', sys.stdout)
         self.addCleanup(setattr, sys, 'stderr', sys.stderr)
         self.addCleanup(os.chdir, os.getcwd())
-    
+
     def build_example(self):
         os.makedirs(os.path.join('mailman', 'database', 'schemas'))
         os.makedirs(os.path.join('mailman', 'etc'))
         os.makedirs(os.path.join('mailman', 'foo', 'some', 'path', 'bar'))
         os.makedirs(os.path.join('developer-docs', 'api'))
-    
+
         self.write_file('README', '')
         self.write_file('some.tpl', '')
         self.write_file('some-new-semantic.sns', '')
@@ -33,17 +33,17 @@
         self.write_file(os.path.join('mailman', 'foo', 'some', 'path', 'other.cfg'), '')
         self.write_file(os.path.join('developer-docs', 'index.txt'), '')
         self.write_file(os.path.join('developer-docs', 'api', 'toc.txt'), '')
-               
-       
+
+
     def test_simple_glob(self):
         tempdir = self.mkdtemp()
         os.chdir(tempdir)
         self.write_file('coucou.tpl', '')
         category = '{data}'
         self.assertEquals(
-            check_glob([('*.tpl', category)]),
+            find_glob([('*.tpl', category)]),
             {'coucou.tpl' : set([category])})
-    
+
     def test_multiple_glob_same_category(self):
         tempdir = self.mkdtemp()
         os.chdir(tempdir)
@@ -52,10 +52,10 @@
         self.write_file(path, '')
         category = '{appdata}'
         self.assertEquals(
-            check_glob(
+            find_glob(
                 [('scripts/*.bin', category), ('scripts/*', category)]),
                 {path : set([category])})
-    
+
     def test_multiple_glob_different_category(self):
         tempdir = self.mkdtemp()
         os.chdir(tempdir)
@@ -65,10 +65,10 @@
         category_1 = '{appdata}'
         category_2 = '{appscript}'
         self.assertEquals(
-            check_glob(
+            find_glob(
                 [('scripts/*.bin', category_1), ('scripts/*', category_2)]),
                 {path : set([category_1, category_2])})
-    
+
     def test_rglob(self):
         tempdir = self.mkdtemp()
         os.chdir(tempdir)
@@ -80,10 +80,10 @@
         self.write_file(path1, '')
         self.write_file(path2, '')
         category = '{bin}'
-        self.assertEquals(check_glob(
+        self.assertEquals(find_glob(
             [('**/*.bin', category)]),
             {path0 : set([category]), path1 : set([category]), path2 : set([category])})
-    
+
     def test_final_exemple_glob(self):
         tempdir = self.mkdtemp()
         os.chdir(tempdir)
@@ -109,10 +109,10 @@
             os.path.join('mailman', 'foo', 'some', 'path', 'other.cfg') : set([resources[6][1]]),
             'some-new-semantic.sns' : set([resources[7][1]])
         }
-        self.assertEquals(check_glob(resources), result)
-            
+        self.assertEquals(find_glob(resources), result)
+
 def test_suite():
     return unittest.makeSuite(DataFilesTestCase)
 
 if __name__ == '__main__':
-    run_unittest(test_suite())
\ No newline at end of file
+    run_unittest(test_suite())

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


More information about the Python-checkins mailing list