Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build123d #42

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions expressions/OCP/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
let
# We need to use an unmodified version number for the dist-utils version so
# that the version check in cadquery works
# remember to change version number in dump_symbols.py as well
base-version = "7.6.3";
base-version = "7.7.0";
version = "v${base-version}-git-${src.shortRev}";

vtk_main_version = lib.versions.majorMinor vtk_9.version;
Expand Down
2 changes: 1 addition & 1 deletion expressions/OCP/dump_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
prefix = sys.argv[1]

prefix_linux = Path(prefix).expand()
libs = prefix_linux.glob('**/libTK*.so.7.6.3')
libs = prefix_linux.glob('**/libTK*.so.*')

exported_symbols = []

Expand Down
11 changes: 11 additions & 0 deletions expressions/build123d.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ buildPythonPackage, src, ocp, ocp-stubs, setuptools, typing-extensions, svgpathtools, numpy, anytree, ezdxf }:

buildPythonPackage rec {
pname = "build123d";
version = if (builtins.hasAttr "rev" src) then src.shortRev else "local-dev";
format = "pyproject";
inherit src;

patches = [ ./no-git-dep.diff ];
propagatedBuildInputs = [ ocp ocp-stubs setuptools typing-extensions svgpathtools numpy anytree ezdxf ];
}
19 changes: 19 additions & 0 deletions expressions/no-git-dep.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/pyproject.toml b/pyproject.toml
index 737f549..4aa8d8f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -36,10 +36,10 @@ classifiers = [
]

dependencies = [
- "cadquery-ocp ~= 7.7.0a0",
- "OCP-stubs @ git+https://github.com/CadQuery/[email protected]",
- "typing_extensions >= 4.4.0, <5",
- "numpy >= 1.24.1, <2",
+ "ocp ~= 7.7.0a0",
+ "OCP-stubs",
+ "typing_extensions >= 4.3.0, <5",
+ "numpy >= 1.23.3, <2",
"svgpathtools >= 1.5.1, <2",
"anytree >= 2.8.0, <3",
"ezdxf >= 1.0.0, < 2"
8 changes: 4 additions & 4 deletions expressions/opencascade-occt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
, freetype
, freeimage
, fontconfig
, tbb
, tbb_2021_8
, rapidjson
, glew
}:
Expand All @@ -27,13 +27,13 @@ let
in
stdenv.mkDerivation rec {
pname = "opencascade-occt";
version = "7.6.3";
version = "7.7.0";
commit = "V${builtins.replaceStrings ["."] ["_"] version}";

src = fetchurl {
name = "occt-${commit}.tar.gz";
url = "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=${commit};sf=tgz";
sha256 = "sha256-ZXkz6MLUMTRb+uyJNEmbzuOOR6JPqvSAJl9A6F2ExJw=";
hash = "sha256-aEWhf+X0CzaFpXG+l+VpZgXeI8x6vxD4pkTSFjcRxv8=";
};

nativeBuildInputs = [ cmake ninja ];
Expand All @@ -50,7 +50,7 @@ in
freetype
freeimage
fontconfig
tbb
tbb_2021_8
rapidjson
glew
] ++ vtk_9.buildInputs;
Expand Down
15 changes: 15 additions & 0 deletions expressions/py-overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
, nlopt_nonpython
, casadi_nonpython
, pybind11-stubgen-src
, build123d-src
}: self: super: rec {
clang = self.callPackage ./clang.nix {
src = llvm-src;
Expand Down Expand Up @@ -133,4 +134,18 @@
sha256 = "611bb273cd68f3b993fabdc4064fc858c5b47a973cb5aa7999ec1ba405c87cd7";
};
});

svgpathtools = super.buildPythonPackage rec {
pname = "svgpathtools";
version = "1.6.0";
src = super.python.pkgs.fetchPypi {
inherit pname version;
hash = "sha256-wLk07tKayusJmIr7TRXFmENmhHI24huAwHnY7bWsDE4=";
};
propagatedBuildInputs = with super.python.pkgs; [ numpy scipy svgwrite ];
};

build123d = self.callPackage ./build123d.nix {
src = build123d-src;
};
}
37 changes: 28 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
flake = false;
};
ocp-src = {
url = "github:cadquery/ocp";
url = "github:cadquery/ocp/7.7.0.0";
flake = false;
};
ocp-stubs-src = {
url = "github:cadquery/ocp-stubs";
url = "github:cadquery/ocp-stubs/7.7.0";
flake = false;
};
pywrap-src = {
Expand All @@ -32,6 +32,10 @@
url = "github:CadQuery/pybind11-stubgen";
flake = false;
};
build123d-src = {
url = "github:gumyr/build123d";
flake = false;
};
};

outputs = { self, nixpkgs, flake-utils, ... } @ inputs:
Expand All @@ -51,7 +55,7 @@
stdenv = pkgs.stdenv; # not currently used, can probably be removed unless I have to control GCC version again in the future
};
# I'm quite worried about how I handle this VTK. Python -> VTK (for Python bindings) -> OCCT -> Python(OCP)
new_vtk_9 = pkgs.libsForQt5.callPackage ./expressions/VTK { enablePython = true; pythonInterpreter = python; };
new_vtk_9 = pkgs.libsForQt5.callPackage ./expressions/VTK { enablePython = true; pythonInterpreter = python; ffmpeg = pkgs.ffmpeg_4; };
opencascade-occt = pkgs.callPackage ./expressions/opencascade-occt {
inherit (gccSet) stdenv;
vtk_9 = new_vtk_9;
Expand All @@ -70,7 +74,7 @@
};
py-overrides = import expressions/py-overrides.nix {
inherit gccSet;
inherit (inputs) llvm-src pywrap-src ocp-src ocp-stubs-src cadquery-src pybind11-stubgen-src;
inherit (inputs) llvm-src pywrap-src ocp-src ocp-stubs-src cadquery-src pybind11-stubgen-src build123d-src;
inherit (pkgs) fetchFromGitHub;
vtk_9_nonpython = new_vtk_9;
occt = opencascade-occt;
Expand Down Expand Up @@ -121,6 +125,7 @@
# ++ [ pytest ]
# ++ cadquery.nativeBuildInputs
# ));
build123d = python.withPackages ( ps: with ps; [ build123d ]);
inherit python opencascade-occt;
};

Expand Down