diff --git a/.appveyor.yml b/.appveyor.yml index 019fdcb..cb67910 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -11,7 +11,7 @@ environment: - PYTHON: 27 - PYTHON: 36 - CONDA: 27 - - CONDA: 35 + - CONDA: 36 install: - cmd: '"%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %PLATFORM%' - ps: | diff --git a/.travis.yml b/.travis.yml index 2fcf060..012eb5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: cpp +dist: trusty matrix: include: - os: linux @@ -8,7 +9,7 @@ matrix: - os: linux env: CONDA=2.7 - os: linux - env: CONDA=3.5 + env: CONDA=3.6 - os: osx env: PYTHON=2.7 - os: osx @@ -16,16 +17,7 @@ matrix: - os: osx env: CONDA=2.7 - os: osx - env: CONDA=3.5 -addons: - apt: - sources: - - ubuntu-toolchain-r-test - - deadsnakes - packages: - - g++-4.8 - - python3.5 - - python3.5-dev + env: CONDA=3.6 before_install: - | if [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX=g++-4.8 CC=gcc-4.8; fi diff --git a/conda.recipe/build.sh b/conda.recipe/build.sh index 89fce62..fc3a9af 100644 --- a/conda.recipe/build.sh +++ b/conda.recipe/build.sh @@ -1,3 +1,3 @@ #!/bin/bash +unset MACOSX_DEPLOYMENT_TARGET ${PYTHON} setup.py install; - diff --git a/setup.py b/setup.py index 75392c9..a0db45c 100644 --- a/setup.py +++ b/setup.py @@ -98,7 +98,7 @@ setup( description='A test project using pybind11', long_description='', ext_modules=ext_modules, - install_requires=['pybind11>=1.7'], + install_requires=['pybind11>=2.2'], cmdclass={'build_ext': BuildExt}, zip_safe=False, ) diff --git a/src/main.cpp b/src/main.cpp index d81046d..94d89a6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,14 +4,10 @@ int add(int i, int j) { return i + j; } -int subtract(int i, int j) { - return i - j; -} - namespace py = pybind11; -PYBIND11_PLUGIN(python_example) { - py::module m("python_example", R"pbdoc( +PYBIND11_MODULE(python_example, m) { + m.doc() = R"pbdoc( Pybind11 example plugin ----------------------- @@ -22,7 +18,7 @@ PYBIND11_PLUGIN(python_example) { add subtract - )pbdoc"); + )pbdoc"; m.def("add", &add, R"pbdoc( Add two numbers @@ -30,17 +26,15 @@ PYBIND11_PLUGIN(python_example) { Some other explanation about the add function. )pbdoc"); - m.def("subtract", &subtract, R"pbdoc( + m.def("subtract", [](int i, int j) { return i - j; }, R"pbdoc( Subtract two numbers Some other explanation about the subtract function. )pbdoc"); #ifdef VERSION_INFO - m.attr("__version__") = py::str(VERSION_INFO); + m.attr("__version__") = VERSION_INFO; #else - m.attr("__version__") = py::str("dev"); + m.attr("__version__") = "dev"; #endif - - return m.ptr(); }