at master 1.8 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 rustPlatform, 9 10 # native darwin dependencies 11 libiconv, 12 13 # tests 14 pytestCheckHook, 15 hypothesis, 16}: 17 18buildPythonPackage rec { 19 pname = "css-inline"; 20 version = "0.17.0"; 21 pyproject = true; 22 23 src = fetchFromGitHub { 24 owner = "Stranger6667"; 25 repo = "css-inline"; 26 rev = "python-v${version}"; 27 hash = "sha256-RclMgVJpK2dOtuFKearRMK8rpa6vFTa8T3Z+A7mk7Zs="; 28 }; 29 30 postPatch = '' 31 cd bindings/python 32 ln -s ${./Cargo.lock} Cargo.lock 33 34 # don't rebuild std 35 rm .cargo/config.toml 36 ''; 37 38 # call `cargo build --release` in bindings/python and copy the 39 # resulting lock file 40 cargoDeps = rustPlatform.fetchCargoVendor { 41 inherit pname version src; 42 postPatch = '' 43 cd bindings/python 44 ln -s ${./Cargo.lock} Cargo.lock 45 ''; 46 hash = "sha256-WvUlumpXVLiu9htY07wfGyibro2StWgYF7XVW411ePw="; 47 }; 48 49 nativeBuildInputs = [ 50 rustPlatform.cargoSetupHook 51 rustPlatform.maturinBuildHook 52 ]; 53 54 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ 55 libiconv 56 ]; 57 58 pythonImportsCheck = [ "css_inline" ]; 59 60 nativeCheckInputs = [ 61 hypothesis 62 pytestCheckHook 63 ]; 64 65 disabledTests = [ 66 # fails to connect to local server 67 "test_cache" 68 "test_remote_stylesheet" 69 ] 70 ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ 71 # pyo3_runtime.PanicException: event loop thread panicked 72 "test_invalid_href" 73 ]; 74 75 meta = with lib; { 76 description = "Inline CSS into style attributes"; 77 homepage = "https://github.com/Stranger6667/css-inline"; 78 changelog = "https://github.com/Stranger6667/css-inline/blob/${src.rev}/CHANGELOG.md"; 79 license = licenses.mit; 80 maintainers = with maintainers; [ hexa ]; 81 }; 82}