diff options
author | Petr Jelinek | 2012-12-20 14:52:51 +0000 |
---|---|---|
committer | Petr Jelinek | 2012-12-20 14:52:51 +0000 |
commit | 272156f33b097ae883d3213b7d695524611100ee (patch) | |
tree | baeb5e7a786822cf516936434e954d11175df107 | |
parent | 7908cf38738c8d918e3d23734b6dac854ff703fa (diff) |
pyhashtext: make pure python hashtext available via old hashtext api also
-rw-r--r-- | python/modules/hashtext.c | 4 | ||||
-rw-r--r-- | python/skytools/__init__.py | 4 | ||||
-rw-r--r-- | python/skytools/hashtext.py (renamed from python/skytools/pyhashtext.py) | 4 | ||||
-rwxr-xr-x | setup_skytools.py | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/python/modules/hashtext.c b/python/modules/hashtext.c index f1de053c..d68d9a38 100644 --- a/python/modules/hashtext.c +++ b/python/modules/hashtext.c @@ -419,10 +419,10 @@ static PyMethodDef methods[] = { }; PyMODINIT_FUNC -inithashtext(void) +init_chashtext(void) { PyObject *module; - module = Py_InitModule("hashtext", methods); + module = Py_InitModule("_chashtext", methods); PyModule_AddStringConstant(module, "__doc__", "String hash functions"); } diff --git a/python/skytools/__init__.py b/python/skytools/__init__.py index 8b00d59d..45a0cc1a 100644 --- a/python/skytools/__init__.py +++ b/python/skytools/__init__.py @@ -134,8 +134,8 @@ _symbols = { # skytools.utf8 'safe_utf8_decode': 'skytools.utf8:safe_utf8_decode', # hashing - 'hashtext_old': 'skytools.pyhashtext:hashtext_old', - 'hashtext_new': 'skytools.pyhashtext:hashtext_new', + 'hashtext_old': 'skytools.hashtext:hashtext_old', + 'hashtext_new': 'skytools.hashtext:hashtext_new', } __all__ = _symbols.keys() diff --git a/python/skytools/pyhashtext.py b/python/skytools/hashtext.py index 17795f3b..6a9cf11d 100644 --- a/python/skytools/pyhashtext.py +++ b/python/skytools/hashtext.py @@ -1,7 +1,7 @@ """ Pure python implementation of Postgres hashes ->>> import skytools.hashtext +>>> import skytools._chashtext >>> for i in range(3): ... print [hashtext_new_py('x' * (i*5 + j)) for j in range(5)] [-1477818771, 1074944137, -1086392228, -1992236649, -1379736791] @@ -150,7 +150,7 @@ def hashtext_new_py(k): try: - from skytools.hashtext import hashtext_old, hashtext_new + from skytools._chashtext import hashtext_old, hashtext_new except ImportError: hashtext_old = hashtext_old_py hashtext_new = hashtext_new_py diff --git a/setup_skytools.py b/setup_skytools.py index 42f91b79..d8c909d4 100755 --- a/setup_skytools.py +++ b/setup_skytools.py @@ -185,7 +185,7 @@ c_modules = [] if BUILD_C_MOD: ext = [ Extension("skytools._cquoting", ['python/modules/cquoting.c']), - Extension("skytools.hashtext", ['python/modules/hashtext.c']), + Extension("skytools._chashtext", ['python/modules/hashtext.c']), ] c_modules.extend(ext) |