Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix html report generation with pygments >= 2.12.0 #4110

Merged
merged 1 commit into from May 16, 2022
Merged

Conversation

pattop
Copy link
Contributor

@pattop pattop commented May 13, 2022

pygments 2.12.0 changed the signature of the HtmlFormatter.wrap()
method. As we don't actually care about the arguments to wrap we can
use packing/unpacking to maintain compatability with older versions of
pygments.

@pattop
Copy link
Contributor Author

pattop commented May 13, 2022

Looks like this was caused by pygments/pygments@992fa6c.

@firewave
Copy link
Collaborator

Thanks for your contribution.

You also needs to remove the fixated version from the CI (added in #4068) and make sure it works with pygments version <= 2.12.0.

See also https://trac.cppcheck.net/ticket/11022.

pygments 2.12.0 changed the signature of the HtmlFormatter.wrap()
method. As we don't actually care about the arguments to wrap we can
use packing/unpacking to maintain compatability with older versions of
pygments.
@pattop pattop changed the title fix html report generation fix html report generation with pygments >= 2.12.0 May 15, 2022
@pattop
Copy link
Contributor Author

pattop commented May 15, 2022

I'm no a python expert (know enough to be dangerous), but I think packing/unpacking the arguments is a straightforward way of maintaining backward compatibility. No idea if this works with all versions of python you need to support though.

@firewave
Copy link
Collaborator

I'm no a python expert (know enough to be dangerous), but I think packing/unpacking the arguments is a straightforward way of maintaining backward compatibility.

I wasn't even aware of that. My Python knowledge is very barebones and un-modern. Looks good though. :D

No idea if this works with all versions of python you need to support though.

That's what we have the CI for. Fortunately Python 2.7 still has an older version so that will verify if it works (for some reason Python 3.5 also failed although it should have the latest pygments package). In all other cases we pull the latest with pip.

BTW how do you want to be credited (i.e. entry in AUTHORS)?

@firewave
Copy link
Collaborator

Python 2.7:

Collecting pygments
  Downloading Pygments-2.5.2-py2.py3-none-any.whl (896 kB)
Installing collected packages: pygments
Successfully installed pygments-2.5.2

Python 3.5:

Collecting pygments
  Downloading Pygments-2.11.2-py3-none-any.whl (1.1 MB)
Installing collected packages: pygments
Successfully installed pygments-2.11.2

@firewave firewave merged commit d7317b4 into danmar:main May 16, 2022
@pattop
Copy link
Contributor Author

pattop commented May 16, 2022

BTW how do you want to be credited (i.e. entry in AUTHORS)?

Patrick Oppenlander patrick.oppenlander@gmail.com

Thanks,

Patrick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants