1{ lib
2 , buildPythonPackage
3 , isPy3k
4 , pythonOlder
5 , fetchFromGitHub
6 , pyparsing
7 , opencascade
8 , stdenv
9 , python
10 , cmake
11 , swig
12 , ninja
13 , smesh
14 , freetype
15 , libGL
16 , libGLU
17 , libX11
18 , six
19}:
20
21let
22 pythonocc-core-cadquery = stdenv.mkDerivation {
23 pname = "pythonocc-core-cadquery";
24 version = "0.18.2";
25
26 src = fetchFromGitHub {
27 owner = "CadQuery";
28 repo = "pythonocc-core";
29 # no proper release to to use, this commit copied from the Anaconda receipe
30 rev = "701e924ae40701cbe6f9992bcbdc2ef22aa9b5ab";
31 sha256 = "07zmiiw74dyj4v0ar5vqkvk30wzcpjjzbi04nsdk5mnlzslmyi6c";
32 };
33
34 nativeBuildInputs = [
35 cmake
36 swig
37 ninja
38 ];
39
40 buildInputs = [
41 python
42 opencascade
43 smesh
44 freetype
45 libGL
46 libGLU
47 libX11
48 ];
49
50 propagatedBuildInputs = [
51 six
52 ];
53
54 cmakeFlags = [
55 "-Wno-dev"
56 "-DPYTHONOCC_INSTALL_DIRECTORY=${placeholder "out"}/${python.sitePackages}/OCC"
57 "-DSMESH_INCLUDE_PATH=${smesh}/include/smesh"
58 "-DSMESH_LIB_PATH=${smesh}/lib"
59 "-DPYTHONOCC_WRAP_SMESH=TRUE"
60 ];
61 };
62
63in
64 buildPythonPackage rec {
65 pname = "cadquery";
66 version = "2.0RC0";
67
68 src = fetchFromGitHub {
69 owner = "CadQuery";
70 repo = pname;
71 rev = version;
72 sha256 = "1xgd00rih0gjcnlrf9s6r5a7ypjkzgf2xij2b6436i76h89wmir3";
73 };
74
75 buildInputs = [
76 opencascade
77 ];
78
79 propagatedBuildInputs = [
80 pyparsing
81 pythonocc-core-cadquery
82 ];
83
84 # Build errors on 2.7 and >=3.8 (officially only supports 3.6 and 3.7).
85 disabled = !(isPy3k && (pythonOlder "3.8"));
86
87 meta = with lib; {
88 description = "Parametric scripting language for creating and traversing CAD models";
89 homepage = "https://github.com/CadQuery/cadquery";
90 license = licenses.asl20;
91 maintainers = with maintainers; [ costrouc marcus7070 ];
92 };
93 }