File: enable-importing-cffi_support-from-new-or-old-numba.patch

package info (click to toggle)
dolfinx 2019.2.0~git20210130.c14cb0a-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,584 kB
  • sloc: cpp: 48,110; python: 9,536; xml: 9,114; makefile: 261; sh: 17
file content (48 lines) | stat: -rw-r--r-- 2,014 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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