Skip to content

Commit 33a552e

Browse files
committed
Fix cythonize and extension names to generate correct code
1 parent 3ac74e4 commit 33a552e

File tree

4 files changed

+31
-23
lines changed

4 files changed

+31
-23
lines changed

rawdatarinator/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'''Bring functions up to correct level.'''
22

3-
from .twixread import twixread # pylint: disable=E0611
4-
from .read import read # pylint: disable=E0611
5-
from .write import write # pylint: disable=E0611
3+
from .twixread_pyx import twixread # pylint: disable=E0611
4+
from .readcfl import read # pylint: disable=E0611
5+
from .writecfl import write # pylint: disable=E0611

setup.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ def build_extensions(self):
4444
except subprocess.CalledProcessError:
4545
print('Cython failed! Going to try to keep going...')
4646

47-
47+
MACROS = [
48+
('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION'),
49+
]
4850
extensions = [
4951
Extension(
50-
'rawdatarinator.twixread',
52+
'rawdatarinator.twixread_pyx',
5153
sources=[
5254
"bart/src/misc/version.c",
5355
"bart/src/num/vecops.c",
@@ -64,16 +66,19 @@ def build_extensions(self):
6466
"src/twixread_pyx.c",
6567
],
6668
include_dirs=['src/', 'bart/src/'],
69+
define_macros=MACROS,
6770
),
6871
Extension(
69-
'rawdatarinator.read',
72+
'rawdatarinator.readcfl',
7073
sources=['src/readcfl.c'],
71-
include_dirs=[]
74+
include_dirs=[],
75+
define_macros=MACROS,
7276
),
7377
Extension(
74-
'rawdatarinator.write',
78+
'rawdatarinator.writecfl',
7579
sources=['src/writecfl.c'],
76-
include_dirs=[]
80+
include_dirs=[],
81+
define_macros=MACROS,
7782
),
7883
]
7984

src/twixread_pyx.c

+15-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/twixread_pyx.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cimport cython
55
cimport numpy as np
66
import numpy as np
77
from tempfile import NamedTemporaryFile as NTF
8-
from rawdatarinator import read
8+
from rawdatarinator import readcfl
99

1010
cdef extern from "twixread.h":
1111
int main_twixread(int argc, char* argv[])
@@ -121,7 +121,7 @@ def twixread(
121121
for ii in range(cargs):
122122
vargs[ii] = _vargs[ii]
123123
retVal = main_twixread(cargs, vargs)
124-
return read.read(f.name)
124+
return readcfl.read(f.name)
125125

126126
# If we have the outfile, we can just put the data there
127127
_vargs.append(outname.encode())

0 commit comments

Comments
 (0)