Package: src:pyscreeze
Version: 0.0~git20240820225245.93f2775-4
Severity: important
Tags: ftbfs

Dear maintainer:

During a rebuild of all packages in unstable, your package failed to build:

--------------------------------------------------------------------------------
[...]
 debian/rules build
dh build --with python3 --buildsystem=pybuild
   dh_update_autotools_config -O--buildsystem=pybuild
   dh_autoreconf -O--buildsystem=pybuild
   dh_auto_configure -O--buildsystem=pybuild
I: pybuild base:311: python3.12 setup.py config
/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py:261: UserWarning: 
Unknown distribution option: 'test_suite'
  warnings.warn(msg)
/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py:261: UserWarning: 
Unknown distribution option: 'requires_python'
  warnings.warn(msg)
running config
   dh_auto_build -O--buildsystem=pybuild
I: pybuild base:311: /usr/bin/python3 setup.py build
/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py:261: UserWarning: 
Unknown distribution option: 'test_suite'
  warnings.warn(msg)
/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py:261: UserWarning: 
Unknown distribution option: 'requires_python'
  warnings.warn(msg)
running build
running build_py
creating /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyscreeze/build/pyscreeze
copying pyscreeze/__init__.py -> 
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyscreeze/build/pyscreeze
   dh_auto_test -O--buildsystem=pybuild
I: pybuild base:311: cd 
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyscreeze/build'; python3.12 -m pytest 
tests
============================= test session starts ==============================
platform linux -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
rootdir: /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyscreeze/build
configfile: pyproject.toml
plugins: typeguard-4.3.0, xvfb-3.0.0
collected 12 items

tests/test_pyscreeze.py .........FF.                                     [100%]

=================================== FAILURES ===================================
_________________________ TestGeneral.test_screenshot __________________________

bbox = None, include_layered_windows = False, all_screens = False
xdisplay = None

    def grab(
        bbox: tuple[int, int, int, int] | None = None,
        include_layered_windows: bool = False,
        all_screens: bool = False,
        xdisplay: str | None = None,
    ) -> Image.Image:
        im: Image.Image
        if xdisplay is None:
            if sys.platform == "darwin":
                fh, filepath = tempfile.mkstemp(".png")
                os.close(fh)
                args = ["screencapture"]
                if bbox:
                    left, top, right, bottom = bbox
                    args += ["-R", f"{left},{top},{right-left},{bottom-top}"]
                subprocess.call(args + ["-x", filepath])
                im = Image.open(filepath)
                im.load()
                os.unlink(filepath)
                if bbox:
                    im_resized = im.resize((right - left, bottom - top))
                    im.close()
                    return im_resized
                return im
            elif sys.platform == "win32":
                offset, size, data = Image.core.grabscreen_win32(
                    include_layered_windows, all_screens
                )
                im = Image.frombytes(
                    "RGB",
                    size,
                    data,
                    # RGB, 32-bit line padding, origin lower left corner
                    "raw",
                    "BGR",
                    (size[0] * 3 + 3) & -4,
                    -1,
                )
                if bbox:
                    x0, y0 = offset
                    left, top, right, bottom = bbox
                    im = im.crop((left - x0, top - y0, right - x0, bottom - y0))
                return im
        # Cast to Optional[str] needed for Windows and macOS.
        display_name: str | None = xdisplay
        try:
            if not Image.core.HAVE_XCB:
                msg = "Pillow was built without XCB support"
                raise OSError(msg)
          size, data = Image.core.grabscreen_x11(display_name)
E           OSError: unsupported bit depth: 16

/usr/lib/python3/dist-packages/PIL/ImageGrab.py:78: OSError

During handling of the above exception, another exception occurred:

self = <test_pyscreeze.TestGeneral testMethod=test_screenshot>

    def test_screenshot(self):
      im = pyscreeze.screenshot(TEMP_FILENAME)

/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyscreeze/build/tests/test_pyscreeze.py:144:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyscreeze/build/pyscreeze/__init__.py:603:
 in _screenshot_linux
    im = ImageGrab.grab()  # use Pillow's grab() for Pillow 9.2.0 and later.
/usr/lib/python3/dist-packages/PIL/ImageGrab.py:88: in grab
    im = Image.open(filepath)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

fp = <_io.BufferedReader name='/tmp/tmp_u3jlalf.png'>, mode = 'r'
formats = ['BMP', 'DIB', 'GIF', 'JPEG', 'PPM', 'PNG', ...]

    def open(
        fp: StrOrBytesPath | IO[bytes],
        mode: Literal["r"] = "r",
        formats: list[str] | tuple[str, ...] | None = None,
    ) -> ImageFile.ImageFile:
        """
        Opens and identifies the given image file.
This is a lazy operation; this function identifies the file, but
        the file remains open and the actual image data is not read from
        the file until you try to process the data (or call the
        :py:meth:`~PIL.Image.Image.load` method).  See
        :py:func:`~PIL.Image.new`. See :ref:`file-handling`.
:param fp: A filename (string), os.PathLike object or a file object.
           The file object must implement ``file.read``,
           ``file.seek``, and ``file.tell`` methods,
           and be opened in binary mode. The file object will also seek to zero
           before reading.
        :param mode: The mode.  If given, this argument must be "r".
        :param formats: A list or tuple of formats to attempt to load the file 
in.
           This can be used to restrict the set of formats checked.
           Pass ``None`` to try all supported formats. You can print the set of
           available formats by running ``python3 -m PIL`` or using
           the :py:func:`PIL.features.pilinfo` function.
        :returns: An :py:class:`~PIL.Image.Image` object.
        :exception FileNotFoundError: If the file cannot be found.
        :exception PIL.UnidentifiedImageError: If the image cannot be opened and
           identified.
        :exception ValueError: If the ``mode`` is not "r", or if a ``StringIO``
           instance is used for ``fp``.
        :exception TypeError: If ``formats`` is not ``None``, a list or a tuple.
        """
if mode != "r":
            msg = f"bad mode {repr(mode)}"  # type: ignore[unreachable]
            raise ValueError(msg)
        elif isinstance(fp, io.StringIO):
            msg = (  # type: ignore[unreachable]
                "StringIO cannot be used to open an image. "
                "Binary data must be used instead."
            )
            raise ValueError(msg)
if formats is None:
            formats = ID
        elif not isinstance(formats, (list, tuple)):
            msg = "formats must be a list or tuple"  # type: ignore[unreachable]
            raise TypeError(msg)
exclusive_fp = False
        filename: str | bytes = ""
        if is_path(fp):
            filename = os.path.realpath(os.fspath(fp))
if filename:
            fp = builtins.open(filename, "rb")
            exclusive_fp = True
        else:
            fp = cast(IO[bytes], fp)
try:
            fp.seek(0)
        except (AttributeError, io.UnsupportedOperation):
            fp = io.BytesIO(fp.read())
            exclusive_fp = True
prefix = fp.read(16) preinit() warning_messages: list[str] = [] def _open_core(
            fp: IO[bytes],
            filename: str | bytes,
            prefix: bytes,
            formats: list[str] | tuple[str, ...],
        ) -> ImageFile.ImageFile | None:
            for i in formats:
                i = i.upper()
                if i not in OPEN:
                    init()
                try:
                    factory, accept = OPEN[i]
                    result = not accept or accept(prefix)
                    if isinstance(result, str):
                        warning_messages.append(result)
                    elif result:
                        fp.seek(0)
                        im = factory(fp, filename)
                        _decompression_bomb_check(im.size)
                        return im
                except (SyntaxError, IndexError, TypeError, struct.error) as e:
                    if WARN_POSSIBLE_FORMATS:
                        warning_messages.append(i + " opening failed. " + 
str(e))
                except BaseException:
                    if exclusive_fp:
                        fp.close()
                    raise
            return None
im = _open_core(fp, filename, prefix, formats) if im is None and formats is ID:
            checked_formats = ID.copy()
            if init():
                im = _open_core(
                    fp,
                    filename,
                    prefix,
                    tuple(format for format in formats if format not in 
checked_formats),
                )
if im:
            im._exclusive_fp = exclusive_fp
            return im
if exclusive_fp:
            fp.close()
        for message in warning_messages:
            warnings.warn(message)
        msg = "cannot identify image file %r" % (filename if filename else fp)
      raise UnidentifiedImageError(msg)
E       PIL.UnidentifiedImageError: cannot identify image file 
'/tmp/tmp_u3jlalf.png'

/usr/lib/python3/dist-packages/PIL/Image.py:3498: UnidentifiedImageError
----------------------------- Captured stderr call -----------------------------

(gnome-screenshot:45457): GLib-GIO-CRITICAL **: 05:17:55.263: 
g_dbus_connection_call_sync_internal: assertion 'G_IS_DBUS_CONNECTION 
(connection)' failed
** Message: 05:17:55.263: Unable to use GNOME Shell's builtin screenshot 
interface, resorting to fallback X11.
_____________________ TestGeneral.test_screenshot_regions ______________________

bbox = None, include_layered_windows = False, all_screens = False
xdisplay = None

    def grab(
        bbox: tuple[int, int, int, int] | None = None,
        include_layered_windows: bool = False,
        all_screens: bool = False,
        xdisplay: str | None = None,
    ) -> Image.Image:
        im: Image.Image
        if xdisplay is None:
            if sys.platform == "darwin":
                fh, filepath = tempfile.mkstemp(".png")
                os.close(fh)
                args = ["screencapture"]
                if bbox:
                    left, top, right, bottom = bbox
                    args += ["-R", f"{left},{top},{right-left},{bottom-top}"]
                subprocess.call(args + ["-x", filepath])
                im = Image.open(filepath)
                im.load()
                os.unlink(filepath)
                if bbox:
                    im_resized = im.resize((right - left, bottom - top))
                    im.close()
                    return im_resized
                return im
            elif sys.platform == "win32":
                offset, size, data = Image.core.grabscreen_win32(
                    include_layered_windows, all_screens
                )
                im = Image.frombytes(
                    "RGB",
                    size,
                    data,
                    # RGB, 32-bit line padding, origin lower left corner
                    "raw",
                    "BGR",
                    (size[0] * 3 + 3) & -4,
                    -1,
                )
                if bbox:
                    x0, y0 = offset
                    left, top, right, bottom = bbox
                    im = im.crop((left - x0, top - y0, right - x0, bottom - y0))
                return im
        # Cast to Optional[str] needed for Windows and macOS.
        display_name: str | None = xdisplay
        try:
            if not Image.core.HAVE_XCB:
                msg = "Pillow was built without XCB support"
                raise OSError(msg)
          size, data = Image.core.grabscreen_x11(display_name)
E           OSError: unsupported bit depth: 16

/usr/lib/python3/dist-packages/PIL/ImageGrab.py:78: OSError

During handling of the above exception, another exception occurred:

self = <test_pyscreeze.TestGeneral testMethod=test_screenshot_regions>

    def test_screenshot_regions(self):
      im = pyscreeze.screenshot(TEMP_FILENAME, region=(0, 0, 100, 150))

/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyscreeze/build/tests/test_pyscreeze.py:151:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyscreeze/build/pyscreeze/__init__.py:603:
 in _screenshot_linux
    im = ImageGrab.grab()  # use Pillow's grab() for Pillow 9.2.0 and later.
/usr/lib/python3/dist-packages/PIL/ImageGrab.py:88: in grab
    im = Image.open(filepath)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

fp = <_io.BufferedReader name='/tmp/tmpx_2kn5bg.png'>, mode = 'r'
formats = ['BMP', 'DIB', 'GIF', 'JPEG', 'PPM', 'PNG', ...]

    def open(
        fp: StrOrBytesPath | IO[bytes],
        mode: Literal["r"] = "r",
        formats: list[str] | tuple[str, ...] | None = None,
    ) -> ImageFile.ImageFile:
        """
        Opens and identifies the given image file.
This is a lazy operation; this function identifies the file, but
        the file remains open and the actual image data is not read from
        the file until you try to process the data (or call the
        :py:meth:`~PIL.Image.Image.load` method).  See
        :py:func:`~PIL.Image.new`. See :ref:`file-handling`.
:param fp: A filename (string), os.PathLike object or a file object.
           The file object must implement ``file.read``,
           ``file.seek``, and ``file.tell`` methods,
           and be opened in binary mode. The file object will also seek to zero
           before reading.
        :param mode: The mode.  If given, this argument must be "r".
        :param formats: A list or tuple of formats to attempt to load the file 
in.
           This can be used to restrict the set of formats checked.
           Pass ``None`` to try all supported formats. You can print the set of
           available formats by running ``python3 -m PIL`` or using
           the :py:func:`PIL.features.pilinfo` function.
        :returns: An :py:class:`~PIL.Image.Image` object.
        :exception FileNotFoundError: If the file cannot be found.
        :exception PIL.UnidentifiedImageError: If the image cannot be opened and
           identified.
        :exception ValueError: If the ``mode`` is not "r", or if a ``StringIO``
           instance is used for ``fp``.
        :exception TypeError: If ``formats`` is not ``None``, a list or a tuple.
        """
if mode != "r":
            msg = f"bad mode {repr(mode)}"  # type: ignore[unreachable]
            raise ValueError(msg)
        elif isinstance(fp, io.StringIO):
            msg = (  # type: ignore[unreachable]
                "StringIO cannot be used to open an image. "
                "Binary data must be used instead."
            )
            raise ValueError(msg)
if formats is None:
            formats = ID
        elif not isinstance(formats, (list, tuple)):
            msg = "formats must be a list or tuple"  # type: ignore[unreachable]
            raise TypeError(msg)
exclusive_fp = False
        filename: str | bytes = ""
        if is_path(fp):
            filename = os.path.realpath(os.fspath(fp))
if filename:
            fp = builtins.open(filename, "rb")
            exclusive_fp = True
        else:
            fp = cast(IO[bytes], fp)
try:
            fp.seek(0)
        except (AttributeError, io.UnsupportedOperation):
            fp = io.BytesIO(fp.read())
            exclusive_fp = True
prefix = fp.read(16) preinit() warning_messages: list[str] = [] def _open_core(
            fp: IO[bytes],
            filename: str | bytes,
            prefix: bytes,
            formats: list[str] | tuple[str, ...],
        ) -> ImageFile.ImageFile | None:
            for i in formats:
                i = i.upper()
                if i not in OPEN:
                    init()
                try:
                    factory, accept = OPEN[i]
                    result = not accept or accept(prefix)
                    if isinstance(result, str):
                        warning_messages.append(result)
                    elif result:
                        fp.seek(0)
                        im = factory(fp, filename)
                        _decompression_bomb_check(im.size)
                        return im
                except (SyntaxError, IndexError, TypeError, struct.error) as e:
                    if WARN_POSSIBLE_FORMATS:
                        warning_messages.append(i + " opening failed. " + 
str(e))
                except BaseException:
                    if exclusive_fp:
                        fp.close()
                    raise
            return None
im = _open_core(fp, filename, prefix, formats) if im is None and formats is ID:
            checked_formats = ID.copy()
            if init():
                im = _open_core(
                    fp,
                    filename,
                    prefix,
                    tuple(format for format in formats if format not in 
checked_formats),
                )
if im:
            im._exclusive_fp = exclusive_fp
            return im
if exclusive_fp:
            fp.close()
        for message in warning_messages:
            warnings.warn(message)
        msg = "cannot identify image file %r" % (filename if filename else fp)
      raise UnidentifiedImageError(msg)
E       PIL.UnidentifiedImageError: cannot identify image file 
'/tmp/tmpx_2kn5bg.png'

/usr/lib/python3/dist-packages/PIL/Image.py:3498: UnidentifiedImageError
----------------------------- Captured stderr call -----------------------------

(gnome-screenshot:45467): GLib-GIO-CRITICAL **: 05:17:55.437: 
g_dbus_connection_call_sync_internal: assertion 'G_IS_DBUS_CONNECTION 
(connection)' failed
** Message: 05:17:55.437: Unable to use GNOME Shell's builtin screenshot 
interface, resorting to fallback X11.
=========================== short test summary info ============================
FAILED tests/test_pyscreeze.py::TestGeneral::test_screenshot - PIL.Unidentifi...
FAILED tests/test_pyscreeze.py::TestGeneral::test_screenshot_regions - PIL.Un...
========================= 2 failed, 10 passed in 0.44s =========================
E: pybuild pybuild:389: test: plugin distutils failed with: exit code=1: cd 
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyscreeze/build'; python3.12 -m pytest 
tests
dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.12 
returned exit code 13
make: *** [debian/rules:7: build] Error 25
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
--------------------------------------------------------------------------------

The above is just how the build ends and not necessarily the most relevant part.
If required, the full build log is available here:

https://people.debian.org/~sanvila/build-logs/202411/

About the archive rebuild: The build was made on virtual machines from AWS,
using sbuild and a reduced chroot with only build-essential packages.

If you could not reproduce the bug please contact me privately, as I
am willing to provide ssh access to a virtual machine where the bug is
fully reproducible.

If this is really a bug in one of the build-depends, please use
reassign and affects, so that this is still visible in the BTS web
page for this package.


Note: This happens 100% of the time on AWS instances of type m7a.medium
and r7a.medium.

I plan to disable the offending tests, at least until somebody is willing
to debug the failure. Same for #1085110 in pyautogui.

Thanks.

Reply via email to