From e583114ac4e84312e06427041f45b7d982097dd6 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 26 Jun 2026 12:04:24 +0200 Subject: mkwheels: add script skeleton with arg parse and tool checks --- mkwheels | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 mkwheels diff --git a/mkwheels b/mkwheels new file mode 100755 index 0000000..1692842 --- /dev/null +++ b/mkwheels @@ -0,0 +1,57 @@ +#!/bin/bash +# mkwheels — build a reproducible, pinned Python wheels tarball for a package. +# +# Copyright (C) 2026 Danilo M. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +set -eu + +usage() { + cat < [epoch] + +Build a reproducible pinned Python wheels tarball -wheels-.tar.gz +plus a hashed requirements.txt, for vendoring into a SlackBuild. + + PyPI package name and exact version to vendor. + [epoch] SOURCE_DATE_EPOCH for the tarball mtime. Omitted -> auto-derived + from the PyPI release upload time (a warning is printed). + + OUTPUT env var: output directory (default: current dir). + +Requires: python3+pip, jq, curl, tar, gzip, md5sum. +EOF +} + +case "${1:-}" in + -h|--help) usage; exit 0 ;; +esac +[ $# -ge 2 ] && [ $# -le 3 ] || { usage >&2; exit 2; } + +pkg=$1 +ver=$2 +epoch=${3:-} +OUTPUT=${OUTPUT:-$PWD} + +# Check required tools up front. +for tool in python3 jq curl tar gzip md5sum; do + command -v "$tool" >/dev/null 2>&1 || { + echo "error: required tool not found: $tool" >&2 + exit 1 + } +done +python3 -m pip --version >/dev/null 2>&1 || { + echo "error: python3 pip module not available" >&2 + exit 1 +} + +echo "mkwheels: $pkg $ver -> $OUTPUT/$pkg-wheels-$ver.tar.gz" -- cgit v1.2.3