pyhashtext: make pure python hashtext available via old hashtext api also
authorPetr Jelinek <git@pjmodos.net>
Thu, 20 Dec 2012 14:52:51 +0000 (15:52 +0100)
committerPetr Jelinek <git@pjmodos.net>
Thu, 20 Dec 2012 14:52:51 +0000 (15:52 +0100)
python/modules/hashtext.c
python/skytools/__init__.py
python/skytools/hashtext.py [moved from python/skytools/pyhashtext.py with 97% similarity]
setup_skytools.py

index f1de053cc78658686964e3b516f66f8f60ddbba1..d68d9a387ef8d5dc2a624c2dce2fb3cef02fe6db 100644 (file)
@@ -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");
 }
 
index 8b00d59d7741c22e1d33d26cb7f412048d4e4900..45a0cc1aaf7610fdfab7cd8fc57e0adf78249207 100644 (file)
@@ -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()
similarity index 97%
rename from python/skytools/pyhashtext.py
rename to python/skytools/hashtext.py
index 17795f3b6804d2d40d1838b284c1e83d12957c2e..6a9cf11ddcc09350f481422054abced2e6552d83 100644 (file)
@@ -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
index 42f91b79a0f09531d44e6341ad03f710ae99a4fb..d8c909d4b24b8058007a88b0c2139c97058a29a4 100755 (executable)
@@ -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)