On Thu, 2025-01-02 at 13:34 +0100, Jakub Jelinek wrote:
> On Thu, Jan 02, 2025 at 11:51:20AM +0000, Richard Sandiford wrote:
> > Jakub Jelinek <ja...@redhat.com> writes:
> > > libgdiagnostics/conf.py breaks update-copyright.py --this-year,
> > > which only accepts copyright year in u'' literals in python
> > > files,
> > > not in ''.
> > > 
> > > u'' strings is what e.g. libgccjit conf.py uses.
> > > Tested by building libgdiagnostics docs without/with this patch,
> > > the
> > > difference is just the expected addition of -2025 in tons of
> > > spots,
> > > nothing else.
> > 
> > It'd be good to move all the python scripts over to python 3, so
> > that
> > this is no longer necessary.  That's obviously separate work
> > though...
> 
> Nothing against that.
> My python-fu is very limited though.
> 
> Right now update-copyright.py has
> '|copyright = u\''
> among other parts of regexp, maybe it would be just a matter of
> adding
> '|copyright = \''
> too or replacing the u one with the latter and getting rid of u''
> strings
> plus testing what it breaks/changes.

FWIW the u'' prefix was originally added in Python 2.0, was dropped in
Python 3.0 through 3.2, and then re-added in Python 3.3 onwards to help
with 2 vs 3 compatibility; see https://peps.python.org/pep-0414/

I don't think anyone's planning to eliminate them again.

It's probably simplest to extend update-copyright.py to support the non
u-prefixed strings as well as u-prefixed strings, given that both are
valid in Python 3.2 onwards.

Dave

Reply via email to