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 ] ++ lib.optionals (pythonOlder "3.12") [ importlib-resources ];
44
45 optional-dependencies = {
46 passlib = [ passlib ];
47 cache = [ watchdog ];
48 };
49
50 nativeCheckInputs = [
51 pip
52 pytestCheckHook
53 setuptools
54 twine
55 webtest
56 build
57 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
58
59 __darwinAllowLocalNetworking = true;
60
61 # Tests need these permissions in order to use the FSEvents API on macOS.
62 sandboxProfile = ''
63 (allow mach-lookup (global-name "com.apple.FSEvents"))
64 '';
65
66 preCheck = ''
67 export HOME=$TMPDIR
68 '';
69
70 disabledTests = [
71 # Fails to install the package
72 "test_hash_algos"
73 "test_pip_install_authed_succeeds"
74 "test_pip_install_open_succeeds"
75 ];
76
77 disabledTestPaths = [
78 # Test requires docker service running
79 "docker/test_docker.py"
80 ];
81
82 pythonImportsCheck = [ "pypiserver" ];
83
84 meta = with lib; {
85 description = "Minimal PyPI server for use with pip/easy_install";
86 homepage = "https://github.com/pypiserver/pypiserver";
87 changelog = "https://github.com/pypiserver/pypiserver/releases/tag/v${version}";
88 license = with licenses; [
89 mit
90 zlib
91 ];
92 maintainers = with maintainers; [ austinbutler ];
93 mainProgram = "pypi-server";
94 };
95}