Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 buildPythonPackage,
4 distutils,
5 fetchFromGitHub,
6 passlib,
7 pip,
8 pytestCheckHook,
9 pythonOlder,
10 setuptools-git,
11 setuptools,
12 twine,
13 watchdog,
14 webtest,
15 wheel,
16 build,
17 importlib-resources,
18}:
19
20buildPythonPackage rec {
21 pname = "pypiserver";
22 version = "2.3.2";
23 pyproject = true;
24
25 disabled = pythonOlder "3.7";
26
27 src = fetchFromGitHub {
28 owner = "pypiserver";
29 repo = "pypiserver";
30 tag = "v${version}";
31 hash = "sha256-ODwDYAEAqel31+kR/BE1yBfgOZOtPz3iaCLg/d6jbb4=";
32 };
33
34 build-system = [
35 setuptools
36 setuptools-git
37 wheel
38 ];
39
40 dependencies = [
41 distutils
42 pip
43 ]
44 ++ lib.optionals (pythonOlder "3.12") [ importlib-resources ];
45
46 optional-dependencies = {
47 passlib = [ passlib ];
48 cache = [ watchdog ];
49 };
50
51 nativeCheckInputs = [
52 pip
53 pytestCheckHook
54 setuptools
55 twine
56 webtest
57 build
58 ]
59 ++ lib.flatten (builtins.attrValues optional-dependencies);
60
61 __darwinAllowLocalNetworking = true;
62
63 # Tests need these permissions in order to use the FSEvents API on macOS.
64 sandboxProfile = ''
65 (allow mach-lookup (global-name "com.apple.FSEvents"))
66 '';
67
68 preCheck = ''
69 export HOME=$TMPDIR
70 '';
71
72 disabledTests = [
73 # Fails to install the package
74 "test_hash_algos"
75 "test_pip_install_authed_succeeds"
76 "test_pip_install_open_succeeds"
77 ];
78
79 disabledTestPaths = [
80 # Test requires docker service running
81 "docker/test_docker.py"
82 ];
83
84 pythonImportsCheck = [ "pypiserver" ];
85
86 meta = with lib; {
87 description = "Minimal PyPI server for use with pip/easy_install";
88 homepage = "https://github.com/pypiserver/pypiserver";
89 changelog = "https://github.com/pypiserver/pypiserver/releases/tag/v${version}";
90 license = with licenses; [
91 mit
92 zlib
93 ];
94 maintainers = with maintainers; [ austinbutler ];
95 mainProgram = "pypi-server";
96 };
97}