Re: [ITP] python-pybind11
Hamish McIntyre-Bhatty via Cygwin-apps <[email protected]> Tue, 31 Mar 2026 16:16:52 +0100
| Newsgroups | gmane.os.cygwin.applications |
|---|---|
| Message-ID | <[email protected]> |
On 20/03/2026 16:23, Hamish McIntyre-Bhatty via Cygwin-apps wrote:
> On 17/03/2026 16:31, Jon Turney wrote:
>> On 15/03/2026 16:57, Hamish McIntyre-Bhatty via Cygwin-apps wrote:
>>> On 15/03/2026 16:41, Jon Turney wrote:
>>>> On 15/03/2026 15:52, Hamish McIntyre-Bhatty via Cygwin-apps wrote:
>>>>> Hi all,
>>>>>
>>>>> pybind11 (https://pypi.org/project/pybind11/) is a dependency of
>>>>> recent versions of python-imaging (a package I already maintain),
>>>>> and as such I'd like to package it for Cygwin.
>>>>>
>>>>> The Cygport file is available at: https://gitlab.com/hamishmb/
>>>>> cygwin- python-pybind11.
>>>>>
>>>>> pybind11 is in Debian: https://packages.debian.org/trixie/python3-
>>>>> pybind11
>>>>
>>>> Thanks! I added this to your packages.
>>> Thank you!
>>>>
>>>> A few small comments on the cygport:
>>
>> Oh, I also meant to say:
>>
>>> SRC_URI="https://files.pythonhosted.org/packages/
>>> a5/98/9118a0659646f1628c592ef9bb48e0056efa6bf27c951fd12a178e0136fb/
>>> pybind11-3.0.2.tar.gz"
>>> SRC_DIR="pybind11-${VERSION}"
>>
>> I think these lines are unneeded, since cygport already understands
>> how to fetch and unpack packages from pypi.
>>
> Just confirmed that it works without them, so I have updated it.
>>>> > PYTHON_WHEEL_VERSIONS="3.9:3.12"
>>>>
>>>> This is the default, and leaving it implicit will avoid the need to
>>>> change it in future.
>>> Thanks, I didn't know I could leave that out, I shall amend it.
>>>>
>>>>> PKG_NAMES="python-pybind11-common python39-pybind11 python312-
>>>>> pybind11"
>>>> [...]
>>>>> python39_pybind11_REQUIRES="python39"
>>>>> python312_pybind11_REQUIRES="python312"
>>>>
>>>> You can write this as (something like):
>>>>
>>>>> PKG_NAMES="python-pybind11-common"
>>>>>
>>>>> for v in ${PYTHON_WHEEL_VERSIONS//:/ }
>>>>> do
>>>>> PKG_NAMES+=" python${v/./}"
>>>>> declare python${v/./}_REQUIRES+="python${v}"
>>>>> done
>>>>
>>> Good to know, but that is less clear to me, personally, probably
>>> because I'm not all that familiar with shell scripting.
>>
>> Fair enough.
>>
>>>> I'm not sure about this part:
>>>>
>>>>> python_pybind11_common_REQUIRES="python39-pybind11 python312-pybind11"
>>>>> python_pybind11_common_CONTENTS="
>>>>> usr/bin/
>>>>> "
>>>>
>>>> Maybe the name should just be python-pybind11, or even pybind11, if
>>>> it installs a tool of that name?
>>> It install pybind11-config, so perhaps yes.
>>>>
>>>> I'm not sure about the arrangement of depending on python3{9,12}-
>>>> pybind11 (and thus pulling in *both* python39 and python312) to
>>>> ensure that the script works irrespective of what /usr/bin/python
>>>> currently is).
>>>>
>>>> (In fact, because python-wheel installs /usr/bin/pybind11-config for
>>>> each python version, we might well end up with it containing an
>>>> explicitly versioned shebang for the last one it made, anyhow)
>>> You're probably right.
>>>>
>>>>
>>>> So, all in all, maybe it makes more sense to build this with the
>>>> python3-wheel cygclass? (which only builds the package for a single
>>>> version of python, the default, which is 3.9 currently) - especially
>>>> if the primary way to use this is via the script, and the python
>>>> module isn't expected to be used elsewhere.
>>>
>>> The python module gets imported when used by other modules like
>>> python- imaging, so I don't think that would work, and we do need to
>>> build for both Python 3.9 and 3.12, unless due to it being a pure-
>>> python module, the module is compatible with both? The build times
>>> are very short anyway, so I don't thinks that's too much of a concern?
>>
>> In that case, maybe just forget about python_pybind11_common and
>> simply write:
>>> python312_pybind11_CONTENTS+=" /usr/bin/pybind11-config"
>>
>> This tool seems quite dangerous to use: notably, if '--includes'
>> really gives you the flags for including python headers, it seems like
>> pot-luck which python version they will be for, and there's no way to
>> make that match the version you are actually building for...
>
> Re-sending this as I forgot to send it to the list.
>
> That's a good point. I'm pretty sure Python 3.12 is build last, so it
> should be for that. However, maybe I could do a patch that versions it
> or copies it to pybind11-config to pybind11-config-3.9 and pybind11-
> config-3.12, prior to building the next package, similar to how wxrc is
> versioned in the wxWidgets package I maintain?
>
> Best,
>
> Hamish
>
I've realised that one of the dependencies no longer supports Python
3.9, hence I have solved this problem, at least until a newer version of
Python is added to Cygwin, by only building a package for Python 3.12.
Best,
Hamish