170.6. python3-pyuvula-1.1.0
UV unwrapping and projection for Cura's paint tool, with its Python module
| Version | 1.1.0, release 1 |
| Shelf | python-hw — python3-* hardware, serial, USB, instrument, CAN and device-protocol modules |
| Phase | 41_system (System), 877 of 1047 in build order |
| Licence | LGPL-3.0-only |
| Homepage | https://github.com/Ultimaker/libUvula |
| Build time | 0.3 SBU |
| Installed size | 390.2 KiB in 2 files |
| Recipe | ports/core/python-hw/python3-pyuvula/kpkgbuild |
About
libUvula unwraps a 3D model’s surface into UV coordinates and projects onto it; it is what Cura’s paint tool uses, through the pyUvula Python module this port builds. Only the module ships: the C++ library is built static and linked into it. uranium, Cura’s framework, depends on it too.
Sources
python3-pyuvula-1.1.0.tar.gz(813.5 KiB)
sha256fcc42f07eb14b84ccb2ae873917abdc181dfc8a0acefeb499243c85013704014
upstream: https://github.com/Ultimaker/libUvula/archive/1dca0afc6fd5b380285bbc6fdacb3831f1826976.tar.gz
archive copy: sources-4/python-hw--python3-pyuvula-1.1.0.tar.gzconan-ultimaker-index-c4077fc3e719b436d1cdc2032bf3f851b6f089bb.tar.gz(30.5 KiB)
sha256b35b9b112085c299ee5e9e5e15612e5e065d07220d0c9954b776b15cfa5095b5
upstream: https://github.com/Ultimaker/conan-ultimaker-index/archive/c4077fc3e719b436d1cdc2032bf3f851b6f089bb.tar.gz
archive copy: sources-2/fabrication--conan-ultimaker-index-c4077fc3e719b436d1cdc2032bf3f851b6f089bb.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, python3, python3-pybind11, spdlog, fmt, range-v3, polyclipping.
Required by (2): cura, uranium.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install python3-pyuvula'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/python-hw/python3-pyuvula.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/python-hw/python3-pyuvula
echo 'fcc42f07eb14b84ccb2ae873917abdc181dfc8a0acefeb499243c85013704014 python3-pyuvula-1.1.0.tar.gz' | sha256sum -c -
echo 'b35b9b112085c299ee5e9e5e15612e5e065d07220d0c9954b776b15cfa5095b5 conan-ultimaker-index-c4077fc3e719b436d1cdc2032bf3f851b6f089bb.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/python3-pyuvula
SRC=$SRC_ROOT/python3-pyuvula-1.1.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-pyuvula-1.1.0.tar.gz -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf conan-ultimaker-index-c4077fc3e719b436d1cdc2032bf3f851b6f089bb.tar.gz -C "$SRC_ROOT"
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers _commit, _index and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
_shim="$SRC_ROOT/shim"
mkdir -p "$_shim"
printf 'include("%s")\n' \
"$SRC_ROOT/conan-ultimaker-index-$_index/recipes/standardprojectsettings/all/StandardProjectSettings.cmake" \
> "$_shim/standardprojectsettings-config.cmake"
cat > "$_shim/clipper-config.cmake" <<'CMAKE'
find_package(PkgConfig REQUIRED)
pkg_check_modules(POLYCLIPPING REQUIRED IMPORTED_TARGET polyclipping)
if(NOT TARGET clipper::clipper)
add_library(clipper::clipper INTERFACE IMPORTED)
target_link_libraries(clipper::clipper INTERFACE PkgConfig::POLYCLIPPING)
endif()
CMAKE
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DUVULA_VERSION="$version" \
-DPYUVULA_VERSION="$version" \
-DWITH_PYTHON_BINDINGS=ON \
-DWITH_JS_BINDINGS=OFF \
-DWITH_CLI=OFF \
-DEXTENSIVE_WARNINGS=OFF \
-Dstandardprojectsettings_DIR="$_shim" \
-Dclipper_DIR="$_shim" \
-Dpybind11_DIR="$(python3 -m pybind11 --cmakedir)"
ninja -C build pyUvula
_site=$(python3 -c 'import sysconfig; print(sysconfig.get_path("platlib", vars={"platbase": "/usr", "base": "/usr"}))')
install -d "$PKG$_site"
install -m755 build/pyUvula/pyUvula*.so "$PKG$_site/"
The switches, and why each is set:
-Dstandardprojectsettings_DIR— Where CMake findsstandardprojectsettings, a package of compiler settings Ultimaker’s CMake files load and that only Conan’s Ultimaker index carries.build.shwrites a one-line config file in$SRC_ROOT/shimthat includesStandardProjectSettings.cmakefrom the index tarball, the recipe’s second source.-Dclipper_DIR— Where CMake findsclipper. The project links the polyclipping library asclipper::clipper, a target name only Conan’s recipe makes; the shim’sclipper-config.cmakedefines it from polyclipping’s pkg-config file. Nothing of the shim reaches the package.-DCMAKE_CXX_STANDARD=20— The C++ standard the project is written in, and the lowest its Conan recipe accepts. Upstream, Conan’s toolchain sets it; without the flag the compiler’s default applies.-DCMAKE_POSITION_INDEPENDENT_CODE=ON— Compile the staticlibuvulaas position-independent code, so it can be linked into the shared Python module.-DUVULA_VERSION— The library’s version, which configure stops without;-DPYUVULA_VERSIONsets the module’s, which otherwise reads1.0.0. Both are the port’s version.-DWITH_PYTHON_BINDINGS=ON— BuildpyUvula.-DWITH_JS_BINDINGS=OFFbuilds no Emscripten module, and-DWITH_CLI=OFFnouvulacommand, which would need assimp and cxxopts.-DEXTENSIVE_WARNINGS=OFF— Compile without upstream’s long warning set, which is on by default.-Dpybind11_DIR— pybind11’s CMake directory, asked of the installed python3-pybind11 withpython3 -m pybind11 --cmakedir.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/python3-pyuvula, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf python3-pyuvula-1.1.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/python3-pyuvula, and runs the triggers its paths call for.
Contents
Installed directories: /usr/share/licenses/python3-pyuvula.
Notes
The project has no install rules, because upstream’s Conan recipe copies the module itself, so build.sh builds only the pyUvula target and copies pyUvula*.so into the interpreter’s site-packages.