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