Skip to content

Commit

Permalink
Create python wrapper so that mac wheels will work
Browse files Browse the repository at this point in the history
* need to work around:
    matthew-brett/delocate#22
  • Loading branch information
mgeplf committed Mar 12, 2020
1 parent 46bfa10 commit 18b7a43
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 19 additions & 0 deletions libsonata/__init__.py
Original file line number Diff line number Diff line change
@@ -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,
)
2 changes: 1 addition & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ void bindReportReader(py::module& m, const std::string& prefix) {
}


PYBIND11_MODULE(libsonata, m) {
PYBIND11_MODULE(_libsonata, m) {
py::class_<Selection>(m,
"Selection",
"ID sequence in the form convenient for querying attributes")
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def run(self):
author="BlueBrain Project, EPFL",
author_email="[email protected]",
classifiers=[],
ext_modules=[CMakeExtension("libsonata")],
ext_modules=[CMakeExtension("_libsonata")],
cmdclass=lazy_dict(
build_ext=CMakeBuild,
test_ext=CMakeBuild,
Expand All @@ -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',
],
)

0 comments on commit 18b7a43

Please sign in to comment.