1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, passlib
5, pip
6, pytestCheckHook
7, pythonOlder
8, setuptools
9, setuptools-git
10, twine
11, watchdog
12, webtest
13, wheel
14}:
15
16buildPythonPackage rec {
17 pname = "pypiserver";
18 version = "2.0.1";
19 format = "setuptools";
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromGitHub {
24 owner = pname;
25 repo = pname;
26 rev = "refs/tags/v${version}";
27 hash = "sha256-Eh/3URt7pcJhoDDLRP8iHyjlPsE5E9M/0Hixqi5YNdg=";
28 };
29
30 nativeBuildInputs = [
31 setuptools
32 setuptools-git
33 wheel
34 ];
35
36 propagatedBuildInputs = [
37 pip
38 ];
39
40 passthru.optional-dependencies = {
41 passlib = [
42 passlib
43 ];
44 cache = [
45 watchdog
46 ];
47 };
48
49 __darwinAllowLocalNetworking = true;
50
51 # Tests need these permissions in order to use the FSEvents API on macOS.
52 sandboxProfile = ''
53 (allow mach-lookup (global-name "com.apple.FSEvents"))
54 '';
55
56 preCheck = ''
57 export HOME=$TMPDIR
58 '';
59
60 nativeCheckInputs = [
61 pip
62 pytestCheckHook
63 setuptools
64 twine
65 webtest
66 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
67
68 disabledTests = [
69 # Fails to install the package
70 "test_hash_algos"
71 "test_pip_install_authed_succeeds"
72 "test_pip_install_open_succeeds"
73 ];
74
75 disabledTestPaths = [
76 # Test requires docker service running
77 "docker/test_docker.py"
78 ];
79
80 pythonImportsCheck = [
81 "pypiserver"
82 ];
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; [ mit zlib ];
89 maintainers = with maintainers; [ austinbutler ];
90 };
91}