-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
python3Packages.build123d: init at 0.10.0 #433247
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
Open
tnytown
wants to merge
8
commits into
NixOS:master
Choose a base branch
from
tnytown:tnytown/build123d-0.9.1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0ac0223
maintainers: add tnytown
tnytown 7525696
python3Packages.trianglesolver: init at 1.2
tnytown e639fdf
python3Packages.lib3mf: init at 2.4.1.post1
tnytown 6a60f5a
opencascade-occt_7_8_1: init
tnytown 5a204b9
python3Packages.cadquery-ocp: init at 7.8.1.2
tnytown d1f57db
python3Packages.ocpsvg: init at 0.5.0
tnytown 6e89822
ocp-gordon: init at 0.1.18
tnytown a45624c
python3Packages.build123d: init at 0.10.0
tnytown File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| { | ||
| lib, | ||
| buildPythonPackage, | ||
| fetchFromGitHub, | ||
| pytestCheckHook, | ||
| setuptools-scm, | ||
| anytree, | ||
| ezdxf, | ||
| ipython, | ||
| numpy, | ||
| cadquery-ocp, | ||
| ocpsvg, | ||
| ocp-gordon, | ||
| lib3mf, | ||
| sympy, | ||
| scipy, | ||
| svgpathtools, | ||
| trianglesolver, | ||
| webcolors, | ||
| }: | ||
| let | ||
| pname = "build123d"; | ||
| version = "0.10.0"; | ||
| src = fetchFromGitHub { | ||
| owner = "gumyr"; | ||
| repo = "build123d"; | ||
| tag = "v${version}"; | ||
| hash = "sha256-EhV6/ZTBp9XxWY1CgNKESikgTnAk9xaF0g/bYEQPf20="; | ||
| }; | ||
| in | ||
| buildPythonPackage { | ||
| inherit src pname version; | ||
| pyproject = true; | ||
|
|
||
| build-system = [ setuptools-scm ]; | ||
|
|
||
| dependencies = [ | ||
| anytree | ||
| ezdxf | ||
| ipython | ||
| numpy | ||
| cadquery-ocp | ||
| ocpsvg | ||
| ocp-gordon | ||
| lib3mf | ||
| scipy | ||
| sympy | ||
| svgpathtools | ||
| trianglesolver | ||
| webcolors | ||
| ]; | ||
|
|
||
| pythonRelaxDeps = [ | ||
| "ipython" | ||
| "webcolors" | ||
| ]; | ||
|
|
||
| nativeCheckInputs = [ | ||
| pytestCheckHook | ||
| ]; | ||
|
|
||
| disabledTests = [ | ||
| # These attempt to access the network | ||
| "test_assembly_with_oriented_parts" | ||
| "test_move_single_object" | ||
| "test_single_label_color" | ||
| "test_single_object" | ||
| ]; | ||
|
|
||
| meta = { | ||
| description = "python CAD programming library"; | ||
| homepage = "https://github.com/gumyr/build123d"; | ||
| license = lib.licenses.asl20; | ||
| maintainers = with lib.maintainers; [ tnytown ]; | ||
| }; | ||
| } |
126 changes: 126 additions & 0 deletions
126
pkgs/development/python-modules/cadquery-ocp/cmake-fixes-7_9.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| index d0065b17..2cf2d390 100644 | ||
| --- a/CMakeLists.txt | ||
| +++ b/CMakeLists.txt | ||
| @@ -15,7 +15,9 @@ find_package( VTK REQUIRED | ||
| CommonExecutionModel | ||
| freetype | ||
| ) | ||
| + | ||
| message(STATUS "VTK ${VTK_VERSION} found") | ||
| + | ||
| find_package( RapidJSON REQUIRED ) | ||
| find_package( Clang REQUIRED ) | ||
|
|
||
| @@ -23,24 +25,33 @@ set( Python_FIND_VIRTUALENV FIRST ) | ||
| find_package( Python 3.9 COMPONENTS Interpreter Development REQUIRED ) | ||
|
|
||
| # find OCCT and dump symbols | ||
| -find_package( OpenCASCADE REQUIRED ) | ||
| +if(OCCT_LIB_DIR) | ||
| + file(GLOB occt_libs LIST_DIRECTORIES false ${OCCT_LIB_DIR} ) | ||
| +else() | ||
| + find_package( OpenCASCADE REQUIRED ) | ||
|
|
||
| -foreach(target ${OpenCASCADE_LIBRARIES} ) | ||
| - get_target_property(loc ${target} IMPORTED_LOCATION_RELEASE) | ||
| - list( APPEND occt_libs ${loc} ) | ||
| -endforeach() | ||
| + foreach(target ${OpenCASCADE_LIBRARIES} ) | ||
| + get_target_property(loc ${target} IMPORTED_LOCATION_RELEASE) | ||
| + list( APPEND occt_libs ${loc} ) | ||
| + endforeach() | ||
| +endif() | ||
|
|
||
| execute_process( | ||
| COMMAND | ||
| ${Python_EXECUTABLE} | ||
| - dump_symbols.py | ||
| + ${CMAKE_SOURCE_DIR}/dump_symbols.py | ||
| "${occt_libs}" | ||
| - ) | ||
| - | ||
| + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
| +) | ||
|
|
||
| get_target_property( LIBCLANG_PATH libclang IMPORTED_LOCATION_RELEASE ) | ||
| get_target_property( VTK_INCLUDE_DIR VTK::CommonCore INTERFACE_INCLUDE_DIRECTORIES ) | ||
|
|
||
| +# for some reason I get multiple generator expressions | ||
| +string(REPLACE ">" ">;" VTK_INCLUDE_DIR ${VTK_INCLUDE_DIR}) | ||
| +list(GET VTK_INCLUDE_DIR 0 VTK_INCLUDE_DIR) | ||
| + | ||
| +message( STATUS "Include dirs: ${VTK_INCLUDE_DIR}") | ||
| message( STATUS "Include dirs: ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}") | ||
|
|
||
| if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | ||
| @@ -51,38 +62,40 @@ else() | ||
| list( APPEND CXX_INCLUDES -i /opt/usr/local/include/c++/v1/ -i /opt/usr/local/include/ ) | ||
| endif() | ||
|
|
||
| -if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | ||
| - set(PLATFORM Windows) | ||
| -elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | ||
| - set(PLATFORM OSX) | ||
| +if(PLATFORM) | ||
| + message( STATUS "Requested platform: ${PLATFORM}") | ||
| else() | ||
| - set(PLATFORM Linux) | ||
| + message( STATUS "Platform not specified.") | ||
| + | ||
| + if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | ||
| + set(PLATFORM Windows) | ||
| + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | ||
| + set(PLATFORM OSX) | ||
| + else() | ||
| + set(PLATFORM Linux) | ||
| + endif() | ||
| endif() | ||
|
|
||
| set(ENV{PYTHONPATH} ${CMAKE_SOURCE_DIR}/pywrap ) | ||
|
|
||
| -if( NOT EXISTS ${CMAKE_SOURCE_DIR}/OCP ) | ||
| - message( STATUS "Running pywrap") | ||
| - execute_process( | ||
| - COMMAND | ||
| - ${Python_EXECUTABLE} | ||
| - -m bindgen | ||
| - -n ${N_PROC} | ||
| - -l ${LIBCLANG_PATH} | ||
| - -i ${CLANG_INCLUDE_DIRS}/ | ||
| - -i ${VTK_INCLUDE_DIR}/ | ||
| - -i ${CLANG_INSTALL_PREFIX}/lib/clang/${LLVM_VERSION}/include/ | ||
| - ${CXX_INCLUDES} | ||
| - all ocp.toml ${PLATFORM} | ||
| - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
| - COMMAND_ECHO STDOUT | ||
| - RESULT_VARIABLE PYWRAP_RESULT | ||
| - ) | ||
| - | ||
| - if( ${PYWRAP_RESULT} GREATER 0) | ||
| - message(FATAL_ERROR "Pywrap call failed") | ||
| - endif() | ||
| - | ||
| -endif() | ||
| +add_custom_command( | ||
| + OUTPUT ${CMAKE_SOURCE_DIR}/OCP/CMakeLists.txt | ||
| + COMMAND | ||
| + ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_SOURCE_DIR}/pywrap" | ||
| + ${Python_EXECUTABLE} | ||
| + -m bindgen | ||
| + -n ${N_PROC} | ||
| + -l ${LIBCLANG_PATH} | ||
| + -i ${CLANG_INCLUDE_DIRS}/ | ||
| + -i ${VTK_INCLUDE_DIR}/ | ||
| + -i ${CLANG_INSTALL_PREFIX}/lib/clang/${LLVM_VERSION_MAJOR}/include/ | ||
| + -p ${CMAKE_SOURCE_DIR} | ||
| + ${CXX_INCLUDES} | ||
| + all ${CMAKE_SOURCE_DIR}/ocp.toml ${PLATFORM} | ||
| + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
| + DEPENDS ${CMAKE_SOURCE_DIR}/ocp.toml | ||
| + USES_TERMINAL | ||
| + COMMENT "Running pywrap" | ||
| +) | ||
|
|
||
| -add_subdirectory( ${CMAKE_SOURCE_DIR}/OCP ) | ||
| +add_custom_target(pywrap ALL DEPENDS ${CMAKE_SOURCE_DIR}/OCP/CMakeLists.txt) |
30 changes: 30 additions & 0 deletions
30
pkgs/development/python-modules/cadquery-ocp/cmake-implicit-includes-darwin.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| index 2cf2d390..691fe54c 100644 | ||
| --- a/CMakeLists.txt | ||
| +++ b/CMakeLists.txt | ||
| @@ -54,13 +54,9 @@ list(GET VTK_INCLUDE_DIR 0 VTK_INCLUDE_DIR) | ||
| message( STATUS "Include dirs: ${VTK_INCLUDE_DIR}") | ||
| message( STATUS "Include dirs: ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}") | ||
|
|
||
| -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | ||
| - foreach( inc IN LISTS CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES) | ||
| - list( APPEND CXX_INCLUDES -i ${inc}/ ) | ||
| - endforeach() | ||
| -else() | ||
| - list( APPEND CXX_INCLUDES -i /opt/usr/local/include/c++/v1/ -i /opt/usr/local/include/ ) | ||
| -endif() | ||
| +foreach( inc IN LISTS CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES) | ||
| + list( APPEND CXX_INCLUDES -i ${inc}/ ) | ||
| +endforeach() | ||
|
|
||
| if(PLATFORM) | ||
| message( STATUS "Requested platform: ${PLATFORM}") | ||
| @@ -86,8 +82,6 @@ add_custom_command( | ||
| -m bindgen | ||
| -n ${N_PROC} | ||
| -l ${LIBCLANG_PATH} | ||
| - -i ${CLANG_INCLUDE_DIRS}/ | ||
| -i ${VTK_INCLUDE_DIR}/ | ||
| - -i ${CLANG_INSTALL_PREFIX}/lib/clang/${LLVM_VERSION_MAJOR}/include/ | ||
| -p ${CMAKE_SOURCE_DIR} | ||
| ${CXX_INCLUDES} |
104 changes: 104 additions & 0 deletions
104
pkgs/development/python-modules/cadquery-ocp/default.nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| { | ||
| lib, | ||
| stdenv, | ||
| fetchFromGitHub, | ||
| callPackage, | ||
|
|
||
| mkPythonMetaPackage, | ||
| python, | ||
| pythonImportsCheckHook, | ||
| toPythonModule, | ||
|
|
||
| llvmPackages_20, | ||
| cmake, | ||
| ninja, | ||
| yj, | ||
|
|
||
| apple-sdk, | ||
| pybind11, | ||
| vtk, | ||
| }: | ||
|
|
||
| let | ||
| # Upstream requires a minimum of LLVM 20. | ||
| llvmPackages = llvmPackages_20; | ||
|
|
||
| # On Linux, we need to use a non-libcxx stdenv as we are compiling against | ||
| # libraries built with libstdc++. On the other hand, the ocp-sources | ||
| # derivation requires libcxx for unknowable reasons. | ||
| stdenv = llvmPackages.stdenv; | ||
|
|
||
| pythonBuildEnv = python.withPackages ( | ||
| ps: with ps; [ | ||
| click | ||
| lief | ||
| path | ||
| (libclang.override { inherit llvmPackages; }) | ||
| toml | ||
| pandas | ||
| joblib | ||
| tqdm | ||
| jinja2 | ||
| toposort | ||
| logzero | ||
| pyparsing | ||
| pybind11 | ||
| schema | ||
| ] | ||
| ); | ||
|
|
||
| ocp-sources = callPackage ./ocp-sources.nix { inherit llvmPackages pythonBuildEnv; }; | ||
| inherit (ocp-sources) version; | ||
| in | ||
| toPythonModule ( | ||
| stdenv.mkDerivation (finalAttrs: { | ||
| pname = "cadquery-ocp"; | ||
| inherit version; | ||
| src = ocp-sources; | ||
|
|
||
| nativeBuildInputs = | ||
| ocp-sources.nativeBuildInputs | ||
| ++ lib.optional (stdenv.buildPlatform == stdenv.hostPlatform) pythonImportsCheckHook; | ||
| inherit (ocp-sources) buildInputs; | ||
|
|
||
| propagatedBuildInputs = [ | ||
| (mkPythonMetaPackage { | ||
| inherit (finalAttrs) pname version meta; | ||
| dependencies = [ vtk ]; | ||
| }) | ||
| ]; | ||
|
|
||
| env = { | ||
| NIX_CFLAGS_COMPILE = "-Wno-deprecated-declarations"; | ||
| }; | ||
|
|
||
| cmakeFlags = [ (lib.cmakeFeature "Python_ROOT_DIR" "${pythonBuildEnv}") ]; | ||
|
|
||
| separateDebugInfo = true; | ||
|
|
||
| installPhase = | ||
| let | ||
| destDir = "$out/${python.sitePackages}"; | ||
| in | ||
| '' | ||
| runHook preInstall | ||
|
|
||
| mkdir -p ${destDir} | ||
| cp ./*.so ${destDir} | ||
|
|
||
| runHook postInstall | ||
| ''; | ||
|
|
||
| pythonImportsCheck = [ | ||
| "OCP" | ||
| "OCP.gp" | ||
| ]; | ||
|
|
||
| meta = { | ||
| description = "Python wrapper for OCCT generated using pywrap"; | ||
| homepage = "https://github.com/CadQuery/OCP"; | ||
| license = lib.licenses.asl20; | ||
| maintainers = with lib.maintainers; [ tnytown ]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe add to not block upgrade of opencascade-occt |
||
| }; | ||
| }) | ||
| ) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this separateDebugInfo used for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point I was getting instability in the bindings due to bad codegen, the debug info helped to troubleshoot. I can remove this now that we're no longer encountering those issues, if you'd like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious to know the effect. You can keep or drop it as your wish, since you are also the end user that use cadquery-ocp.