python3-scikit-image: use pythran to build extensions

This commit is contained in:
Andrew J. Hesford 2021-12-06 09:13:28 -05:00
parent d8a482cf35
commit 456e3f7c80
2 changed files with 2 additions and 62 deletions

View file

@ -1,60 +0,0 @@
Disable optional Pythran support that is hard-required during build.
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@
import shutil
import builtins
import textwrap
-from numpy.distutils.command.build_ext import build_ext as npy_build_ext
+from numpy.distutils.command.build_ext import build_ext
import setuptools
from setuptools.command.build_py import build_py
@@ -17,7 +17,13 @@
# can remove this except case once we require setuptools>=59.0
from distutils.errors import CompileError, LinkError
-from pythran.dist import PythranBuildExt as pythran_build_ext
+try:
+ from pythran.dist import PythranBuildExt as pythran_build_ext
+except ImportError:
+ pass
+else:
+ # Replace numpy extension builder with pythran version
+ build_ext = pythran_build_ext[build_ext]
DISTNAME = 'scikit-image'
DESCRIPTION = 'Image processing in Python'
@@ -60,7 +66,7 @@
# Support for openmp
-class ConditionalOpenMP(pythran_build_ext[npy_build_ext]):
+class ConditionalOpenMP(build_ext):
def can_compile_link(self, compile_flags, link_flags):
--- a/skimage/feature/setup.py
+++ b/skimage/feature/setup.py
@@ -2,7 +2,7 @@
import os
from skimage._build import cython
-import pythran, logging
+import logging
base_path = os.path.abspath(os.path.dirname(__file__))
@@ -43,6 +43,11 @@
config.add_extension('_sift', sources=['_sift.c'],
include_dirs=[get_numpy_include_dirs(), '../_shared'])
+ try:
+ import pythran
+ except ImportError:
+ return config
+
# pythran submodules
pythran.config.logger.setLevel(logging.INFO)
ext = pythran.dist.PythranExtension(

View file

@ -1,13 +1,13 @@
# Template file for 'python3-scikit-image' # Template file for 'python3-scikit-image'
pkgname=python3-scikit-image pkgname=python3-scikit-image
version=0.19.0 version=0.19.0
revision=1 revision=2
_pkgname="${pkgname#python3-}" _pkgname="${pkgname#python3-}"
wrksrc="${_pkgname}-${version}" wrksrc="${_pkgname}-${version}"
build_style=python3-module build_style=python3-module
build_helper="numpy" build_helper="numpy"
hostmakedepends="python3-Cython python3-wheel python3-numpy hostmakedepends="python3-Cython python3-wheel python3-numpy
python3-packaging python3-setuptools" python3-packaging python3-setuptools pythran"
makedepends="python3-devel" makedepends="python3-devel"
depends="python3-scipy python3-numpy python3-imageio python3-matplotlib depends="python3-scipy python3-numpy python3-imageio python3-matplotlib
python3-networkx python3-tifffile python3-pywt python3-packaging" python3-networkx python3-tifffile python3-pywt python3-packaging"