1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchPypi,
6 fetchpatch2,
7 hatch-fancy-pypi-readme,
8 hatch-vcs,
9 hatchling,
10 distro,
11 packaging,
12 setuptools,
13 wheel,
14 tomli,
15 # Test Inputs
16 cmake,
17 cython,
18 git,
19 pytestCheckHook,
20 pytest-mock,
21 requests,
22 virtualenv,
23}:
24
25buildPythonPackage rec {
26 pname = "scikit-build";
27 version = "0.17.6";
28 format = "pyproject";
29
30 disabled = pythonOlder "3.7";
31
32 src = fetchPypi {
33 pname = "scikit_build";
34 inherit version;
35 hash = "sha256-tRpRo2s3xCZQmUtQR5EvWbIuMhCyPjIfKHYR+e9uXJ0=";
36 };
37
38 patches = [
39 # https://github.com/scikit-build/scikit-build/pull/1032
40 # https://github.com/scikit-build/scikit-build/issues/1047
41 ./python312-compatibility.patch
42
43 (fetchpatch2 {
44 # https://github.com/scikit-build/scikit-build/pull/1073
45 name = "skbuild-suppress-permissionerror.patch";
46 url = "https://github.com/scikit-build/scikit-build/commit/41183413e4f5ef29cf3d21e470a2cfa2305733f8.patch";
47 hash = "sha256-M5Sbt4CBuiAeGgN0D/toglVi1V2GlA9hPIOMzcqOwdo=";
48 })
49 ];
50
51 # This line in the filterwarnings section of the pytest configuration leads to this error:
52 # E UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the `distutils` module in `sys.modules`. This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed in the traditional way (e.g. not an editable install), and/or make sure that setuptools is always imported before distutils.
53 postPatch = ''
54 sed -i "/'error',/d" pyproject.toml
55 '';
56
57 nativeBuildInputs = [
58 hatch-fancy-pypi-readme
59 hatch-vcs
60 hatchling
61 ];
62
63 propagatedBuildInputs = [
64 distro
65 packaging
66 setuptools
67 wheel
68 ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
69
70 nativeCheckInputs = [
71 cmake
72 cython
73 git
74 pytestCheckHook
75 pytest-mock
76 requests
77 virtualenv
78 ];
79
80 dontUseCmakeConfigure = true;
81
82 disabledTests = [
83 "test_hello_develop" # tries setuptools develop install
84 "test_source_distribution" # pip has no way to install missing dependencies
85 "test_wheel" # pip has no way to install missing dependencies
86 "test_fortran_compiler" # passes if gfortran is available
87 "test_install_command" # tries to alter out path
88 "test_test_command" # tries to alter out path
89 "test_setup" # tries to install using distutils
90 "test_pep518" # pip exits with code 1
91 "test_dual_pep518" # pip exits with code 1
92 "test_isolated_env_trigger_reconfigure" # Regex pattern 'exit skbuild saving cmake spec' does not match 'exit skbuild running make'.
93 "test_hello_wheel" # [Errno 2] No such file or directory: '_skbuild/linux-x86_64-3.9/setuptools/bdist.linux-x86_64/wheel/helloModule.py'
94 "test_hello_cython_sdist" # [Errno 2] No such file or directory: 'dist/hello-cython-1.2.3.tar.gz'
95 "test_hello_pure_sdist" # [Errno 2] No such file or directory: 'dist/hello-pure-1.2.3.tar.gz'
96 # sdist contents differ, contains additional setup.py
97 "test_hello_sdist"
98 "test_manifest_in_sdist"
99 "test_sdist_with_symlinks"
100 ];
101
102 meta = with lib; {
103 changelog = "https://github.com/scikit-build/scikit-build/blob/${version}/CHANGES.rst";
104 description = "Improved build system generator for CPython C/C++/Fortran/Cython extensions";
105 homepage = "https://github.com/scikit-build/scikit-build";
106 license = with licenses; [
107 mit
108 bsd2
109 ]; # BSD due to reuses of PyNE code
110 maintainers = with maintainers; [ FlorianFranzen ];
111 };
112}