[Bug 263580] net/py-pyzmq: Builds with Cython when it is installed

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 26 Apr 2022 23:58:57 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263580

Kubilay Kocak <koobs@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|net/py-pyzmq: add           |net/py-pyzmq: Builds with
                   |dependency on cython        |Cython when it is installed
                 CC|                            |python@FreeBSD.org
             Status|New                         |Open

--- Comment #2 from Kubilay Kocak <koobs@FreeBSD.org> ---
The upstream sdist (PyPI tarball creation) process has a process for checking
and ensuring cython files are compiled to C files prior to upload:

class CheckSDist(sdist):
    """Custom sdist that ensures Cython has compiled all pyx files to c."""

Unfortunately the check for Cython is not made conditional:

try:
    import Cython

However later in the setup.py, the following only adds (registers) and actual
cython dependency if socket.c doesnt exist (indicating cython sources havent
been compiled)

if not os.path.exists(os.path.join("zmq", "backend", "cython", "socket.c")):
    # this generally means pip install from git
    # which requires Cython
    setup_args.setdefault("setup_requires", []).append(
        f"cython>={min_cython_version}

Adding a cython dependency to the port is spurious, and a better approach is
either:

1) merge/move the import line to within the source file check, so both the try
import and the registration are conditional, and send upstream, OR

2) hack: remove the try/import/exception block.

As far as Python version support goes, the standard is to declare version
support against the versions upstream CI's and passes tests against. If they
are testing with Cython builds, that means their sdist pipeline is untested,
which is problematic and should be reported too.

-- 
You are receiving this mail because:
You are on the CC list for the bug.