aboutsummaryrefslogtreecommitdiff
path: root/hw/clef/nix/pkgs/interactive_html_bom.nix
blob: 8adf7a7ccb194bffa67a294e714728b2dd9a0594 (plain) (blame)
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
{
  python3Packages,
  writeText,
  kicad-small,

  fetchFromGitHub,

  version ? "v2.9.0",
  thisSrc ? fetchFromGitHub {
    owner = "openscopeproject";
    repo = "interactivehtmlbom";
    rev = version;
    hash = "sha256-jUHEI0dWMFPQlXei3+0m1ruHzpG1hcRnxptNOXzXDqQ=";
  },
}:

let
  src = thisSrc;
  dummySetupPy = writeText "setup.py" ''
    #!/usr/bin/env python3
    # vim: set ft=python :

    from setuptools import setup, find_packages
    import sys

    packages = find_packages(include=['InteractiveHtmlBom', 'InteractiveHtmlBom.*'])

    setup(
      name="InteractiveHtmlBom",
      version='${version}',
      packages=packages,
      install_requires=['wxpython>=4.0', 'jsonschema>=4.1'],
      entry_points={
        'console_scripts': [
          'generate_interactive_bom=InteractiveHtmlBom.generate_interactive_bom:main'
        ]
      },
      include_package_data=True
    )
  '';

  dummyManifest = writeText "MANIFEST.in" ''
    recursive-include InteractiveHtmlBom/schema *
    recursive-include InteractiveHtmlBom/web *
    recursive-include InteractiveHtmlBom/dialog/bitmaps *
  '';

in python3Packages.buildPythonApplication {
  pname = "interactive_html_bom";

  inherit
    version
    src
    ;

  preBuild = ''
    cp -nv ${dummySetupPy} setup.py
    cp -nv ${dummyManifest} MANIFEST.in
    rm pyproject.toml
  '';

  dependencies = with python3Packages; [
    wxpython
    jsonschema
    kicad-small.base
  ];

  doCheck = false;
}