Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-14828: Update pybind11 wrappers for 2.2 #27

Merged
merged 3 commits into from
Jul 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ config.log
*.pyc
.cache
pytest_session.txt
.coverage
lib/libbase.*
python/lsst/base/version.py
python/lsst64defs.py
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/base/threads.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@ namespace py = pybind11;
namespace lsst {
namespace base {

PYBIND11_PLUGIN(threads) {
py::module mod("threads");

PYBIND11_MODULE(threads, mod) {
mod.def("haveThreads", &lsst::base::haveThreads);
mod.def("setNumThreads", &lsst::base::setNumThreads);
mod.def("getNumThreads", &lsst::base::getNumThreads);
mod.def("disableImplicitThreading", &lsst::base::disableImplicitThreading);

return mod.ptr();
}

} // lsst
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/base/versions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@ namespace py = pybind11;
namespace lsst {
namespace base {

PYBIND11_PLUGIN(versions) {
py::module mod("versions");

PYBIND11_MODULE(versions, mod) {
mod.def("getRuntimeVersions", &lsst::base::getRuntimeVersions);
mod.def("getCfitsioVersion", &lsst::base::getCfitsioVersion);
mod.def("getFftwVersion", &lsst::base::getFftwVersion);
mod.def("getWcslibVersion", &lsst::base::getWcslibVersion);
mod.def("getGslVersion", &lsst::base::getGslVersion);

return mod.ptr();
}

} // lsst
Expand Down
6 changes: 1 addition & 5 deletions python/lsstcppimport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ void installPythonModuleImporter() { ModuleImporter::install(PythonModuleImporte

namespace py = pybind11;

PYBIND11_PLUGIN(_lsstcppimport) {
py::module mod("_lsstcppimport", "Access to the classes from the lsstcppimport library");

PYBIND11_MODULE(_lsstcppimport, mod) {
lsst::base::installPythonModuleImporter();

return mod.ptr();
}
10 changes: 5 additions & 5 deletions tests/testModuleImporterLib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@

namespace py = pybind11;

namespace {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not that I mind this being here at all, I am just curious why it is important in a test function?

Copy link
Contributor Author

@r-owen r-owen Jul 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably doesn't matter, but it is a library so I felt it safest. Also, it sets a good example in case of cargo culting.


bool doImport(char const * name) {
return lsst::base::ModuleImporter::import(name);
}

PYBIND11_PLUGIN(_testModuleImporterLib) {
pybind11::module mod("_testModuleImporterLib", "Tests for ModuleImporter");

mod.def("doImport", &doImport);
} // namespace

return mod.ptr();
PYBIND11_MODULE(_testModuleImporterLib, mod) {
mod.def("doImport", &doImport);
}