summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/osc-lib/default.nix
blob: 73ed4068d82949980f7ef70a1320e6a30bf11d7e (plain)
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
{
  lib,
  buildPythonPackage,
  cliff,
  fetchFromGitHub,
  keystoneauth1,
  openstacksdk,
  oslo-i18n,
  oslo-utils,
  pbr,
  requests,
  requests-mock,
  setuptools,
  stdenv,
  stestr,
  stevedore,
}:

buildPythonPackage rec {
  pname = "osc-lib";
  version = "4.3.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "openstack";
    repo = "osc-lib";
    tag = version;
    hash = "sha256-1mMON/aVJon7t/zfYVhFpuB78b+DmOEVhvIFaTBRqfo=";
  };

  postPatch = ''
    # TODO: somehow bring this to upstreams attention
    substituteInPlace pyproject.toml \
      --replace-fail '"osc_lib"' '"osc_lib", "osc_lib.api", "osc_lib.cli", "osc_lib.command", "osc_lib.test", "osc_lib.tests", "osc_lib.tests.api", "osc_lib.tests.cli", "osc_lib.tests.command", "osc_lib.tests.utils", "osc_lib.utils"'
  '';

  env.PBR_VERSION = version;

  build-system = [
    pbr
    setuptools
  ];

  dependencies = [
    cliff
    keystoneauth1
    openstacksdk
    oslo-i18n
    oslo-utils
    requests
    stevedore
  ];

  nativeCheckInputs = [
    requests-mock
    stestr
  ];

  checkPhase = ''
    stestr run -e <(echo "
    ${lib.optionalString stdenv.hostPlatform.isDarwin ''
      osc_lib.tests.test_shell.TestShellCli.test_shell_args_cloud_public
      osc_lib.tests.test_shell.TestShellCli.test_shell_args_precedence
      osc_lib.tests.test_shell.TestShellCliPrecedence.test_shell_args_precedence_1
      osc_lib.tests.test_shell.TestShellCliPrecedence.test_shell_args_precedence_2
    ''}")
  '';

  pythonImportsCheck = [ "osc_lib" ];

  meta = {
    description = "OpenStackClient Library";
    homepage = "https://github.com/openstack/osc-lib";
    license = lib.licenses.asl20;
    teams = [ lib.teams.openstack ];
  };
}