Rev 4472: Use consistent naming rules for pyrex modules in http://bazaar.launchpad.net/%7Evila/bzr/integration
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue Jun 23 08:10:15 BST 2009
At http://bazaar.launchpad.net/%7Evila/bzr/integration
------------------------------------------------------------
revno: 4472 [merge]
revision-id: v.ladeuil+lp at free.fr-20090623071003-a5eok9j6ebmj049m
parent: pqm at pqm.ubuntu.com-20090623040223-yvjujkc4sd3me6gd
parent: v.ladeuil+lp at free.fr-20090623065824-tgitxb0v96qa8utd
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: integration
timestamp: Tue 2009-06-23 09:10:03 +0200
message:
Use consistent naming rules for pyrex modules
renamed:
bzrlib/_btree_serializer_c.pyx => bzrlib/_btree_serializer_pyx.pyx _parse_btree_c.pyx-20080703034413-3q25bklkenti3p8p-2
bzrlib/_dirstate_helpers_c.h => bzrlib/_dirstate_helpers_pyx.h _dirstate_helpers_c.-20070802205935-hqo9yzuzjix271dd-1
bzrlib/_dirstate_helpers_c.pyx => bzrlib/_dirstate_helpers_pyx.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
bzrlib/_knit_load_data_c.pyx => bzrlib/_knit_load_data_pyx.pyx knit_c.pyx-20070509143944-u42gy8w387a10m0j-1
modified:
.bzrignore bzrignore-20050311232317-81f7b71efa2db11a
bzrlib/_chk_map_pyx.pyx _chk_map_pyx.pyx-20090309111231-peyz7p2azr0dzdrb-1
bzrlib/_dirstate_helpers_py.py _dirstate_helpers_py-20070710145033-90nz6cqglsk150jy-1
bzrlib/benchmarks/bench_dirstate.py bench_dirstate.py-20070503203500-gs0pz6zkvjpq9l2x-1
bzrlib/btree_index.py index.py-20080624222253-p0x5f92uyh5hw734-7
bzrlib/dirstate.py dirstate.py-20060728012006-d6mvoihjb3je9peu-1
bzrlib/tests/test__dirstate_helpers.py test_dirstate_helper-20070504035751-jsbn00xodv0y1eve-2
bzrlib/tests/test_btree_index.py test_index.py-20080624222253-p0x5f92uyh5hw734-13
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
bzrlib/_dirstate_helpers_pyx.h _dirstate_helpers_c.-20070802205935-hqo9yzuzjix271dd-1
bzrlib/_dirstate_helpers_pyx.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
-------------- 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
=== modified file 'bzrlib/_dirstate_helpers_py.py'
--- a/bzrlib/_dirstate_helpers_py.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/_dirstate_helpers_py.py 2009-06-22 14:32:48 +0000
@@ -24,7 +24,7 @@
from bzrlib.dirstate import DirState
-def _bisect_path_left_py(paths, path):
+def _bisect_path_left(paths, path):
"""Return the index where to insert path into paths.
This uses the dirblock sorting. So all children in a directory come before
@@ -63,14 +63,14 @@
mid = (lo + hi) // 2
# Grab the dirname for the current dirblock
cur = paths[mid]
- if _cmp_path_by_dirblock_py(cur, path) < 0:
+ if _cmp_path_by_dirblock(cur, path) < 0:
lo = mid + 1
else:
hi = mid
return lo
-def _bisect_path_right_py(paths, path):
+def _bisect_path_right(paths, path):
"""Return the index where to insert path into paths.
This uses a path-wise comparison so we get::
@@ -94,14 +94,14 @@
mid = (lo+hi)//2
# Grab the dirname for the current dirblock
cur = paths[mid]
- if _cmp_path_by_dirblock_py(path, cur) < 0:
+ if _cmp_path_by_dirblock(path, cur) < 0:
hi = mid
else:
lo = mid + 1
return lo
-def bisect_dirblock_py(dirblocks, dirname, lo=0, hi=None, cache={}):
+def bisect_dirblock(dirblocks, dirname, lo=0, hi=None, cache={}):
"""Return the index where to insert dirname into the dirblocks.
The return value idx is such that all directories blocks in dirblock[:idx]
@@ -132,7 +132,7 @@
return lo
-def cmp_by_dirs_py(path1, path2):
+def cmp_by_dirs(path1, path2):
"""Compare two paths directory by directory.
This is equivalent to doing::
@@ -158,7 +158,7 @@
return cmp(path1.split('/'), path2.split('/'))
-def _cmp_path_by_dirblock_py(path1, path2):
+def _cmp_path_by_dirblock(path1, path2):
"""Compare two paths based on what directory they are in.
This generates a sort order, such that all children of a directory are
@@ -184,7 +184,7 @@
return cmp(key1, key2)
-def _read_dirblocks_py(state):
+def _read_dirblocks(state):
"""Read in the dirblocks for the given DirState object.
This is tightly bound to the DirState internal representation. It should be
=== 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-23 06:58:24 +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
@@ -237,7 +237,7 @@
return 0
-def cmp_by_dirs_c(path1, path2):
+def cmp_by_dirs(path1, path2):
"""Compare two paths directory by directory.
This is equivalent to doing::
@@ -266,7 +266,7 @@
PyString_Size(path2))
-def _cmp_path_by_dirblock_c(path1, path2):
+def _cmp_path_by_dirblock(path1, path2):
"""Compare two paths based on what directory they are in.
This generates a sort order, such that all children of a directory are
@@ -288,17 +288,17 @@
if not PyString_CheckExact(path2):
raise TypeError("'path2' must be a plain string, not %s: %r"
% (type(path2), path2))
- return _cmp_path_by_dirblock(PyString_AsString(path1),
- PyString_Size(path1),
- PyString_AsString(path2),
- PyString_Size(path2))
-
-
-cdef int _cmp_path_by_dirblock(char *path1, int path1_len,
- char *path2, int path2_len):
+ return _cmp_path_by_dirblock_intern(PyString_AsString(path1),
+ PyString_Size(path1),
+ PyString_AsString(path2),
+ PyString_Size(path2))
+
+
+cdef int _cmp_path_by_dirblock_intern(char *path1, int path1_len,
+ char *path2, int path2_len):
"""Compare two paths by what directory they are in.
- see ``_cmp_path_by_dirblock_c`` for details.
+ see ``_cmp_path_by_dirblock`` for details.
"""
cdef char *dirname1
cdef int dirname1_len
@@ -368,7 +368,7 @@
return 1
-def _bisect_path_left_c(paths, path):
+def _bisect_path_left(paths, path):
"""Return the index where to insert path into paths.
This uses a path-wise comparison so we get::
@@ -413,14 +413,15 @@
cur = PyList_GetItem_object_void(paths, _mid)
cur_cstr = PyString_AS_STRING_void(cur)
cur_size = PyString_GET_SIZE_void(cur)
- if _cmp_path_by_dirblock(cur_cstr, cur_size, path_cstr, path_size) < 0:
+ if _cmp_path_by_dirblock_intern(cur_cstr, cur_size,
+ path_cstr, path_size) < 0:
_lo = _mid + 1
else:
_hi = _mid
return _lo
-def _bisect_path_right_c(paths, path):
+def _bisect_path_right(paths, path):
"""Return the index where to insert path into paths.
This uses a path-wise comparison so we get::
@@ -465,14 +466,15 @@
cur = PyList_GetItem_object_void(paths, _mid)
cur_cstr = PyString_AS_STRING_void(cur)
cur_size = PyString_GET_SIZE_void(cur)
- if _cmp_path_by_dirblock(path_cstr, path_size, cur_cstr, cur_size) < 0:
+ if _cmp_path_by_dirblock_intern(path_cstr, path_size,
+ cur_cstr, cur_size) < 0:
_hi = _mid
else:
_lo = _mid + 1
return _lo
-def bisect_dirblock_c(dirblocks, dirname, lo=0, hi=None, cache=None):
+def bisect_dirblock(dirblocks, dirname, lo=0, hi=None, cache=None):
"""Return the index where to insert dirname into the dirblocks.
The return value idx is such that all directories blocks in dirblock[:idx]
@@ -744,7 +746,7 @@
self.state._split_root_dirblock_into_contents()
-def _read_dirblocks_c(state):
+def _read_dirblocks(state):
"""Read in the dirblocks for the given DirState object.
This is tightly bound to the DirState internal representation. It should be
=== 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 15:39:42 +0000
@@ -194,77 +194,77 @@
state.unlock()
def test__read_dirblocks_20k_tree_0_parents_py(self):
- from bzrlib._dirstate_helpers_py import _read_dirblocks_py
+ from bzrlib._dirstate_helpers_py import _read_dirblocks
state = self.build_20k_dirstate()
state.lock_read()
try:
self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
state._dirblock_state)
state._read_header_if_needed()
- self.time(_read_dirblocks_py, state)
+ self.time(_read_dirblocks, state)
finally:
state.unlock()
- def test__read_dirblocks_20k_tree_0_parents_c(self):
+ def test__read_dirblocks_20k_tree_0_parents_pyx(self):
self.requireFeature(CompiledDirstateHelpersFeature)
- from bzrlib._dirstate_helpers_c import _read_dirblocks_c
+ from bzrlib._dirstate_helpers_pyx import _read_dirblocks
state = self.build_20k_dirstate()
state.lock_read()
try:
self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
state._dirblock_state)
state._read_header_if_needed()
- self.time(_read_dirblocks_c, state)
+ self.time(_read_dirblocks, state)
finally:
state.unlock()
def test__read_dirblocks_20k_tree_1_parent_py(self):
- from bzrlib._dirstate_helpers_py import _read_dirblocks_py
+ from bzrlib._dirstate_helpers_py import _read_dirblocks
state = self.build_20k_dirstate_with_parents(1)
state.lock_read()
try:
self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
state._dirblock_state)
state._read_header_if_needed()
- self.time(_read_dirblocks_py, state)
+ self.time(_read_dirblocks, state)
finally:
state.unlock()
- def test__read_dirblocks_20k_tree_1_parent_c(self):
+ def test__read_dirblocks_20k_tree_1_parent_pyx(self):
self.requireFeature(CompiledDirstateHelpersFeature)
- from bzrlib._dirstate_helpers_c import _read_dirblocks_c
+ from bzrlib._dirstate_helpers_pyx import _read_dirblocks
state = self.build_20k_dirstate_with_parents(1)
state.lock_read()
try:
self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
state._dirblock_state)
state._read_header_if_needed()
- self.time(_read_dirblocks_c, state)
+ self.time(_read_dirblocks, state)
finally:
state.unlock()
def test__read_dirblocks_20k_tree_2_parents_py(self):
- from bzrlib._dirstate_helpers_py import _read_dirblocks_py
+ from bzrlib._dirstate_helpers_py import _read_dirblocks
state = self.build_20k_dirstate_with_parents(2)
state.lock_read()
try:
self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
state._dirblock_state)
state._read_header_if_needed()
- self.time(_read_dirblocks_py, state)
+ self.time(_read_dirblocks, state)
finally:
state.unlock()
- def test__read_dirblocks_20k_tree_2_parents_c(self):
+ def test__read_dirblocks_20k_tree_2_parents_pyx(self):
self.requireFeature(CompiledDirstateHelpersFeature)
- from bzrlib._dirstate_helpers_c import _read_dirblocks_c
+ from bzrlib._dirstate_helpers_pyx import _read_dirblocks
state = self.build_20k_dirstate_with_parents(2)
state.lock_read()
try:
self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
state._dirblock_state)
state._read_header_if_needed()
- self.time(_read_dirblocks_c, state)
+ self.time(_read_dirblocks, state)
finally:
state.unlock()
@@ -313,37 +313,37 @@
self.assertEqualDiff(expected_str, offset_str)
def test_bisect_dirblock_py(self):
- from bzrlib._dirstate_helpers_py import bisect_dirblock_py
+ from bzrlib._dirstate_helpers_py import bisect_dirblock
state = self.build_10k_dirstate_dirs()
state.lock_read()
try:
self.setup_paths_and_offsets(state)
offsets = self.time(self.do_bisect_list,
- bisect_dirblock_py)
+ bisect_dirblock)
self.checkOffsets(offsets)
finally:
state.unlock()
def test_bisect_dirblock_cached_py(self):
- from bzrlib._dirstate_helpers_py import bisect_dirblock_py
+ from bzrlib._dirstate_helpers_py import bisect_dirblock
state = self.build_10k_dirstate_dirs()
state.lock_read()
try:
self.setup_paths_and_offsets(state)
offsets = self.time(self.do_bisect_list_cached,
- bisect_dirblock_py)
+ bisect_dirblock)
self.checkOffsets(offsets)
finally:
state.unlock()
- def test_bisect_dirblock_c(self):
+ def test_bisect_dirblock_pyx(self):
self.requireFeature(CompiledDirstateHelpersFeature)
- from bzrlib._dirstate_helpers_c import bisect_dirblock_c
+ from bzrlib._dirstate_helpers_pyx import bisect_dirblock
state = self.build_10k_dirstate_dirs()
state.lock_read()
try:
self.setup_paths_and_offsets(state)
- offsets = self.time(self.do_bisect_list, bisect_dirblock_c)
+ offsets = self.time(self.do_bisect_list, bisect_dirblock)
self.checkOffsets(offsets)
finally:
state.unlock()
@@ -415,12 +415,12 @@
def test_cmp_by_dirs_py(self):
"""Benchmark 103041 comparisons."""
- from bzrlib._dirstate_helpers_py import cmp_by_dirs_py
- self.compareAllPaths(cmp_by_dirs_py,
+ from bzrlib._dirstate_helpers_py import cmp_by_dirs
+ self.compareAllPaths(cmp_by_dirs,
[(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
- self.compareAllPaths(cmp_by_dirs_c,
+ from bzrlib._dirstate_helpers_pyx import cmp_by_dirs
+ self.compareAllPaths(cmp_by_dirs,
[(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 14:32:48 +0000
@@ -2938,7 +2938,6 @@
False, DirState.NULLSTAT)
state._dirblock_state = DirState.IN_MEMORY_MODIFIED
return link_or_sha1
-update_entry = py_update_entry
class ProcessEntryPython(object):
@@ -3575,25 +3574,30 @@
current_dir_info = dir_iterator.next()
except StopIteration:
current_dir_info = None
-_process_entry = ProcessEntryPython
# Try to load the compiled form if possible
try:
- from bzrlib._dirstate_helpers_c import (
- _read_dirblocks_c as _read_dirblocks,
- bisect_dirblock_c as bisect_dirblock,
- _bisect_path_left_c as _bisect_path_left,
- _bisect_path_right_c as _bisect_path_right,
- cmp_by_dirs_c as cmp_by_dirs,
+ from bzrlib._dirstate_helpers_pyx import (
+ _read_dirblocks,
+ bisect_dirblock,
+ _bisect_path_left,
+ _bisect_path_right,
+ cmp_by_dirs,
ProcessEntryC as _process_entry,
update_entry as update_entry,
)
except ImportError:
from bzrlib._dirstate_helpers_py import (
- _read_dirblocks_py as _read_dirblocks,
- bisect_dirblock_py as bisect_dirblock,
- _bisect_path_left_py as _bisect_path_left,
- _bisect_path_right_py as _bisect_path_right,
- cmp_by_dirs_py as cmp_by_dirs,
+ _read_dirblocks,
+ bisect_dirblock,
+ _bisect_path_left,
+ _bisect_path_right,
+ cmp_by_dirs,
)
+ # FIXME: It would be nice to be able to track moved lines so that the
+ # corresponding python code can be moved to the _dirstate_helpers_py
+ # module. I don't want to break the history for this important piece of
+ # code so I left the code here -- vila 20090622
+ update_entry = py_update_entry
+ _process_entry = ProcessEntryPython
=== 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 15:39:42 +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,
@@ -245,45 +246,45 @@
class TestBisectPathLeft(tests.TestCase, TestBisectPathMixin):
- """Run all Bisect Path tests against _bisect_path_left_py."""
+ """Run all Bisect Path tests against _bisect_path_left."""
def get_bisect_path(self):
- from bzrlib._dirstate_helpers_py import _bisect_path_left_py
- return _bisect_path_left_py
+ from bzrlib._dirstate_helpers_py import _bisect_path_left
+ return _bisect_path_left
def get_bisect(self):
return bisect.bisect_left, 0
class TestCompiledBisectPathLeft(TestBisectPathLeft):
- """Run all Bisect Path tests against _bisect_path_right_c"""
+ """Run all Bisect Path tests against _bisect_path_lect"""
_test_needs_features = [CompiledDirstateHelpersFeature]
def get_bisect_path(self):
- from bzrlib._dirstate_helpers_c import _bisect_path_left_c
- return _bisect_path_left_c
+ from bzrlib._dirstate_helpers_pyx import _bisect_path_left
+ return _bisect_path_left
class TestBisectPathRight(tests.TestCase, TestBisectPathMixin):
- """Run all Bisect Path tests against _bisect_path_right_py"""
+ """Run all Bisect Path tests against _bisect_path_right"""
def get_bisect_path(self):
- from bzrlib._dirstate_helpers_py import _bisect_path_right_py
- return _bisect_path_right_py
+ from bzrlib._dirstate_helpers_py import _bisect_path_right
+ return _bisect_path_right
def get_bisect(self):
return bisect.bisect_right, -1
class TestCompiledBisectPathRight(TestBisectPathRight):
- """Run all Bisect Path tests against _bisect_path_right_c"""
+ """Run all Bisect Path tests against _bisect_path_right"""
_test_needs_features = [CompiledDirstateHelpersFeature]
def get_bisect_path(self):
- from bzrlib._dirstate_helpers_c import _bisect_path_right_c
- return _bisect_path_right_c
+ from bzrlib._dirstate_helpers_pyx import _bisect_path_right
+ return _bisect_path_right
class TestBisectDirblock(tests.TestCase):
@@ -300,8 +301,8 @@
def get_bisect_dirblock(self):
"""Return an implementation of bisect_dirblock"""
- from bzrlib._dirstate_helpers_py import bisect_dirblock_py
- return bisect_dirblock_py
+ from bzrlib._dirstate_helpers_py import bisect_dirblock
+ return bisect_dirblock
def assertBisect(self, dirblocks, split_dirblocks, path, *args, **kwargs):
"""Assert that bisect_split works like bisect_left on the split paths.
@@ -394,8 +395,8 @@
_test_needs_features = [CompiledDirstateHelpersFeature]
def get_bisect_dirblock(self):
- from bzrlib._dirstate_helpers_c import bisect_dirblock_c
- return bisect_dirblock_c
+ from bzrlib._dirstate_helpers_pyx import bisect_dirblock
+ return bisect_dirblock
class TestCmpByDirs(tests.TestCase):
@@ -410,8 +411,8 @@
def get_cmp_by_dirs(self):
"""Get a specific implementation of cmp_by_dirs."""
- from bzrlib._dirstate_helpers_py import cmp_by_dirs_py
- return cmp_by_dirs_py
+ from bzrlib._dirstate_helpers_py import cmp_by_dirs
+ return cmp_by_dirs
def assertCmpByDirs(self, expected, str1, str2):
"""Compare the two strings, in both directions.
@@ -516,8 +517,8 @@
_test_needs_features = [CompiledDirstateHelpersFeature]
def get_cmp_by_dirs(self):
- from bzrlib._dirstate_helpers_c import cmp_by_dirs_c
- return cmp_by_dirs_c
+ from bzrlib._dirstate_helpers_pyx import cmp_by_dirs
+ return cmp_by_dirs
class TestCmpPathByDirblock(tests.TestCase):
@@ -532,8 +533,8 @@
def get_cmp_path_by_dirblock(self):
"""Get a specific implementation of _cmp_path_by_dirblock."""
- from bzrlib._dirstate_helpers_py import _cmp_path_by_dirblock_py
- return _cmp_path_by_dirblock_py
+ from bzrlib._dirstate_helpers_py import _cmp_path_by_dirblock
+ return _cmp_path_by_dirblock
def assertCmpPathByDirblock(self, paths):
"""Compare all paths and make sure they evaluate to the correct order.
@@ -667,8 +668,8 @@
_test_needs_features = [CompiledDirstateHelpersFeature]
def get_cmp_by_dirs(self):
- from bzrlib._dirstate_helpers_c import _cmp_path_by_dirblock_c
- return _cmp_path_by_dirblock_c
+ from bzrlib._dirstate_helpers_pyx import _cmp_path_by_dirblock
+ return _cmp_path_by_dirblock
class TestMemRChr(tests.TestCase):
@@ -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):
@@ -725,8 +726,8 @@
"""
def get_read_dirblocks(self):
- from bzrlib._dirstate_helpers_py import _read_dirblocks_py
- return _read_dirblocks_py
+ from bzrlib._dirstate_helpers_py import _read_dirblocks
+ return _read_dirblocks
def test_smoketest(self):
"""Make sure that we can create and read back a simple file."""
@@ -761,69 +762,63 @@
_test_needs_features = [CompiledDirstateHelpersFeature]
def get_read_dirblocks(self):
- from bzrlib._dirstate_helpers_c import _read_dirblocks_c
- return _read_dirblocks_c
+ from bzrlib._dirstate_helpers_pyx import _read_dirblocks
+ return _read_dirblocks
class TestUsingCompiledIfAvailable(tests.TestCase):
"""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
- self.assertIs(bisect_dirblock_c, dirstate.bisect_dirblock)
+ from bzrlib._dirstate_helpers_pyx import bisect_dirblock
else:
- from bzrlib._dirstate_helpers_py import bisect_dirblock_py
- self.assertIs(bisect_dirblock_py, dirstate.bisect_dirblock)
+ from bzrlib._dirstate_helpers_py import bisect_dirblock
+ self.assertIs(bisect_dirblock, dirstate.bisect_dirblock)
def test__bisect_path_left(self):
if CompiledDirstateHelpersFeature.available():
- from bzrlib._dirstate_helpers_c import _bisect_path_left_c
- self.assertIs(_bisect_path_left_c, dirstate._bisect_path_left)
+ from bzrlib._dirstate_helpers_pyx import _bisect_path_left
else:
- from bzrlib._dirstate_helpers_py import _bisect_path_left_py
- self.assertIs(_bisect_path_left_py, dirstate._bisect_path_left)
+ from bzrlib._dirstate_helpers_py import _bisect_path_left
+ self.assertIs(_bisect_path_left, dirstate._bisect_path_left)
def test__bisect_path_right(self):
if CompiledDirstateHelpersFeature.available():
- from bzrlib._dirstate_helpers_c import _bisect_path_right_c
- self.assertIs(_bisect_path_right_c, dirstate._bisect_path_right)
+ from bzrlib._dirstate_helpers_pyx import _bisect_path_right
else:
- from bzrlib._dirstate_helpers_py import _bisect_path_right_py
- self.assertIs(_bisect_path_right_py, dirstate._bisect_path_right)
+ from bzrlib._dirstate_helpers_py import _bisect_path_right
+ self.assertIs(_bisect_path_right, dirstate._bisect_path_right)
def test_cmp_by_dirs(self):
if CompiledDirstateHelpersFeature.available():
- from bzrlib._dirstate_helpers_c import cmp_by_dirs_c
- self.assertIs(cmp_by_dirs_c, dirstate.cmp_by_dirs)
+ from bzrlib._dirstate_helpers_pyx import cmp_by_dirs
else:
- from bzrlib._dirstate_helpers_py import cmp_by_dirs_py
- self.assertIs(cmp_by_dirs_py, dirstate.cmp_by_dirs)
+ from bzrlib._dirstate_helpers_py import cmp_by_dirs
+ self.assertIs(cmp_by_dirs, dirstate.cmp_by_dirs)
def test__read_dirblocks(self):
if CompiledDirstateHelpersFeature.available():
- from bzrlib._dirstate_helpers_c import _read_dirblocks_c
- self.assertIs(_read_dirblocks_c, dirstate._read_dirblocks)
+ from bzrlib._dirstate_helpers_pyx import _read_dirblocks
else:
- from bzrlib._dirstate_helpers_py import _read_dirblocks_py
- self.assertIs(_read_dirblocks_py, dirstate._read_dirblocks)
+ from bzrlib._dirstate_helpers_py import _read_dirblocks
+ self.assertIs(_read_dirblocks, dirstate._read_dirblocks)
def test_update_entry(self):
if CompiledDirstateHelpersFeature.available():
- from bzrlib._dirstate_helpers_c import update_entry
- self.assertIs(update_entry, dirstate.update_entry)
+ from bzrlib._dirstate_helpers_pyx import update_entry
else:
- from bzrlib.dirstate import py_update_entry
- self.assertIs(py_update_entry, dirstate.py_update_entry)
+ from bzrlib.dirstate import update_entry
+ self.assertIs(update_entry, dirstate.update_entry)
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-19 09:06:56 +0000
+++ b/setup.py 2009-06-23 07:10:03 +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