1From 1e3162bab59cbc2f7cf8b9ef6cadf55ee273c1d8 Mon Sep 17 00:00:00 2001
2From: James Hilliard <james.hilliard1@gmail.com>
3Date: Thu, 22 Jul 2021 06:56:51 -0600
4Subject: [PATCH] Build with nvx by default and don't publish universal wheel.
5 (#1493)
6
7Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
8[james.hilliard1@gmail.com: backport from upstream commit
9a35f22eeaafca7568f1deb35c4a1b82ae78f77d4]
10---
11 Makefile                       | 8 ++++----
12 autobahn/nvx/_utf8validator.py | 7 ++++++-
13 setup.py                       | 7 +------
14 3 files changed, 11 insertions(+), 11 deletions(-)
15
16diff --git a/autobahn/nvx/_utf8validator.py b/autobahn/nvx/_utf8validator.py
17index e72fc872..34393356 100644
18--- a/autobahn/nvx/_utf8validator.py
19+++ b/autobahn/nvx/_utf8validator.py
20@@ -44,13 +44,18 @@ ffi.cdef("""
21     int nvx_utf8vld_get_impl(void* utf8vld);
22 """)
23
24+optional = True
25+if 'AUTOBAHN_USE_NVX' in os.environ and os.environ['AUTOBAHN_USE_NVX'] in ['1', 'true']:
26+    optional = False
27+
28 with open(os.path.join(os.path.dirname(__file__), '_utf8validator.c')) as fd:
29     c_source = fd.read()
30     ffi.set_source(
31         "_nvx_utf8validator",
32         c_source,
33         libraries=[],
34-        extra_compile_args=['-std=c99', '-Wall', '-Wno-strict-prototypes', '-O3', '-march=native']
35+        extra_compile_args=['-std=c99', '-Wall', '-Wno-strict-prototypes', '-O3', '-march=native'],
36+        optional=optional
37     )
38
39
40diff --git a/setup.py b/setup.py
41index f27006da..4889a39e 100644
42--- a/setup.py
43+++ b/setup.py
44@@ -110,12 +110,7 @@ extras_require_nvx = [
45
46 # cffi based extension modules to build, currently only NVX
47 cffi_modules = []
48-if 'AUTOBAHN_USE_NVX' in os.environ:
49-    # FIXME: building this extension will make the wheel
50-    # produced no longer universal (as in "autobahn-18.4.1-py2.py3-none-any.whl").
51-    # on the other hand, I don't know how to selectively include this
52-    # based on the install flavor the user has chosen (eg pip install autobahn[nvx]
53-    # should make the following be included)
54+if 'AUTOBAHN_USE_NVX' not in os.environ or os.environ['AUTOBAHN_USE_NVX'] not in ['0', 'false']:
55     cffi_modules.append('autobahn/nvx/_utf8validator.py:ffi')
56
57 extras_require_xbr = [
58--
592.25.1
60
61