From 9dfbf2c0e0911b707af3b40385222bf92754d361 Mon Sep 17 00:00:00 2001 From: kngwyu Date: Sun, 26 May 2019 17:42:23 +0900 Subject: [PATCH] Update PyO3 to 0.7 and release 0.6 --- .travis.yml | 2 -- Cargo.toml | 8 +++----- README.md | 12 ++++++++---- appveyor.yml | 2 -- examples/linalg/setup.py | 2 -- examples/simple-extension/Cargo.toml | 2 +- examples/simple-extension/setup.py | 2 -- src/npyffi/mod.rs | 7 +------ 8 files changed, 13 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 87591d9dc..5dac47ffc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,6 @@ cache: matrix: include: - - python: "2.7" - env: FEATURES=python2 - python: "3.5" env: FEATURES=python3 - python: "3.6" diff --git a/Cargo.toml b/Cargo.toml index 0c92a8b5f..c613570c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "numpy" -version = "0.5.0" +version = "0.6.0" authors = ["Toshiki Teramura ", "Yuji Kanagawa "] description = "Rust binding of NumPy C-API" documentation = "https://rust-numpy.github.io/rust-numpy/numpy" @@ -14,13 +14,11 @@ libc = "0.2" num-complex = "0.2" num-traits = "0.2" ndarray = "0.12" -pyo3 = "0.6" +pyo3 = "0.7" [features] # In default setting, python version is automatically detected default = [] -# Use this feature when building python2 binding. -python2 = ["pyo3/python2"] -# Use this feature when building python3 binding. +# This is no longer needed but setuptools-rust assumes this feature python3 = ["pyo3/python3"] diff --git a/README.md b/README.md index ece042e82..f2ad6d0fd 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,8 @@ using [setuptools-rust](https://github.com/PyO3/setuptools-rust). name = "numpy-test" [dependencies] -pyo3 = "0.6.0" -numpy = "0.5.0" +pyo3 = "0.7" +numpy = "0.6.0" ``` ``` rust @@ -100,11 +100,11 @@ name = "rust_ext" crate-type = ["cdylib"] [dependencies] -numpy = "0.5.0" +numpy = "0.6.0" ndarray = "0.12" [dependencies.pyo3] -version = "0.6.0" +version = "0.7" features = ["extension-module"] ``` @@ -160,6 +160,10 @@ We need your feedback. Don't hesitate to open [issues](https://github.com/rust-numpy/rust-numpy/issues)! ## Version +- v0.6.0 + - Update PyO3 to 0.7 + - Drop Python2 support + - v0.5.0 - Update PyO3 to 0.6 diff --git a/appveyor.yml b/appveyor.yml index 15b40f88d..90da34054 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,6 @@ environment: TARGET: x86_64-pc-windows-msvc matrix: - - PYTHON: "C:/Python27-x64" - FEATURES: python2 - PYTHON: "C:/Python35-x64" FEATURES: python3 - PYTHON: "C:/Python36-x64" diff --git a/examples/linalg/setup.py b/examples/linalg/setup.py index adb882766..a3afda801 100644 --- a/examples/linalg/setup.py +++ b/examples/linalg/setup.py @@ -16,8 +16,6 @@ rust_extensions=[RustExtension( 'rust_linalg.rust_linalg', './Cargo.toml', - rustc_flags=['--cfg=Py_{}'.format(PYTHON_MAJOR_VERSION)], - features=['numpy/python{}'.format(PYTHON_MAJOR_VERSION)], )], install_requires=install_requires, setup_requires=setup_requires, diff --git a/examples/simple-extension/Cargo.toml b/examples/simple-extension/Cargo.toml index 616f5c7c1..e310c4a0d 100644 --- a/examples/simple-extension/Cargo.toml +++ b/examples/simple-extension/Cargo.toml @@ -12,5 +12,5 @@ numpy = { path = "../.." } ndarray = "0.12" [dependencies.pyo3] -version = "0.6" +version = "0.7" features = ["extension-module"] \ No newline at end of file diff --git a/examples/simple-extension/setup.py b/examples/simple-extension/setup.py index e141abf15..c70186364 100644 --- a/examples/simple-extension/setup.py +++ b/examples/simple-extension/setup.py @@ -16,8 +16,6 @@ rust_extensions=[RustExtension( 'rust_ext.rust_ext', './Cargo.toml', - rustc_flags=['--cfg=Py_{}'.format(PYTHON_MAJOR_VERSION)], - features=['numpy/python{}'.format(PYTHON_MAJOR_VERSION)], )], install_requires=install_requires, setup_requires=setup_requires, diff --git a/src/npyffi/mod.rs b/src/npyffi/mod.rs index 24f971314..8a89ceb84 100644 --- a/src/npyffi/mod.rs +++ b/src/npyffi/mod.rs @@ -12,17 +12,12 @@ use pyo3::ffi; use std::ffi::CString; use std::os::raw::c_void; +use std::ptr::null_mut; fn get_numpy_api(module: &str, capsule: &str) -> *const *const c_void { let module = CString::new(module).unwrap(); let capsule = CString::new(capsule).unwrap(); - #[cfg(feature = "python2")] unsafe fn get_capsule(capsule: *mut ffi::PyObject) -> *const *const c_void { - ffi::PyCObject_AsVoidPtr(capsule) as *const *const c_void - } - #[cfg(not(feature = "python2"))] - unsafe fn get_capsule(capsule: *mut ffi::PyObject) -> *const *const c_void { - use std::ptr::null_mut; ffi::PyCapsule_GetPointer(capsule, null_mut()) as *const *const c_void } unsafe {