Skip to content

Commit c92daef

Browse files
committed
STY: create include directory for headers
1 parent f680e77 commit c92daef

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

bottleneck/src/bottleneck.h renamed to bottleneck/include/bottleneck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#define PyString_InternFromString PyUnicode_InternFromString
4343
#endif
4444

45-
#define VARKEY METH_VARARGS | METH_KEYWORDS
45+
#define VARKEY (((unsigned)METH_VARARGS) | ((unsigned)METH_KEYWORDS))
4646
#define error_converting(x) (((x) == -1) && PyErr_Occurred())
4747

4848
#define VALUE_ERR(text) PyErr_SetString(PyExc_ValueError, text)

bottleneck/src/iterators.h renamed to bottleneck/include/iterators.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ struct _iter {
3535
};
3636
typedef struct _iter iter;
3737

38-
static inline void
39-
init_iter_one(iter *it, PyArrayObject *a, int axis) {
38+
static inline void init_iter_one(iter *it, PyArrayObject *a, int axis) {
4039
const int ndim = PyArray_NDIM(a);
4140
const npy_intp *shape = PyArray_SHAPE(a);
4241
const npy_intp *strides = PyArray_STRIDES(a);
@@ -89,8 +88,8 @@ init_iter_all(iter *it, PyArrayObject *a, int ravel, int anyorder) {
8988
it->a_ravel = NULL;
9089

9190
/* The fix for relaxed strides checking in numpy and the fix for
92-
* issue #183 has left this if..else tree in need of a refactor from the
93-
* the ground up */
91+
* issue #183 has left this if..else tree in need of a refactor from the
92+
* the ground up */
9493
if (ndim == 1) {
9594
it->ndim_m2 = -1;
9695
it->length = shape[0];
@@ -101,14 +100,14 @@ init_iter_all(iter *it, PyArrayObject *a, int ravel, int anyorder) {
101100
it->astride = 0;
102101
} else if (C_CONTIGUOUS(a) && !F_CONTIGUOUS(a)) {
103102
/* The &&! in the next two else ifs is to deal with relaxed
104-
* stride checking introduced in numpy 1.12.0; see gh #161 */
103+
* stride checking introduced in numpy 1.12.0; see gh #161 */
105104
it->ndim_m2 = -1;
106105
it->axis = ndim - 1;
107106
it->length = PyArray_SIZE(a);
108107
it->astride = 0;
109108
for (i = ndim - 1; i > -1; i--) {
110109
/* protect against length zero strides such as in
111-
* np.ones((2, 2))[..., np.newaxis] */
110+
* np.ones((2, 2))[..., np.newaxis] */
112111
if (strides[i] == 0) {
113112
continue;
114113
}
@@ -122,7 +121,7 @@ init_iter_all(iter *it, PyArrayObject *a, int ravel, int anyorder) {
122121
it->astride = 0;
123122
for (i = 0; i < ndim; i++) {
124123
/* protect against length zero strides such as in
125-
* np.ones((2, 2), order='F')[np.newaxis, ...] */
124+
* np.ones((2, 2), order='F')[np.newaxis, ...] */
126125
if (strides[i] == 0) {
127126
continue;
128127
}

bottleneck/src/bn_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def check_gcc_intrinsic(cmd: Config, intrinsic: str, value: str) -> bool:
149149

150150
def create_config_h(config: Config) -> None:
151151
dirname = os.path.dirname(__file__)
152-
config_h = os.path.join(dirname, "bn_config.h")
152+
config_h = os.path.join(dirname, "../include", "bn_config.h")
153153

154154
if (
155155
os.path.exists(config_h)

setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def initialize_options(self) -> None:
4747
if os.path.exists(generated_file):
4848
self.delete_files.append(generated_file)
4949

50-
config_h = "bottleneck/src/bn_config.h"
50+
config_h = "bottleneck/include/bn_config.h"
5151
if os.path.exists(config_h):
5252
self.delete_files.append(config_h)
5353

@@ -81,6 +81,7 @@ def finalize_options(self) -> None:
8181
# place numpy includes first, see gh #156
8282
self.include_dirs.insert(0, numpy.get_include())
8383
self.include_dirs.append("bottleneck/src")
84+
self.include_dirs.append("bottleneck/include")
8485

8586
def build_extensions(self) -> None:
8687
from bn_template import make_c_files
@@ -125,9 +126,9 @@ def get_cpu_arch_flags() -> List[str]:
125126

126127
def prepare_modules() -> List[Extension]:
127128
base_includes = [
128-
"bottleneck/src/bottleneck.h",
129-
"bottleneck/src/bn_config.h",
130-
"bottleneck/src/iterators.h",
129+
"bottleneck/include/bottleneck.h",
130+
"bottleneck/include/bn_config.h",
131+
"bottleneck/include/iterators.h",
131132
]
132133

133134
arch_flags = get_cpu_arch_flags()

0 commit comments

Comments
 (0)