summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pypiserver/default.nix
blob: 8d8771321729da5c18f835a76a2a4719b4018cef (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
  lib,
  buildPythonPackage,
  distutils,
  fetchFromGitHub,
  passlib,
  pip,
  pytestCheckHook,
  pythonOlder,
  setuptools,
  twine,
  watchdog,
  webtest,
  build,
  importlib-resources,
}:

buildPythonPackage rec {
  pname = "pypiserver";
  version = "2.4.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "pypiserver";
    repo = "pypiserver";
    tag = "v${version}";
    hash = "sha256-tbBSZdkZJGcas3PZ3dj7CqAYNH2Mt0a4aXl6t7E+wNY=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail '"setuptools-git>=0.3",' ""
  '';

  build-system = [
    setuptools
  ];

  dependencies = [
    distutils
    pip
  ]
  ++ lib.optionals (pythonOlder "3.12") [ importlib-resources ];

  optional-dependencies = {
    passlib = [ passlib ];
    cache = [ watchdog ];
  };

  nativeCheckInputs = [
    pip
    pytestCheckHook
    setuptools
    twine
    webtest
    build
  ]
  ++ lib.concatAttrValues optional-dependencies;

  __darwinAllowLocalNetworking = true;

  # Tests need these permissions in order to use the FSEvents API on macOS.
  sandboxProfile = ''
    (allow mach-lookup (global-name "com.apple.FSEvents"))
  '';

  preCheck = ''
    export HOME=$TMPDIR
  '';

  disabledTests = [
    # Fails to install the package
    "test_hash_algos"
    "test_pip_install_authed_succeeds"
    "test_pip_install_open_succeeds"
  ];

  disabledTestPaths = [
    # Test requires docker service running
    "docker/test_docker.py"
  ];

  pythonImportsCheck = [ "pypiserver" ];

  meta = {
    description = "Minimal PyPI server for use with pip/easy_install";
    homepage = "https://github.com/pypiserver/pypiserver";
    changelog = "https://github.com/pypiserver/pypiserver/releases/tag/v${version}";
    license = with lib.licenses; [
      mit
      zlib
    ];
    maintainers = with lib.maintainers; [ austinbutler ];
    mainProgram = "pypi-server";
  };
}