Page MenuHomeDevCentral

Provide wheel Python package for ruamel.yaml.clib in /opt/python
Open, HighPublic

Description

As ruamel.yaml.clib can't be built with clang as is, and as the author ignores the patch, we can provide a .whl package to allow users to install that Python package in their virtual environments.

Event Timeline

dereckson added a project: Servers.
dereckson added a subscriber: dereckson.

The .whl is built by the port. From there we can copy it to /opt/python/py<version>:

1#!/bin/sh
2
3# -------------------------------------------------------------
4# Build and provision .whl for ruamel.yaml.clib
5# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6# Project: Nasqueron
7# License: BSD-2-Clause
8# -------------------------------------------------------------
9
10set -e
11
12PORTS_DIR=/usr/ports/devel/py-ruamel.yaml.clib
13TARGET_DIR=/opt/python
14
15# -------------------------------------------------------------
16# Ensure user is root
17#
18# Note: POSIX shells don't always define $UID or $EUID.
19# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20
21if [ "${EUID:-$(id -u)}" -ne 0 ]; then
22 echo "This command must be run as root." >&2
23 exit 1
24fi
25
26# -------------------------------------------------------------
27# Build
28# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29
30cd $PORTS_DIR
31make stage
32
33PYTHON_SUFFIX=$(make -V PYTHON_SUFFIX)
34
35find work-py$PYTHON_SUFFIX -name '*.whl' | xargs -I {} cp {} /opt/python/py$PYTHON_SUFFIX/

It's possible to build it for several Python version, by defining DEFAULT_VERSIONS:

$ export DEFAULT_VERSIONS="python=3.12 python3=3.12"

To build a list of C Python packages for a list of version, loop on version and ports dir: as long as the port uses wheel installation, this is reusable.

dereckson triaged this task as High priority.Oct 17 2024, 22:10

High as one of the main use of WindRiver is to craft commits for rOPS, and this library is a dependency of pre-commit.