• Re: Issues building the package 'python-asyncmy'

    From Carsten Schoenert@21:1/5 to All on Fri Oct 11 13:30:02 2024
    Hello,

    Kathara and I still try to get this package build.

    Am 19.08.24 um 23:01 schrieb Kathara Sasikumar:
    Hellooo Python Team!

    I was trying to package 'python-asyncmy',
    Upstream: https://github.com/long2ice/asyncmy

    This is my current working Salsa repo : https://salsa.debian.org/kathara/python-asyncmy

    There's no ITP yet. While building this package within the chroot, I got
    this error message:

    root@ivy:/build/python-asyncmy-0.2.9# pybuild --build -i python{version} -p 3.12 -v
    D: pybuild pybuild:602: version: 6.20240603
    D: pybuild pybuild:603: ['/usr/bin/pybuild', '--build', '-i', 'python{version}', '-p', '3.12', '-v']
    D: pybuild pybuild:39: cfg: Namespace(verbose=True, quiet=False, really_quiet=False, detect_only=False, clean_only=False, configure_only=False, build_only=True, install_only=False, test_only=False, autopkgtest_only=False, list_systems=False, print_
    args=None, before_clean=None, clean_args=None, after_clean=None, before_configure=None, configure_args=None, after_configure=None, before_build=None, build_args=None, after_build=None, before_install=None, install_args=None, after_install=None, before_
    test=None, test_args=None, after_test=None, test_nose=False, test_nose2=False, test_pytest=False, test_tox=False, test_stestr=False, test_custom=False, dir='/build/python-asyncmy-0.2.9', destdir='debian/tmp', ext_destdir=None, ext_pattern='\\.so(\\.[^/]*)
    ?$', ext_sub_pattern=None, ext_sub_repl=None, install_dir=None, name=None, system=None, versions=['3.12'], interpreter=['python{version}'], disable=None, custom_tests=False)
    D: pybuild __init__:37: cannot initialize 'cmake' plugin: Missing command 'cmake'
    D: pybuild __init__:37: cannot initialize 'meson' plugin: Missing command 'meson'
    D: pybuild tools:231: invoking: /usr/bin/dpkg-architecture
    D: pybuild debhelper:174: source=python-asyncmy, binary packages=['python3-asyncmy']
    D: pybuild pybuild:151: detected build system: pyproject (certainty: 99%)
    I: pybuild plugin_pyproject:129: Building wheel for python3.12 with "build" module
    I: pybuild base:311: python3.12 -m build --skip-dependency-check --no-isolation --wheel --outdir /build/python-asyncmy-0.2.9/.pybuild/cpython3_3.12
    D: pybuild tools:231: invoking: python3.12 -m build --skip-dependency-check --no-isolation --wheel --outdir /build/python-asyncmy-0.2.9/.pybuild/cpython3_3.12
    I: pybuild plugin_pyproject:144: Unpacking wheel built for python3.12 with "installer" module
    E: pybuild pybuild:389: build: plugin pyproject failed with: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'
    Traceback (most recent call last):
    File "/usr/bin/pybuild", line 387, in main
    run(func, i, version, c)
    File "/usr/bin/pybuild", line 325, in run
    result = func(context, args)
    ^^^^^^^^^^^^^^^^^^^
    File "/usr/share/dh-python/dhpython/build/plugin_pyproject.py", line 109, in build
    self.unpack_wheel(context, args)
    File "/usr/share/dh-python/dhpython/build/plugin_pyproject.py", line 166, in unpack_wheel
    wheel = Path(self.built_wheel(context, args))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.12/pathlib.py", line 1164, in __init__
    super().__init__(*args)
    File "/usr/lib/python3.12/pathlib.py", line 373, in __init__
    raise TypeError(
    TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'
    root@ivy:/build/python-asyncmy-0.2.9#

    I've dived a bit into the sources and the build process to find out what
    is going wrong in a first place.

    It turned out that simply there is no wheel that could be used at this
    stage. So the seen output is happen because no wheel was build by dh-python.

    The code in function built_wheel() in build/base.py is returning None in
    case no wheel could be found:

    https://salsa.debian.org/python-team/tools/dh-python/-/blob/master/dhpython/build/base.py?ref_type=heads#L302

    But in unpack_wheel() in build/plugin_pyproject.py there isn't doing a
    check if the call of wheel = Path(self.built_wheel(context, args)) could
    be ever successful. It is assumed there is a wheel found.

    https://salsa.debian.org/python-team/tools/dh-python/-/blob/master/dhpython/build/plugin_pyproject.py?ref_type=heads#L166

    So I think this needs a better catching if no wheels where build or
    found. I did hack for now this, but probably it's better to raise the
    Exception in build/base.py already?

    $ git diff
    diff --git a/dhpython/build/plugin_pyproject.py b/dhpython/build/plugin_pyproject.py
    index 314f3c4..1791aa7 100644
    --- a/dhpython/build/plugin_pyproject.py
    +++ b/dhpython/build/plugin_pyproject.py
    @@ -163,16 +163,19 @@ class BuildSystem(Base):
    script_kind='posix',
    )

    - wheel = Path(self.built_wheel(context, args))
    - if wheel.name.startswith('UNKNOWN'):
    - raise Exception(f'UNKNOWN wheel found: {wheel.name}. Does '
    - 'pyproject.toml specify a build-backend?')
    - with WheelFile.open(wheel) as source:
    - install(
    - source=source,
    - destination=destination,
    - additional_metadata={},
    - )
    + if self.built_wheel(context, args) is not None:
    + wheel = Path(self.built_wheel(context, args))
    + if wheel.name.startswith('UNKNOWN'):
    + raise Exception(f'UNKNOWN wheel found: {wheel.name}. Does ' + 'pyproject.toml specify a build-backend?')
    + with WheelFile.open(wheel) as source:
    + install(
    + source=source,
    + destination=destination,
    + additional_metadata={},
    + )
    + else:
    + raise Exception("No wheel could be found!")

    def install(self, context, args):
    log.info('Copying package built for %s to destdir',

    But this is only a fallout because no wheel was built.
    I'd love to get some ideas or solutions so the wheel for this poetry
    based package can be build successfully by dh-python. Maybe we did
    simply forget (or upstream) to add some further build dependency?

    The d/control file is visible here:

    https://salsa.debian.org/kathara/python-asyncmy/-/blob/debian/master/debian/control?ref_type=heads

    --
    Regards
    Carsten

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)