From 3593a43c10a09640af24d969c81399a7091ebf53 Mon Sep 17 00:00:00 2001
From: Drew Parsons <dparsons@debian.org>
Date: Fri, 24 Apr 2020 16:25:26 +0800
Subject: [PATCH] enable importing cffi_support from new or old numba versions

The latest numba 0.49 moved cffi_support to numba.core.typing.cffi_utils

Previously it was located at numba.cffi_support.

This patch enables tests and demos to work with both old and new
versions of numba.
---
 .../mixed-elasticity-sc/static-condensation-elasticity.py    | 5 ++++-
 python/test/unit/fem/test_custom_assembler.py                | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

Index: dolfinx/python/demo/mixed-elasticity-sc/static-condensation-elasticity.py
===================================================================
--- dolfinx.orig/python/demo/mixed-elasticity-sc/static-condensation-elasticity.py	2021-01-31 13:21:55.010277295 +0100
+++ dolfinx/python/demo/mixed-elasticity-sc/static-condensation-elasticity.py	2021-01-31 13:21:54.998277285 +0100
@@ -19,7 +19,10 @@
 import dolfinx.io
 import dolfinx.la
 import numba
-import numba.core.typing.cffi_utils as cffi_support
+try:
+    import numba.core.typing.cffi_utils as cffi_support
+except ModuleNotFoundError: # numba 0.48 or earlier
+    from numba import cffi_support
 import numpy
 import ufl
 from dolfinx.fem import locate_dofs_topological
Index: dolfinx/python/test/unit/fem/test_custom_assembler.py
===================================================================
--- dolfinx.orig/python/test/unit/fem/test_custom_assembler.py	2021-01-31 13:21:55.010277295 +0100
+++ dolfinx/python/test/unit/fem/test_custom_assembler.py	2021-01-31 13:21:55.002277288 +0100
@@ -16,7 +16,10 @@
 import cffi
 import dolfinx
 import numba
-import numba.core.typing.cffi_utils as cffi_support
+try:
+    import numba.core.typing.cffi_utils as cffi_support
+except ModuleNotFoundError: # numba 0.48 or earlier
+    from numba import cffi_support
 import numpy as np
 import petsc4py.lib
 import pytest
