1{ buildPythonPackage
2, fetchFromGitHub
3, lib
4, ply
5, setuptools
6, poetry-core
7, withOpenSCAD ? false
8, openscad
9}:
10buildPythonPackage rec {
11 pname = "solidpython2";
12 version = "2.1.0";
13 pyproject = true;
14 src = fetchFromGitHub {
15 owner = "jeff-dh";
16 repo = "SolidPython";
17 rev = "v${version}";
18 hash = "sha256-Tq3hrsC2MmueCqChk6mY/u/pCjF/pFuU2o3K+qw7ImY=";
19 };
20
21 # NOTE: this patch makes tests runnable outside the source-tree
22 # - it uses diff instead of git-diff
23 # - modifies the tests output to resemble the paths resulting from running inside the source-tree
24 # - drop the openscad image geneneration tests, these don't work on the nix sandbox due to the need for xserver
25 patches = [ ./difftool_tests.patch ];
26
27 propagatedBuildInputs = lib.optionals withOpenSCAD [openscad];
28
29 build-system = [
30 poetry-core
31 ];
32 dependencies = [
33 ply
34 setuptools
35 ];
36 pythonImportsCheck = [ "solid2" ];
37 checkPhase = ''
38 runHook preCheck
39 python $TMPDIR/source/tests/run_tests.py
40 runHook postCheck
41 '';
42
43 meta = with lib; {
44 homepage = "https://github.com/jeff-dh/SolidPython";
45 description = "A python frontend for solid modelling that compiles to OpenSCAD";
46 license = licenses.lgpl2Plus;
47 maintainers = with maintainers; [ jonboh ];
48 };
49}