about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/connexion/default.nix
blob: 6b212be3bb7bf15327b0848d21576578efbb6d2a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{ buildPythonPackage
, fetchFromGitHub
, isPy3k
, glibcLocales
, lib
, pythonOlder

, aiohttp
, aiohttp-swagger
, aiohttp-jinja2
, clickclick
, decorator
, flake8
, flask
, gevent
, inflection
, jsonschema
, mock
, openapi-spec-validator
, pathlib
, pytest
, pytest-aiohttp
, pytestcov
, pyyaml
, requests
, six
, swagger-ui-bundle
, testfixtures
, typing
, ujson
}:

buildPythonPackage rec {
  pname = "connexion";
  version = "2.4.0";

  # we're fetching from GitHub because tests weren't distributed on PyPi
  src = fetchFromGitHub {
    owner = "zalando";
    repo = pname;
    rev = version;
    sha256 = "1b9q027wrks0afl7l3a1wxymz3aick26b9fq2m07pc5wb9np0vvg";
  };

  checkInputs = [
    decorator
    mock
    pytest
    pytestcov
    testfixtures
    flask
    swagger-ui-bundle
  ]
  ++ lib.optionals isPy3k [ aiohttp aiohttp-jinja2 aiohttp-swagger ujson pytest-aiohttp ]
  ++ lib.optional (pythonOlder "3.7") glibcLocales
  ;
  propagatedBuildInputs = [
    clickclick
    jsonschema
    pyyaml
    requests
    six
    inflection
    openapi-spec-validator
    swagger-ui-bundle
    flask
  ]
  ++ lib.optional (pythonOlder "3.4") pathlib
  ++ lib.optional (pythonOlder "3.6") typing
  ++ lib.optionals isPy3k [ aiohttp aiohttp-jinja2 aiohttp-swagger ujson ]
  ;

  preConfigure = lib.optional (pythonOlder "3.7") ''
    export LANG=en_US.UTF-8
  '';

  postPatch = ''
    substituteInPlace setup.py --replace "'aiohttp>=2.3.10,<3.5.2'" "'aiohttp>=2.3.10'"
  '';

  checkPhase = if isPy3k then ''
    pytest -k "not test_app_get_root_path and \
               not test_verify_oauth_scopes_remote and \
               not test_verify_oauth_scopes_local and \
               not test_run_with_aiohttp_not_installed"''
  else "pytest --ignore=tests/aiohttp";

  meta = with lib; {
    description = "Swagger/OpenAPI First framework on top of Flask";
    homepage = "https://github.com/zalando/connexion/";
    license = licenses.asl20;
    maintainers = with maintainers; [ elohmeier ];
  };
}