# EVIDENCE BUILD -- Fedora's rawhide python-cascadio.spec (0.0.17, UNCHANGED version) plus TWO edits in # %prep for OpenCASCADE 8 (C++17, and one explicit include); see the comment at each. # # NOT cascadio 0.1.1: tags from 0.0.18rc0 onward (0.1.1 is current) call a PATCHED OpenCASCADE API -- # RWGltf_CafWriter::JsonPostProcessCallback/BinaryAppendCallback/SetFaceDataCallback, plus a "memfd # patch" -- that stock OpenCASCADE does not have, so they cannot build against a system copy at all, # on 7.9 or 8 (build 11080899: 21 errors in src/convert.hpp). 0.0.17 has 0 such references. Name: python-cascadio Version: 0.0.17 Release: %autorelease Summary: Convert STEP files to GLB using OpenCASCADE License: MIT URL: https://github.com/mikedh/cascadio # The PyPI project does not have sdists, so we must use the GitHub archive. Source: %{url}/archive/%{version}/cascadio-%{version}.tar.gz BuildSystem: pyproject BuildOption(generate_buildrequires): --extras tests # https://scikit-build-core.readthedocs.io/en/latest/configuration/index.html BuildOption(build): --config-settings cmake.define.SYSTEM_OPENCASCADE=ON BuildOption(build): --config-settings logging.level=INFO BuildOption(build): --config-settings build.verbose=true BuildOption(build): --config-settings cmake.build-type=RelWithDebInfo BuildOption(build): --config-settings install.strip=false BuildOption(install): --no-assert-license cascadio # Tests for cascadio fail on s390x, wrong endianness # https://github.com/mikedh/trimesh/issues/2251 # https://bugzilla.redhat.com/show_bug.cgi?id=2298452 # https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval ExcludeArch: %{ix86} s390x BuildRequires: gcc-c++ BuildRequires: cmake(OpenCASCADE) # RapidJSON headers are included indirectly via # opencascade/RWGltf_CafWriter.hxx, so the header-only library is compiled into # this extension and should technically be tracked even though it is an # indirect dependency. # https://docs.fedoraproject.org/en-US/packaging-guidelines/#_packaging_header_only_libraries BuildRequires: rapidjson-static %global common_description %{expand: A Python library which uses OpenCASCADE to convert STEP files to a GLB file which can quickly be loaded by trimesh and other libraries. This is not intended to be a full binding of OpenCASCADE like OCP or PythonOCC. Rather it is intended to be an easy minimal way to load boundary representation files into a triangulated scene in Python. There are a few options for loading STEP geometry in the open-source ecosystem: GMSH, FreeCAD, etc. However nearly all of them use OpenCASCADE under the hood as it is pretty much the only open-source BREP kernel.} %description %{common_description} %package -n python3-cascadio Summary: %{summary} %description -n python3-cascadio %{common_description} %prep -a # EVIDENCE-BUILD CHANGE (the only one): raise the C++ standard. OpenCASCADE 8 needs C++17 (its headers # use std::shared_mutex); cascadio 0.0.17 hardcodes `-std=c++11` at CMakeLists.txt:26, which gave 509 # errors inside OCCT's headers (mhough/opencascade8-rawhide build 11080660). The assertion makes the # edit fail loudly if the line ever changes, instead of silently doing nothing. grep -q -- '-std=c++11' CMakeLists.txt sed -i 's/-std=c++11/-std=c++17/' CMakeLists.txt grep -q -- '-std=c++17' CMakeLists.txt # EVIDENCE-BUILD CHANGE 2 of 2: OCCT 8 no longer pulls TColStd_IndexedDataMapOfStringString in through the # headers cascadio includes, so src/convert.hpp:83 and :151 fail with `was not declared in this scope` # (build 11081289). The alias header ships in both 7.9.3 and 8.0.1 (in 8.0 it is a deprecated typedef for # NCollection_IndexedDataMap), so including it explicitly # is portable across both versions. # src/convert.hpp has CRLF line endings, so every anchor tolerates a trailing carriage return -- a plain # `...hxx>$` anchor matches nothing under GNU grep/sed and would abort %prep (found by running these # lines against the real file with GNU tools; the first draft only passed under ugrep). grep -q '^#include [[:space:]]*$' src/convert.hpp sed -i 's|^\(#include \)\(\r\?\)$|\1\2\n#include \2|' src/convert.hpp grep -q '^#include [[:space:]]*$' src/convert.hpp # The CMake scripts shipped with the system VTK try to find HDF5 by compiling # and linking a C program; we need to enable the C language in the top-level # project in order for this to work. sed --regexp-extended --in-place 's/\bCXX\b/C &/' CMakeLists.txt %check -a %pytest %files -n python3-cascadio -f %{pyproject_files} # We include only the license for the actual package, omitting # LICENSE/LICENSE-opencascade.md (for the opencascade library that is bundled # in PyPI wheels) and LICENSE/README.md (which explains the difference). %license LICENSE/LICENSE-cascadio.md %doc README.md %changelog %autochangelog