Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Install pyextensibletype as part of numba

  • Loading branch information...
commit b755a5f56a412d11f448f869d1cb04d9f3cd7a12 1 parent 0c11c22
@markflorisson markflorisson authored
Showing with 33 additions and 12 deletions.
  1. +11 −4 numba/exttypes/virtual.py
  2. +1 −1  numba/testing/runner.py
  3. +21 −7 setup.py
View
15 numba/exttypes/virtual.py
@@ -19,15 +19,12 @@
import ctypes
-from extensibletype import methodtable
-
import numba
from numba.typesystem import *
from numba.minivect import minitypes
from numba.exttypes import ordering
from numba.exttypes import extension_types
-
#------------------------------------------------------------------------
# Virtual Method Table Interface
#------------------------------------------------------------------------
@@ -131,13 +128,20 @@ def wrap_vtable(self, vtable):
# ______________________________________________________________________
# Hash-table building
-sep201_hasher = methodtable.Hasher()
+def initialize_interner():
+ from numba.pyextensibletype.extensibletype import intern
+ intern.global_intern_initialize()
def sep201_signature_string(functype, name):
functype = minitypes.FunctionType(functype.return_type, functype.args, name)
return str(functype)
def hash_signature(functype, name):
+ from numba.pyextensibletype.extensibletype import methodtable
+
+ initialize_interner()
+ sep201_hasher = methodtable.Hasher()
+
sigstr = sep201_signature_string(functype, name)
return sep201_hasher.hash_signature(sigstr)
@@ -145,12 +149,15 @@ def build_hashing_vtab(vtable):
"""
Build hash-based vtable.
"""
+ from numba.pyextensibletype.extensibletype import methodtable
+
n = len(vtable.methods)
ids = [sep201_signature_string(method.signature, method.name)
for method in vtable.methods]
flags = [0] * n
+ sep201_hasher = methodtable.Hasher()
vtab = methodtable.PerfectHashMethodTable(sep201_hasher)
vtab.generate_table(n, ids, flags, vtable.method_pointers)
# print(vtab)
View
2  numba/testing/runner.py
@@ -12,7 +12,7 @@
# doctest compatible for jit or autojit numba functions
from numba.testing.test_support import testmod
-EXCLUDE_TEST_PACKAGES = ["numba.minivect"]
+EXCLUDE_TEST_PACKAGES = ["numba.minivect", "numba.pyextensibletype"]
def exclude_package_dirs(dirs):
for exclude_pkg in EXCLUDE_TEST_PACKAGES:
View
28 setup.py
@@ -86,15 +86,29 @@ def get_include():
"""
return os.path.join(numba_root, "numba", "include")
-def install_pyextensibletype():
+def register_pyextensibletype():
+ import shutil
+
root = os.path.dirname(os.path.abspath(__file__))
+ numba_root = os.path.join(root, "numba")
pyext_root = os.path.join(root, 'deps', 'pyextensibletype')
- subprocess.check_call([sys.executable, 'setup.py', 'install'],
- cwd=pyext_root)
+ pyext_dst = os.path.join(numba_root, "pyextensibletype")
+
+ if os.path.exists(pyext_dst):
+ shutil.rmtree(pyext_dst)
+
+ shutil.copytree(pyext_root, pyext_dst)
+
+ with open(os.path.join(pyext_dst, '__init__.py'), 'w'):
+ pass
+
+ from numba.pyextensibletype import setupconfig
+ exts = setupconfig.get_extensions(pyext_dst, "numba.pyextensibletype")
+
+ return exts
-# TODO: Find a better means of knowing when to install pyextensibletype...
-if set(sys.argv) & set(('build', 'build_ext', 'install')):
- install_pyextensibletype()
+# TODO: Finish and release pyextensibletype
+extensibletype_extensions = register_pyextensibletype()
numba_include_dir = get_include()
@@ -135,7 +149,7 @@ def install_pyextensibletype():
'numba': ['*.c', '*.h', 'include/*', '*.pxd'],
'numba.vectorize': ['*.h'],
},
- ext_modules=[
+ ext_modules=extensibletype_extensions + [
Extension(
name="numba.vectorize._internal",
sources=["numba/vectorize/_internal.c",
Please sign in to comment.
Something went wrong with that request. Please try again.