From 18b7a4380558494c313c2b2b918d3cc4f2011664 Mon Sep 17 00:00:00 2001 From: Mike Gevaert Date: Thu, 12 Mar 2020 09:40:26 +0100 Subject: [PATCH] Create python wrapper so that mac wheels will work * need to work around: https://github.com/matthew-brett/delocate/issues/22 --- CMakeLists.txt | 2 +- libsonata/__init__.py | 19 +++++++++++++++++++ python/CMakeLists.txt | 2 +- python/bindings.cpp | 2 +- setup.py | 7 +++++-- 5 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 libsonata/__init__.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 309844ee..cc16217a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ option(${PROJECT_NAME}_CXX_WARNINGS "Compile C++ with warnings as errors" ON) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake) set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(SONATA_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include) diff --git a/libsonata/__init__.py b/libsonata/__init__.py new file mode 100644 index 00000000..0cb45e43 --- /dev/null +++ b/libsonata/__init__.py @@ -0,0 +1,19 @@ +# Needed so that mac wheels properly delocate: +# https://github.com/matthew-brett/delocate/issues/22 + +from _libsonata import (EdgePopulation, + EdgeStorage, + ElementsDataFrame, + ElementsReportPopulation, + ElementsReportReader, + NodePopulation, + NodeStorage, + Selection, + SomasDataFrame, + SomasReportPopulation, + SomasReportReader, + SonataError, + SpikePopulation, + SpikeReader, + version, + ) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 450ff063..70bde60c 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -9,7 +9,7 @@ endif() pybind11_add_module(sonata_python SYSTEM bindings.cpp) set_target_properties(sonata_python PROPERTIES - OUTPUT_NAME "libsonata" + OUTPUT_NAME "_libsonata" ) target_link_libraries(sonata_python diff --git a/python/bindings.cpp b/python/bindings.cpp index f2c986a6..18dace4d 100644 --- a/python/bindings.cpp +++ b/python/bindings.cpp @@ -360,7 +360,7 @@ void bindReportReader(py::module& m, const std::string& prefix) { } -PYBIND11_MODULE(libsonata, m) { +PYBIND11_MODULE(_libsonata, m) { py::class_(m, "Selection", "ID sequence in the form convenient for querying attributes") diff --git a/setup.py b/setup.py index 96076a20..45b0963f 100644 --- a/setup.py +++ b/setup.py @@ -156,7 +156,7 @@ def run(self): author="BlueBrain Project, EPFL", author_email="bbp-ou-nse@groupes.epfl.ch", classifiers=[], - ext_modules=[CMakeExtension("libsonata")], + ext_modules=[CMakeExtension("_libsonata")], cmdclass=lazy_dict( build_ext=CMakeBuild, test_ext=CMakeBuild, @@ -166,5 +166,8 @@ def run(self): zip_safe=False, setup_requires=setup_requires, install_requires=install_requires, - use_scm_version=True, + use_scm_version={"local_scheme": "no-local-version", + }, + packages=['libsonata', + ], )