1{ lib
2, buildPythonPackage
3, toPythonModule
4, pythonOlder
5, pythonAtLeast
6, fetchFromGitHub
7, pyparsing
8, opencascade
9, stdenv
10, python
11, cmake
12, swig
13, smesh
14, freetype
15, libGL
16, libGLU
17, libX11
18, six
19, pytest
20, makeFontsConf
21, freefont_ttf
22, Cocoa
23}:
24
25let
26 pythonocc-core-cadquery = toPythonModule (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 ];
42
43 buildInputs = [
44 python
45 opencascade
46 smesh
47 freetype
48 libGL
49 libGLU
50 libX11
51 ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
52
53 propagatedBuildInputs = [
54 six
55 ];
56
57 cmakeFlags = [
58 "-Wno-dev"
59 "-DPYTHONOCC_INSTALL_DIRECTORY=${placeholder "out"}/${python.sitePackages}/OCC"
60 "-DSMESH_INCLUDE_PATH=${smesh}/include/smesh"
61 "-DSMESH_LIB_PATH=${smesh}/lib"
62 "-DPYTHONOCC_WRAP_SMESH=TRUE"
63 ];
64 });
65
66in
67 buildPythonPackage rec {
68 pname = "cadquery";
69 version = "2.0";
70
71 src = fetchFromGitHub {
72 owner = "CadQuery";
73 repo = pname;
74 rev = version;
75 sha256 = "1n63b6cjjrdwdfmwq0zx1xabjnhndk9mgfkm4w7z9ardcfpvg84l";
76 };
77
78 buildInputs = [
79 opencascade
80 ];
81
82 propagatedBuildInputs = [
83 pyparsing
84 pythonocc-core-cadquery
85 ];
86
87 FONTCONFIG_FILE = makeFontsConf {
88 fontDirectories = [ freefont_ttf ];
89 };
90
91 checkInputs = [
92 pytest
93 ];
94
95 disabled = pythonOlder "3.6" || pythonAtLeast "3.8";
96
97 meta = with lib; {
98 description = "Parametric scripting language for creating and traversing CAD models";
99 homepage = "https://github.com/CadQuery/cadquery";
100 license = licenses.asl20;
101 maintainers = with maintainers; [ costrouc marcus7070 ];
102 };
103 }