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