You are not logged in.
Hello, I am trying to write a PKGBUILD for a python package called faster_whisper. I read this [guide](https://wiki.archlinux.org/title/Python … guidelines) and wrote a PKGBUILD:
```
# Maintainer: You (replace with your name and email)
pkgname=python-faster-whisper
_name=${pkgname#python-}
pkgver=1.0.3
pkgrel=1
arch=(any)
url="https://github.com/SYSTRAN/faster-whisper"
license=('MIT')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-setuptools')
depends=('python-av' 'python-ctranslate2' 'python-huggingface-hub' 'python-tokenizers' 'python-onnxruntime')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name//-/_}/${_name//-/_}-$pkgver.tar.gz")
build() {
cd $_pkgname-$pkgver
python -m build --wheel --no-isolation
}
package() {
cd $_pkgname-$pkgver
python -m installer --destdir="$pkgdir" dist/*.whl
}
```
But when I try to `makepkg -si`, it complained that the 404 error. And I check [the download page](https://pypi.org/project/faster-whisper/#files) and find the URL of source is `https://files.pythonhosted.org/packages/1e/f2/77437ee937233d6e8259e3df511a4662cd7e833dabeaaddbfc929d2a3ed5/faster-whisper-1.0.3.tar.gz`.
And I looked into many PKGBUILD and found out they almost use git source instead. I am confused.
Last edited by acgtyrant (2024-07-05 14:45:46)
I use Arch Linux.
Offline
when I try to `makepkg -si`, it complained that the 404 error. And I check [the download page](https://pypi.org/project/faster-whisper/#files) and find the URL of source is `https://files.pythonhosted.org/packages/1e/f2/77437ee937233d6e8259e3df511a4662cd7e833dabeaaddbfc929d2a3ed5/faster-whisper-1.0.3.tar.gz`.
Yes, and? The url your PKGBUILD is trying to download is https://files.pythonhosted.org/packages … 0.3.tar.gz which is not valid.
So what's the question? You need to put the proper url in the source field: either from PyPi, or from the github repo here: https://github.com/SYSTRAN/faster-whisper.git
Last edited by Trilby (2024-07-05 12:35:57)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
And I check [the download page](https://pypi.org/project/faster-whisper/#files) and find the URL of source is `https://files.pythonhosted.org/packages/1e/f2/77437ee937233d6e8259e3df511a4662cd7e833dabeaaddbfc929d2a3ed5/faster-whisper-1.0.3.tar.gz`.
You PKGBUILD generates
source=('https://files.pythonhosted.org/packages/source/f/faster_whisper/faster_whisper-1.0.3.tar.gz')
which is quite different to the URL you want...
Edit: Trilby beat me because I took ages to reply due to the internet being distracting!
Offline
The guide says:
Download URLs linked from the PyPI website include an unpredictable hash that needs to be fetched from the PyPI website each time a package must be updated. This makes them unsuitable for use in a PKGBUILD. PyPI provides an alternative stable scheme: PKGBUILD#source source=() array should use the following URL templates:
Source package
https://files.pythonhosted.org/packages/source/${_name::1}/${_name//-/_}/${_name//-/_}-$pkgver.tar.gz
And I wrote the URL exactly as the guide says. So is the wiki out-of-date?
Last edited by acgtyrant (2024-07-05 13:17:02)
I use Arch Linux.
Offline
So is the wiki out-of-date?
That specific guideline was never "in date". It was - at best - an unreliable hack that may have worked by coincidence at some random time in the past, but it was never a supported or advisable approach. That same section links to the RFC that notes that any such attempts will be unreliable. Use the upstream git source, e.g. for a versioned tagged release:
source=("${url}/archive/refs/tags/v${pkgver}.tar.gz")
The cheese shop can move their cheese at any time they want. If you don't use their public urls or apis do not expect it to be reliable.
EDIT: and the link for the alleged claim that Pypi supports these links is to a non-pypi github discussion from 8 years ago in which the urls were even failing at that time and the whole url scheme documented there was called a "train wreck".
Last edited by Trilby (2024-07-05 14:18:59)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
@Trilby Thank you. I try to find out what the best source scheme is.
I use Arch Linux.
Offline
Uh ... "try"? You shouldn't need to try too hard, I posted it.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline