Rev 4460: Use a consistent scheme for naming pyrex source files. in file:///home/vila/src/bzr/bugs/385453-make-pyrex/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Jun 22 13:52:39 BST 2009


At file:///home/vila/src/bzr/bugs/385453-make-pyrex/

------------------------------------------------------------
revno: 4460
revision-id: v.ladeuil+lp at free.fr-20090622125239-kabo9smxt9c3vnir
parent: pqm at pqm.ubuntu.com-20090618061159-nwe8eie5p489xqss
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: cleanup
timestamp: Mon 2009-06-22 14:52:39 +0200
message:
  Use a consistent scheme for naming pyrex source files.
-------------- next part --------------
=== modified file '.bzrignore'
--- a/.bzrignore	2009-06-10 19:56:16 +0000
+++ b/.bzrignore	2009-06-22 12:52:39 +0000
@@ -39,12 +39,12 @@
 doc/**/*.html
 doc/developers/performance.png
 bzrlib/_bencode_pyx.c
-bzrlib/_btree_serializer_c.c
+bzrlib/_btree_serializer_pyx.c
 bzrlib/_chk_map_pyx.c
 bzrlib/_chunks_to_lines_pyx.c
-bzrlib/_dirstate_helpers_c.c
+bzrlib/_dirstate_helpers_pyx.c
 bzrlib/_groupcompress_pyx.c
-bzrlib/_knit_load_data_c.c
+bzrlib/_knit_load_data_pyx.c
 bzrlib/_known_graph_pyx.c
 bzrlib/_readdir_pyx.c
 bzrlib/_rio_pyx.c

=== renamed file 'bzrlib/_btree_serializer_c.pyx' => 'bzrlib/_btree_serializer_pyx.pyx'
=== modified file 'bzrlib/_chk_map_pyx.pyx'
--- a/bzrlib/_chk_map_pyx.pyx	2009-04-09 20:23:07 +0000
+++ b/bzrlib/_chk_map_pyx.pyx	2009-06-22 12:52:39 +0000
@@ -64,7 +64,7 @@
 _InternalNode = None
 _unknown = None
 
-# We shouldn't just copy this from _dirstate_helpers_c
+# We shouldn't just copy this from _dirstate_helpers_pyx
 cdef void* _my_memrchr(void *s, int c, size_t n):
     # memrchr seems to be a GNU extension, so we have to implement it ourselves
     cdef char *pos

=== renamed file 'bzrlib/_dirstate_helpers_c.h' => 'bzrlib/_dirstate_helpers_pyx.h'
--- a/bzrlib/_dirstate_helpers_c.h	2008-12-12 03:53:56 +0000
+++ b/bzrlib/_dirstate_helpers_pyx.h	2009-06-22 12:52:39 +0000
@@ -1,5 +1,5 @@
-#ifndef _DIRSTATE_HELPERS_C_H
-#define _DIRSTATE_HELPERS_C_H
+#ifndef _DIRSTATE_HELPERS_PYX_H
+#define _DIRSTATE_HELPERS_PYX_H
 
 /* for intptr_t */
 #ifdef _MSC_VER

=== renamed file 'bzrlib/_dirstate_helpers_c.pyx' => 'bzrlib/_dirstate_helpers_pyx.pyx'
--- a/bzrlib/_dirstate_helpers_c.pyx	2009-06-09 01:52:10 +0000
+++ b/bzrlib/_dirstate_helpers_pyx.pyx	2009-06-22 12:52:39 +0000
@@ -54,7 +54,7 @@
 cdef extern from *:
     ctypedef unsigned long size_t
 
-cdef extern from "_dirstate_helpers_c.h":
+cdef extern from "_dirstate_helpers_pyx.h":
     ctypedef int intptr_t
 
 

=== renamed file 'bzrlib/_knit_load_data_c.pyx' => 'bzrlib/_knit_load_data_pyx.pyx'
=== modified file 'bzrlib/benchmarks/bench_dirstate.py'
--- a/bzrlib/benchmarks/bench_dirstate.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/benchmarks/bench_dirstate.py	2009-06-22 12:52:39 +0000
@@ -207,7 +207,7 @@
 
     def test__read_dirblocks_20k_tree_0_parents_c(self):
         self.requireFeature(CompiledDirstateHelpersFeature)
-        from bzrlib._dirstate_helpers_c import _read_dirblocks_c
+        from bzrlib._dirstate_helpers_pyx import _read_dirblocks_c
         state = self.build_20k_dirstate()
         state.lock_read()
         try:
@@ -232,7 +232,7 @@
 
     def test__read_dirblocks_20k_tree_1_parent_c(self):
         self.requireFeature(CompiledDirstateHelpersFeature)
-        from bzrlib._dirstate_helpers_c import _read_dirblocks_c
+        from bzrlib._dirstate_helpers_pyx import _read_dirblocks_c
         state = self.build_20k_dirstate_with_parents(1)
         state.lock_read()
         try:
@@ -257,7 +257,7 @@
 
     def test__read_dirblocks_20k_tree_2_parents_c(self):
         self.requireFeature(CompiledDirstateHelpersFeature)
-        from bzrlib._dirstate_helpers_c import _read_dirblocks_c
+        from bzrlib._dirstate_helpers_pyx import _read_dirblocks_c
         state = self.build_20k_dirstate_with_parents(2)
         state.lock_read()
         try:
@@ -338,7 +338,7 @@
 
     def test_bisect_dirblock_c(self):
         self.requireFeature(CompiledDirstateHelpersFeature)
-        from bzrlib._dirstate_helpers_c import bisect_dirblock_c
+        from bzrlib._dirstate_helpers_pyx import bisect_dirblock_c
         state = self.build_10k_dirstate_dirs()
         state.lock_read()
         try:
@@ -419,8 +419,8 @@
         self.compareAllPaths(cmp_by_dirs_py,
                              [(3, 1), (3, 1), (3, 1), (3, 2)])
 
-    def test_cmp_by_dirs_c(self):
+    def test_cmp_by_dirs_pyrex(self):
         self.requireFeature(CompiledDirstateHelpersFeature)
-        from bzrlib._dirstate_helpers_c import cmp_by_dirs_c
+        from bzrlib._dirstate_helpers_pyx import cmp_by_dirs_c
         self.compareAllPaths(cmp_by_dirs_c,
                              [(3, 1), (3, 1), (3, 1), (3, 2)])

=== modified file 'bzrlib/btree_index.py'
--- a/bzrlib/btree_index.py	2009-05-08 16:33:26 +0000
+++ b/bzrlib/btree_index.py	2009-06-22 12:52:39 +0000
@@ -1388,6 +1388,6 @@
 
 
 try:
-    from bzrlib import _btree_serializer_c as _btree_serializer
+    from bzrlib import _btree_serializer_pyx as _btree_serializer
 except ImportError:
     from bzrlib import _btree_serializer_py as _btree_serializer

=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2009-06-01 08:55:17 +0000
+++ b/bzrlib/dirstate.py	2009-06-22 12:52:39 +0000
@@ -3580,7 +3580,7 @@
 
 # Try to load the compiled form if possible
 try:
-    from bzrlib._dirstate_helpers_c import (
+    from bzrlib._dirstate_helpers_pyc import (
         _read_dirblocks_c as _read_dirblocks,
         bisect_dirblock_c as bisect_dirblock,
         _bisect_path_left_c as _bisect_path_left,

=== modified file 'bzrlib/tests/test__dirstate_helpers.py'
--- a/bzrlib/tests/test__dirstate_helpers.py	2009-05-06 05:36:28 +0000
+++ b/bzrlib/tests/test__dirstate_helpers.py	2009-06-22 12:52:39 +0000
@@ -32,18 +32,18 @@
     )
 
 try:
-    from bzrlib import _dirstate_helpers_c
-    has_dirstate_helpers_c = True
+    from bzrlib import _dirstate_helpers_pyx
+    has_dirstate_helpers_pyx = True
 except ImportError:
-    has_dirstate_helpers_c = False
+    has_dirstate_helpers_pyx = False
 
 
 class _CompiledDirstateHelpersFeature(tests.Feature):
     def _probe(self):
-        return has_dirstate_helpers_c
+        return has_dirstate_helpers_pyx
 
     def feature_name(self):
-        return 'bzrlib._dirstate_helpers_c'
+        return 'bzrlib._dirstate_helpers_pyx'
 CompiledDirstateHelpersFeature = _CompiledDirstateHelpersFeature()
 
 
@@ -56,10 +56,10 @@
 
     ue_scenarios = [('dirstate_Python',
                      {'update_entry': dirstate.py_update_entry})]
-    if has_dirstate_helpers_c:
-        c_scenario = ('dirstate_C',
-                     {'update_entry': _dirstate_helpers_c.update_entry})
-        ue_scenarios.append(c_scenario)
+    if has_dirstate_helpers_pyx:
+        pyrex_scenario = ('dirstate_Pyrex',
+                          {'update_entry': _dirstate_helpers_pyx.update_entry})
+        ue_scenarios.append(pyrex_scenario)
     process_entry_tests, remaining_tests = tests.split_suite_by_condition(
         remaining_tests, tests.condition_isinstance(TestUpdateEntry))
     tests.multiply_tests(process_entry_tests,
@@ -69,10 +69,11 @@
 
     pe_scenarios = [('dirstate_Python',
                      {'_process_entry': dirstate.ProcessEntryPython})]
-    if has_dirstate_helpers_c:
-        c_scenario = ('dirstate_C',
-                     {'_process_entry': _dirstate_helpers_c.ProcessEntryC})
-        pe_scenarios.append(c_scenario)
+    if has_dirstate_helpers_pyx:
+        pyrex_scenario = (
+            'dirstate_Pyrex',
+            {'_process_entry': _dirstate_helpers_pyx.ProcessEntryC})
+        pe_scenarios.append(pyrex_scenario)
     process_entry_tests, remaining_tests = tests.split_suite_by_condition(
         remaining_tests, tests.condition_isinstance(TestProcessEntry))
     tests.multiply_tests(process_entry_tests,
@@ -261,7 +262,7 @@
     _test_needs_features = [CompiledDirstateHelpersFeature]
 
     def get_bisect_path(self):
-        from bzrlib._dirstate_helpers_c import _bisect_path_left_c
+        from bzrlib._dirstate_helpers_pyx import _bisect_path_left_c
         return _bisect_path_left_c
 
 
@@ -282,7 +283,7 @@
     _test_needs_features = [CompiledDirstateHelpersFeature]
 
     def get_bisect_path(self):
-        from bzrlib._dirstate_helpers_c import _bisect_path_right_c
+        from bzrlib._dirstate_helpers_pyx import _bisect_path_right_c
         return _bisect_path_right_c
 
 
@@ -394,7 +395,7 @@
     _test_needs_features = [CompiledDirstateHelpersFeature]
 
     def get_bisect_dirblock(self):
-        from bzrlib._dirstate_helpers_c import bisect_dirblock_c
+        from bzrlib._dirstate_helpers_pyx import bisect_dirblock_c
         return bisect_dirblock_c
 
 
@@ -516,7 +517,7 @@
     _test_needs_features = [CompiledDirstateHelpersFeature]
 
     def get_cmp_by_dirs(self):
-        from bzrlib._dirstate_helpers_c import cmp_by_dirs_c
+        from bzrlib._dirstate_helpers_pyx import cmp_by_dirs_c
         return cmp_by_dirs_c
 
 
@@ -667,7 +668,7 @@
     _test_needs_features = [CompiledDirstateHelpersFeature]
 
     def get_cmp_by_dirs(self):
-        from bzrlib._dirstate_helpers_c import _cmp_path_by_dirblock_c
+        from bzrlib._dirstate_helpers_pyx import _cmp_path_by_dirblock_c
         return _cmp_path_by_dirblock_c
 
 
@@ -677,7 +678,7 @@
     _test_needs_features = [CompiledDirstateHelpersFeature]
 
     def assertMemRChr(self, expected, s, c):
-        from bzrlib._dirstate_helpers_c import _py_memrchr
+        from bzrlib._dirstate_helpers_pyx import _py_memrchr
         self.assertEqual(expected, _py_memrchr(s, c))
 
     def test_missing(self):
@@ -761,7 +762,7 @@
     _test_needs_features = [CompiledDirstateHelpersFeature]
 
     def get_read_dirblocks(self):
-        from bzrlib._dirstate_helpers_c import _read_dirblocks_c
+        from bzrlib._dirstate_helpers_pyx import _read_dirblocks_c
         return _read_dirblocks_c
 
 
@@ -769,13 +770,13 @@
     """Check that any compiled functions that are available are the default.
 
     It is possible to have typos, etc in the import line, such that
-    _dirstate_helpers_c is actually available, but the compiled functions are
+    _dirstate_helpers_pyx is actually available, but the compiled functions are
     not being used.
     """
 
     def test_bisect_dirblock(self):
         if CompiledDirstateHelpersFeature.available():
-            from bzrlib._dirstate_helpers_c import bisect_dirblock_c
+            from bzrlib._dirstate_helpers_pyx import bisect_dirblock_c
             self.assertIs(bisect_dirblock_c, dirstate.bisect_dirblock)
         else:
             from bzrlib._dirstate_helpers_py import bisect_dirblock_py
@@ -783,7 +784,7 @@
 
     def test__bisect_path_left(self):
         if CompiledDirstateHelpersFeature.available():
-            from bzrlib._dirstate_helpers_c import _bisect_path_left_c
+            from bzrlib._dirstate_helpers_pyx import _bisect_path_left_c
             self.assertIs(_bisect_path_left_c, dirstate._bisect_path_left)
         else:
             from bzrlib._dirstate_helpers_py import _bisect_path_left_py
@@ -791,7 +792,7 @@
 
     def test__bisect_path_right(self):
         if CompiledDirstateHelpersFeature.available():
-            from bzrlib._dirstate_helpers_c import _bisect_path_right_c
+            from bzrlib._dirstate_helpers_pyx import _bisect_path_right_c
             self.assertIs(_bisect_path_right_c, dirstate._bisect_path_right)
         else:
             from bzrlib._dirstate_helpers_py import _bisect_path_right_py
@@ -799,7 +800,7 @@
 
     def test_cmp_by_dirs(self):
         if CompiledDirstateHelpersFeature.available():
-            from bzrlib._dirstate_helpers_c import cmp_by_dirs_c
+            from bzrlib._dirstate_helpers_pyx import cmp_by_dirs_c
             self.assertIs(cmp_by_dirs_c, dirstate.cmp_by_dirs)
         else:
             from bzrlib._dirstate_helpers_py import cmp_by_dirs_py
@@ -807,7 +808,7 @@
 
     def test__read_dirblocks(self):
         if CompiledDirstateHelpersFeature.available():
-            from bzrlib._dirstate_helpers_c import _read_dirblocks_c
+            from bzrlib._dirstate_helpers_pyx import _read_dirblocks_c
             self.assertIs(_read_dirblocks_c, dirstate._read_dirblocks)
         else:
             from bzrlib._dirstate_helpers_py import _read_dirblocks_py
@@ -815,7 +816,7 @@
 
     def test_update_entry(self):
         if CompiledDirstateHelpersFeature.available():
-            from bzrlib._dirstate_helpers_c import update_entry
+            from bzrlib._dirstate_helpers_pyx import update_entry
             self.assertIs(update_entry, dirstate.update_entry)
         else:
             from bzrlib.dirstate import py_update_entry
@@ -823,7 +824,7 @@
 
     def test_process_entry(self):
         if CompiledDirstateHelpersFeature.available():
-            from bzrlib._dirstate_helpers_c import ProcessEntryC
+            from bzrlib._dirstate_helpers_pyx import ProcessEntryC
             self.assertIs(ProcessEntryC, dirstate._process_entry)
         else:
             from bzrlib.dirstate import ProcessEntryPython

=== modified file 'bzrlib/tests/test_btree_index.py'
--- a/bzrlib/tests/test_btree_index.py	2009-03-24 01:53:42 +0000
+++ b/bzrlib/tests/test_btree_index.py	2009-06-22 12:52:39 +0000
@@ -43,7 +43,7 @@
     if CompiledBtreeParserFeature.available():
         # Is there a way to do this that gets missing feature failures rather
         # than no indication to the user?
-        import bzrlib._btree_serializer_c as c_module
+        import bzrlib._btree_serializer_pyx as c_module
         scenarios.append(('C', {'parse_btree': c_module}))
     return multiply_tests(node_tests, scenarios, others)
 
@@ -51,13 +51,13 @@
 class _CompiledBtreeParserFeature(tests.Feature):
     def _probe(self):
         try:
-            import bzrlib._btree_serializer_c
+            import bzrlib._btree_serializer_pyx
         except ImportError:
             return False
         return True
 
     def feature_name(self):
-        return 'bzrlib._btree_serializer_c'
+        return 'bzrlib._btree_serializer_pyx'
 
 CompiledBtreeParserFeature = _CompiledBtreeParserFeature()
 

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2009-06-17 03:41:33 +0000
+++ b/bzrlib/workingtree_4.py	2009-06-22 12:52:39 +0000
@@ -1970,7 +1970,7 @@
         if not CompiledDirstateHelpersFeature.available():
             from bzrlib.tests import UnavailableFeature
             raise UnavailableFeature(CompiledDirstateHelpersFeature)
-        from bzrlib._dirstate_helpers_c import ProcessEntryC
+        from bzrlib._dirstate_helpers_pyx import ProcessEntryC
         result = klass.make_source_parent_tree(source, target)
         result[1]._iter_changes = ProcessEntryC
         return result

=== modified file 'setup.py'
--- a/setup.py	2009-06-15 17:02:13 +0000
+++ b/setup.py	2009-06-22 12:52:39 +0000
@@ -242,9 +242,9 @@
     c_name = path + '.c'
     define_macros = []
     if sys.platform == 'win32':
-        # pyrex uses the macro WIN32 to detect the platform, even though it should
-        # be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
-        # right value.
+        # pyrex uses the macro WIN32 to detect the platform, even though it
+        # should be using something like _WIN32 or MS_WINDOWS, oh well, we can
+        # give it the right value.
         define_macros.append(('WIN32', None))
     if have_pyrex:
         source = [pyrex_name]
@@ -260,15 +260,15 @@
 
 
 add_pyrex_extension('bzrlib._bencode_pyx')
-add_pyrex_extension('bzrlib._btree_serializer_c')
+add_pyrex_extension('bzrlib._btree_serializer_pyx')
 add_pyrex_extension('bzrlib._chunks_to_lines_pyx')
 add_pyrex_extension('bzrlib._groupcompress_pyx',
                     extra_source=['bzrlib/diff-delta.c'])
-add_pyrex_extension('bzrlib._knit_load_data_c')
+add_pyrex_extension('bzrlib._knit_load_data_pyx')
 add_pyrex_extension('bzrlib._known_graph_pyx')
 add_pyrex_extension('bzrlib._rio_pyx')
 if sys.platform == 'win32':
-    add_pyrex_extension('bzrlib._dirstate_helpers_c',
+    add_pyrex_extension('bzrlib._dirstate_helpers_pyx',
                         libraries=['Ws2_32'])
     add_pyrex_extension('bzrlib._walkdirs_win32')
     z_lib = 'zdll'
@@ -278,17 +278,18 @@
         # The code it generates re-uses a "local" pointer and
         # calls "PY_DECREF" after having set it to NULL. (It mixes PY_XDECREF
         # which is NULL safe with PY_DECREF which is not.)
-        print 'Cannot build extension "bzrlib._dirstate_helpers_c" using'
+        print 'Cannot build extension "bzrlib._dirstate_helpers_pyx" using'
         print 'your version of pyrex "%s". Please upgrade your pyrex' % (
             pyrex_version,)
         print 'install. For now, the non-compiled (python) version will'
         print 'be used instead.'
     else:
-        add_pyrex_extension('bzrlib._dirstate_helpers_c')
+        add_pyrex_extension('bzrlib._dirstate_helpers_pyx')
     add_pyrex_extension('bzrlib._readdir_pyx')
     z_lib = 'z'
 add_pyrex_extension('bzrlib._chk_map_pyx', libraries=[z_lib])
-ext_modules.append(Extension('bzrlib._patiencediff_c', ['bzrlib/_patiencediff_c.c']))
+ext_modules.append(Extension('bzrlib._patiencediff_c',
+                             ['bzrlib/_patiencediff_c.c']))
 
 
 if unavailable_files:
@@ -655,7 +656,8 @@
     # ad-hoc for easy_install
     DATA_FILES = []
     if not 'bdist_egg' in sys.argv:
-        # generate and install bzr.1 only with plain install, not easy_install one
+        # generate and install bzr.1 only with plain install, not the
+        # easy_install one
         DATA_FILES = [('man/man1', ['bzr.1'])]
 
     # std setup



More information about the bazaar-commits mailing list