#2 Run more tests; build Sphinx docs as PDF
Merged 2 years ago by music. Opened 2 years ago by music.
rpms/ music/python-pyperclip v1.8.2  into  rawhide

file modified
+103 -11
@@ -1,9 +1,15 @@ 

+ # Sphinx-generated HTML documentation is not suitable for packaging; see

+ # https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.

+ #

+ # We can generate PDF documentation as a substitute.

+ %bcond_without doc_pdf

+ 

  %global pypi_name pyperclip

  

  

  Name:           python-%{pypi_name}

  Version:        1.8.2

- Release:        1%{?dist}

+ Release:        2%{?dist}

  Summary:        A cross-platform clipboard module for Python

  

  License:        BSD
@@ -15,12 +21,48 @@ 

  Pyperclip is a cross-platform Python module for copy and paste clipboard

  functions.

  

+ 

  %package -n     python3-%{pypi_name}

  Summary:        %{summary}

  

  BuildRequires:  python3-devel

- BuildRequires:  python3-setuptools

- BuildRequires:  python3-pytest

+ BuildRequires:  python3dist(setuptools)

+ 

+ # While upstream runs tests directly with Python/unittest, using pytest as the

+ # runner allows us to more easily skip tests.

+ BuildRequires:  python3dist(pytest)

+ 

+ # Support graphical tests in non-graphical environment

+ BuildRequires:  xorg-x11-server-Xvfb

+ 

+ # TestGtk (module gtk)

+ # (not available; this would be the obsolete PyGTK for GTK2, which never

+ # supported Python 3)

+ 

+ # TestQt (module PyQt5.QtWidgets)

+ BuildRequires:  python3dist(pyqt5)

+ 

+ # TestXClip (executable xclip)

+ BuildRequires:  /usr/bin/xclip

+ 

+ # TestXSel (executable xsel)

+ # These tests *can* pass, but some of them are flaky. It would be nice to

+ # figure out why.

+ # BuildRequires:  /usr/bin/xsel

+ 

+ # TestWlClipboard (executable wl-copy)

+ # These would fail with:

+ #   Failed to connect to a Wayland server

+ #   error: XDG_RUNTIME_DIR not set in the environment.

+ # BuildRequires:  /usr/bin/wl-copy

+ 

+ # TestKlipper (executables klipper and qdbus)

+ # These would fail with:

+ #   Could not connect to D-Bus server:

+ #   org.freedesktop.DBus.Error.Spawn.ExecFailed: /usr/bin/dbus-launch

+ #   terminated abnormally without any error message

+ # BuildRequires:  /usr/bin/klipper

+ # BuildRequires:  /usr/bin/qdbus

  

  %description -n python3-%{pypi_name}

  Pyperclip is a cross-platform Python module for copy and paste clipboard
@@ -29,7 +71,44 @@ 

  

  %package -n python-%{pypi_name}-doc

  Summary:        Pyperclip documentation

- BuildRequires:  python3-sphinx

+ 

+ %if %{with doc_pdf}

+ BuildRequires:  make

+ BuildRequires:  python3dist(sphinx)

+ %if ! 0%{?el8}

+ BuildRequires:  python3-sphinx-latex

+ %else

+ BuildRequires:  tex(amsmath.sty)

+ BuildRequires:  tex(amsthm.sty)

+ BuildRequires:  tex(anyfontsize.sty)

+ BuildRequires:  tex(article.cls)

+ BuildRequires:  tex(capt-of.sty)

+ BuildRequires:  tex(cmap.sty)

+ BuildRequires:  tex(color.sty)

+ BuildRequires:  tex(ctablestack.sty)

+ BuildRequires:  tex(fancyhdr.sty)

+ BuildRequires:  tex(fancyvrb.sty)

+ BuildRequires:  tex(fncychap.sty)

+ BuildRequires:  tex(framed.sty)

+ BuildRequires:  tex(geometry.sty)

+ BuildRequires:  tex(hyperref.sty)

+ BuildRequires:  tex(kvoptions.sty)

+ BuildRequires:  tex(luatex85.sty)

+ BuildRequires:  tex(needspace.sty)

+ BuildRequires:  tex(parskip.sty)

+ BuildRequires:  tex(polyglossia.sty)

+ BuildRequires:  tex(tabulary.sty)

+ BuildRequires:  tex(titlesec.sty)

+ BuildRequires:  tex(upquote.sty)

+ BuildRequires:  tex(utf8x.def)

+ BuildRequires:  tex(wrapfig.sty)

+ BuildRequires:  texlive-collection-fontsrecommended

+ BuildRequires:  texlive-collection-latex

+ BuildRequires:  texlive-dvipng

+ BuildRequires:  texlive-dvisvgm

+ %endif

+ BuildRequires:  latexmk

+ %endif

  

  %description -n python-%{pypi_name}-doc

  Documentation for pyperclip
@@ -45,27 +124,40 @@ 

  

  %build

  %py3_build

- # generate html docs

- PYTHONPATH=${PWD} sphinx-build docs html

- # remove the sphinx-build leftovers

- rm -rf html/.{doctrees,buildinfo}

+ 

+ %if %{with doc_pdf}

+ PYTHONPATH="${PWD}/src" %make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}'

+ %make_build -C docs/_build/latex LATEXMKOPTS='-quiet'

+ %endif

  

  %install

  %py3_install

  

  %check

- #%%{__python3} setup.py test

- %pytest

+ %global __pytest /usr/bin/xvfb-run -a %{python3} -m pytest

+ # Explicitly skip backends that we know will fail in the mock environment if

+ # their dependencies happen to be present. See notes in the BuildRequires.

+ %pytest -k 'not TestGtk and not TestXSel and not TestWlClipboard and not TestKlipper' -v

  

  %files -n python3-%{pypi_name}

+ %license LICENSE.txt

+ %doc AUTHORS.txt

+ %doc CHANGES.txt

  %doc README.md

  %{python3_sitelib}/%{pypi_name}

  %{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info

  

  %files -n python-%{pypi_name}-doc

- %doc html

+ %license LICENSE.txt

+ %if %{with doc_pdf}

+ %doc docs/_build/latex/Pyperclip.pdf

+ %endif

  

  %changelog

+ * Fri Aug 12 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 1.8.2-2

+ - Enable running most of the graphical tests

+ - Switch Sphinx documentation to PDF to sidestep guidelines issues

+ 

  * Mon Aug 08 2022 Jonathan Wright <jonathan@almalinux.org> - 1.8.2-1

  - Update to 1.8.2

  

See https://bugzilla.redhat.com/show_bug.cgi?id=1887119#c2.

I am happy to port the spec file to pyproject-rpm-macros as an additional commit or as a separate PR.

rebased onto 7216d74

2 years ago

Rebased on current rawhide, with changelog entries re-dated from Mar 22 2022 to Aug 01 2022.

Rebased on current rawhide; no longer contains a version update.

rebased onto f1f993c

2 years ago

@jonathanspw, would you mind having a quick look at this before I merge it?

Please also let me know whether or not you are interested in a follow-up PR to port the package to pyproject-rpm-macros / “new Python guidelines”.

Thanks!

Why not remove these last 3 chunks that are all commented anyway?

Please also let me know whether or not you are interested in a follow-up PR to port the package to pyproject-rpm-macros / “new Python guidelines”.

Swapping to the new guidelines would be good but I do want to maintain buildability for EPEL8/9. Not worried about 7 because people shouldn't be putting new projects on that anyway.

I'm not really particular one way or another to stick with all old, or new+old and some %if blocks.

Why not remove these last 3 chunks that are all commented anyway?

My thought was that the commented-out BR’s document the perhaps-nonobvious dependencies for particular tests; ideally, they could be uncommented in the future if the failures ever go away, or if someone figures out the root cause.

Maybe it would be better to do something like:

# Useful comment #1
%bcond_with tests_xsel
# Useful comment #2
%bcond_with tests_wlcopy
# Useful comment #3
%bcond_with tests_klipper

Why not remove these last 3 chunks that are all commented anyway?

My thought was that the commented-out BR’s document the perhaps-nonobvious dependencies for particular tests; ideally, they could be uncommented in the future if the failures ever go away, or if someone figures out the root cause.

Maybe it would be better to do something like:

```

Useful comment #1

%bcond_with tests_xsel

Useful comment #2

%bcond_with tests_wlcopy

Useful comment #3

%bcond_with tests_klipper
```

I'm fine with leaving them then. Not like it hurts anything :)

Swapping to the new guidelines would be good but I do want to maintain buildability for EPEL8/9. Not worried about 7 because people shouldn't be putting new projects on that anyway.

I'm not really particular one way or another to stick with all old, or new+old and some %if blocks.

EPEL9 is easy, as the macros and RPM features there are compatible with those in Fedora.

If you want EPEL8, the differences between old and new Python packaging practices are sufficiently great that I find there are two reasonable approaches:

  1. Branch EPEL8 prior to pyproject-rpm-macros conversion and cherry-pick any subsequent fixes and compatible updates. Give up on doing fast-forward merges to the epel8 branch.
  2. Don’t convert to pyproject-rpm-macros until after you ship an update you don’t plan to backport to EPEL8.

1 new commit added

  • Restore EPEL8 compatibility
2 years ago

Added a commit to make this PR EPEL8-compatible.

I think this looks good.

Let's maintain it with old python macros for now until upstream releases a new version that we can't upgrade EPEL8 to anyway for compatibility reasons.

Pull-Request has been merged by music

2 years ago
Metadata