Re: [ITP] python-xlrd
Jon Turney via Cygwin-apps <[email protected]> Sun, 24 May 2026 16:20:37 +0100
| Newsgroups | gmane.os.cygwin.applications |
|---|---|
| Message-ID | <[email protected]> |
On 23/04/2026 15:06, Hamish McIntyre-Bhatty via Cygwin-apps wrote:
> On 20/04/2026 21:37, Brian Inglis via Cygwin-apps wrote:
>> On 2026-04-20 08:50, Hamish McIntyre-Bhatty via Cygwin-apps wrote:
>>> Hi all,
>>>
>>> xlrd (https://pypi.org/project/xlrd/) is an optional dependency of
>>> wxPython, which I maintain, and as such I'd like to package it for
>>> Cygwin.
>>>
[...]
>>
>
> Okay, no problem, cygport file attached.
> BUILD_REQUIRES="python39 python39-devel python39-setuptools python312 python312-devel python312-setuptools"
You can actually just write "python3 python3-devel python3-setuptools"
here, and there's some magic in scallywag which interprets those package
requirements in light of the current or default value of
PYTHON_WHEEL_VERSIONS.
> python_xlrd_common_REQUIRES="python39-xlrd python312-xlrd"
You can write this as
> for v in ${PYTHON_WHEEL_VERSIONS//:/ }
> do
> python_xlrd_common_REQUIRES+=" python${v}-xlrd"
> done
All that should hopefully give you a cygport where you only need to
change the upstream version number when rebuilding it, and everything
else automatically adapts to whatever the current version of python is.
But it's not ideal to make a python-xlrd-common package containing a
runxlrd.py script with a shebang which names /usr/bin/python, and then
have it depend on all the versions of the python3NN-xlrd package just so
it always works irrespective of which python version the /usr/bin/python
alternative symlink happens to points at.
Instead, it's better to pick one python version, and make it work using
that:
> inherit python3
>
> python_xlrd_common_REQUIRES="python${PYTHON3_PKGVERSION}-xlrd"
and then after the install
> python3_fix_shebang /usr/bin/runxlrd.py
Unfortunately for that last part, we don't (currently) have a way to
extend, hook, or subclass the src_install function, so you have to
reproduce the default and modify it to include that, e.g.
> src_install() {
> cd ${B}
> python3_wheel_install
>
> python3_fix_shebang /usr/bin/runxlrd.py
> }