1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitLab,
5 fetchpatch,
6 setuptools,
7 setuptools-scm,
8 requests,
9 ndjson,
10 flask,
11 importlib-metadata,
12 swh-core,
13 swh-model,
14 swh-auth,
15 swh-web-client,
16 beautifulsoup4,
17 pytestCheckHook,
18 pytest-flask,
19 pytest-mock,
20 types-beautifulsoup4,
21 types-pyyaml,
22 types-requests,
23}:
24
25buildPythonPackage rec {
26 pname = "swh-scanner";
27 version = "0.8.3";
28 pyproject = true;
29
30 src = fetchFromGitLab {
31 domain = "gitlab.softwareheritage.org";
32 group = "swh";
33 owner = "devel";
34 repo = "swh-scanner";
35 tag = "v${version}";
36 hash = "sha256-baUUuYFapBD7iuDaDP8CSR9f4glVZcS5qBpZddVf7z8=";
37 };
38
39 patches = [
40 # To be removed at the next release
41 # See https://gitlab.softwareheritage.org/swh/devel/swh-scanner/-/merge_requests/160
42 (fetchpatch {
43 url = "https://gitlab.softwareheritage.org/swh/devel/swh-scanner/-/commit/0eb273475826b0074844c7619b767c052562cfe4.patch";
44 hash = "sha256-i3hpaQJmHpIYgix+/npICQGtJ/IKVRXcCTm2O1VsR9M=";
45 })
46 ];
47
48 build-system = [
49 setuptools
50 setuptools-scm
51 ];
52
53 dependencies = [
54 requests
55 ndjson
56 flask
57 importlib-metadata
58 swh-core
59 swh-model
60 swh-auth
61 swh-web-client
62 ];
63
64 pythonImportsCheck = [ "swh.scanner" ];
65
66 nativeCheckInputs = [
67 beautifulsoup4
68 pytestCheckHook
69 pytest-flask
70 pytest-mock
71 swh-core
72 swh-model
73 types-beautifulsoup4
74 types-pyyaml
75 types-requests
76 ];
77
78 disabledTestPaths = [
79 # pytestRemoveBytecodePhase fails with: "error (ignored): error: opening directory "/tmp/nix-build-python3.12-swh-scanner-0.8.3.drv-5/build/pytest-of-nixbld/pytest-0/test_randomdir_policy_info_cal0/big-directory/dir/dir/dir/ ......"
80 "swh/scanner/tests/test_policy.py"
81 ];
82
83 meta = {
84 description = "Implementation of the Data model of the Software Heritage project, used to archive source code artifacts";
85 homepage = "https://gitlab.softwareheritage.org/swh/devel/swh-model";
86 license = lib.licenses.gpl3Only;
87 maintainers = with lib.maintainers; [ ];
88 };
89}