nixos-option: rewrite as a nix script, 2nd try (#369151)
[NixPkgs.git] / pkgs / development / python-modules / streaming-form-data / default.nix
blob0d13b9db97ccac2bcdfdbd04dea26b5fbfac672e
2   lib,
3   fetchFromGitHub,
4   buildPythonPackage,
5   pythonOlder,
6   cython,
7   pytestCheckHook,
8   requests-toolbelt,
9 }:
11 buildPythonPackage rec {
12   pname = "streaming-form-data";
13   version = "1.13.0";
14   format = "setuptools";
15   disabled = pythonOlder "3.6";
17   src = fetchFromGitHub {
18     owner = "siddhantgoel";
19     repo = "streaming-form-data";
20     rev = "v${version}";
21     hash = "sha256-Ntiad5GZtfRd+2uDPgbDzLBzErGFroffK6ZAmMcsfXA=";
22   };
24   # streaming-form-data has a small bit of code that uses smart_open, which has a massive closure.
25   # The only consumer of streaming-form-data is Moonraker, which doesn't use that code.
26   # So, just drop the dependency to not have to deal with it.
27   patches = [ ./drop-smart-open.patch ];
29   nativeBuildInputs = [ cython ];
31   nativeCheckInputs = [
32     pytestCheckHook
33     requests-toolbelt
34   ];
36   pytestFlagsArray = [ "tests" ];
38   pythonImportsCheck = [ "streaming_form_data" ];
40   preCheck = ''
41     # remove in-tree copy to make pytest find the installed one, with the native parts already built
42     rm -rf streaming_form_data
43   '';
45   meta = with lib; {
46     description = "Streaming parser for multipart/form-data";
47     homepage = "https://github.com/siddhantgoel/streaming-form-data";
48     license = licenses.mit;
49     maintainers = with maintainers; [ zhaofengli ];
50   };