Skip to content

Commit 2a45f3f

Browse files
committed
Fix build in centos7
1 parent 94c6994 commit 2a45f3f

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

SEPythonModule/SEPythonModule/SourceInterface.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,24 @@ struct AttachedSource {
4040
ContextPtr m_context;
4141
SourceXtractor::SourceInterface* m_source_ptr = nullptr;
4242

43+
AttachedSource(ContextPtr context, SourceXtractor::SourceInterface* source_ptr)
44+
: m_context(std::move(context)), m_source_ptr(source_ptr) {}
45+
4346
boost::python::object attribute(const std::string& key) const;
4447
DetachedSource detach() const;
4548
};
4649

4750
struct OwnedSource : public AttachedSource {
4851
OwnedSource(ContextPtr context, std::unique_ptr<SourceXtractor::SourceInterface> source)
49-
: AttachedSource{std::move(context), source.get()}, m_owned_source(std::move(source)) {}
52+
: AttachedSource(std::move(context), source.get()), m_owned_source(std::move(source)) {}
5053

5154
std::string repr() const;
5255

5356
std::unique_ptr<SourceXtractor::SourceInterface> m_owned_source;
5457
};
5558

5659
struct EntangledSource : public AttachedSource {
57-
explicit EntangledSource(ContextPtr context) : AttachedSource{std::move(context)} {};
60+
explicit EntangledSource(ContextPtr context) : AttachedSource(std::move(context), nullptr) {}
5861

5962
std::string repr() const;
6063
};

SEPythonModule/src/lib/SePyMain.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,12 @@ BOOST_PYTHON_MODULE(_SEPythonModule) {
139139
.def("__call__", &FitsOutput::call)
140140
.def("get", &FitsOutput::get);
141141

142-
PyObject* pyston = PyInit_pyston();
142+
#if PY_MAJOR_VERSION >= 3
143+
PyObject* pyston = PyInit_pyston();
144+
#else
145+
initpyston();
146+
PyObject* pyston = PyImport_ImportModule("_SEPythonConfig");
147+
#endif
143148
PyObject* modules = PyImport_GetModuleDict();
144149
PyDict_SetItemString(modules, "pyston", pyston);
145150
Py_DECREF(pyston);

SEPythonModule/src/lib/SourceInterface.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct CellToPythonVisitor : public boost::static_visitor<py::object> {
4646

4747
template <typename T>
4848
py::object operator()(const std::vector<T>& vector,
49-
std::enable_if_t<!std::is_same<T, bool>::value>* = nullptr) const {
49+
typename std::enable_if<!std::is_same<T, bool>::value>::type* = nullptr) const {
5050
auto array = np::zeros(py::make_tuple(vector.size()), np::dtype::get_builtin<T>());
5151
std::memcpy(array.get_data(), vector.data(), vector.size() * sizeof(T));
5252
return array;
@@ -76,7 +76,9 @@ struct CellToPythonVisitor : public boost::static_visitor<py::object> {
7676
}
7777

7878
template <typename From>
79-
py::object operator()(From&& v, typename std::enable_if_t<std::is_pod<std::decay_t<From>>::value>* = nullptr) const {
79+
py::object
80+
operator()(From&& v,
81+
typename std::enable_if<std::is_pod<typename std::decay<From>::type>::value>::type* = nullptr) const {
8082
return py::object(v);
8183
}
8284
};

SEPythonWrapper/python/sourcextractor/pipeline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
# Copyright © 2022 Université de Genève, LMU Munich - Faculty of Physics, IAP-CNRS/Sorbonne Université
23
#
34
# This library is free software; you can redistribute it and/or modify it under

SEPythonWrapper/scripts/SourceXtractorDemo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
23
#
34
# Copyright © 2022 Université de Genève, LMU Munich - Faculty of Physics, IAP-CNRS/Sorbonne Université
45
#

0 commit comments

Comments
 (0)