11{
22 lib ,
3+ stdenv ,
34 buildPythonPackage ,
45 fetchFromGitHub ,
6+
7+ # build-system
58 setuptools ,
69 cython ,
7- hypothesis ,
810 numpy ,
11+
12+ # tests
13+ hypothesis ,
914 pytestCheckHook ,
10- pythonOlder ,
15+
16+ # passthru
1117 blis ,
1218 numpy_1 ,
1319 gitUpdater ,
@@ -18,34 +24,48 @@ buildPythonPackage rec {
1824 version = "1.2.1" ;
1925 pyproject = true ;
2026
21- disabled = pythonOlder "3.9" ;
22-
2327 src = fetchFromGitHub {
2428 owner = "explosion" ;
2529 repo = "cython-blis" ;
2630 tag = "release-v${ version } " ;
2731 hash = "sha256-krUqAEPxJXdlolSbV5R0ZqrWaFuXh7IxSeFTsCr6iss=" ;
2832 } ;
2933
30- preCheck = ''
31- # remove src module, so tests use the installed module instead
32- rm -rf ./blis
33- '' ;
34-
3534 build-system = [
3635 setuptools
3736 cython
3837 numpy
3938 ] ;
4039
40+ env =
41+ # Fallback to generic architectures when necessary:
42+ # https://github.com/explosion/cython-blis?tab=readme-ov-file#building-blis-for-alternative-architectures
43+ lib . optionalAttrs
44+ (
45+ # error: [Errno 2] No such file or directory: '/build/source/blis/_src/make/linux-cortexa57.jsonl'
46+ ( stdenv . hostPlatform . isLinux && stdenv . hostPlatform . isAarch64 )
47+
48+ # clang: error: unknown argument '-mavx512pf'; did you mean '-mavx512f'?
49+ # Patching blis/_src/config/knl/make_defs.mk to remove the said flag does not work
50+ || ( stdenv . hostPlatform . isDarwin && stdenv . hostPlatform . isx86_64 )
51+ )
52+ {
53+ BLIS_ARCH = "generic" ;
54+ } ;
55+
4156 dependencies = [ numpy ] ;
4257
58+ pythonImportsCheck = [ "blis" ] ;
59+
4360 nativeCheckInputs = [
4461 hypothesis
4562 pytestCheckHook
4663 ] ;
4764
48- pythonImportsCheck = [ "blis" ] ;
65+ # remove src module, so tests use the installed module instead
66+ preCheck = ''
67+ rm -rf ./blis
68+ '' ;
4969
5070 passthru = {
5171 tests = {
@@ -58,11 +78,11 @@ buildPythonPackage rec {
5878 } ;
5979 } ;
6080
61- meta = with lib ; {
62- changelog = "https://github.com/explosion/cython-blis/releases/tag/release-${ src . tag } " ;
81+ meta = {
82+ changelog = "https://github.com/explosion/cython-blis/releases/tag/release-${ version } " ;
6383 description = "BLAS-like linear algebra library" ;
6484 homepage = "https://github.com/explosion/cython-blis" ;
65- license = licenses . bsd3 ;
66- maintainers = with maintainers ; [ nickcao ] ;
85+ license = lib . licenses . bsd3 ;
86+ maintainers = with lib . maintainers ; [ nickcao ] ;
6787 } ;
6888}
0 commit comments