Mercurial > public > mercurial-scm > hg-stable
diff tests/get-with-headers.py @ 52742:f8f14e6d032b
py3: update the remaining shebang lines (mostly tests) to `python3`
I noticed this when running `py hghave` on a system that still has Python2- the
Windows launcher attempts to honor the version of python in the shebang, but
`hghave` recently gained py3 type annotations, so that resulted in a
SyntaxError. I guess CI has the compat shim installed to redirect `python` to
`python3`, and maybe that's why nobody noticed.
These were located by grepping for `#!.+python\b`. The remaining handful of
cases are tests trying to find python files, which is fine as-is.
The one thing to call out here is that apparently the RPM building hasn't worked
with Python3 (or we've been getting lucky). `contrib/hg-ssh` has had a python3
shebang line since late 2020, which means the EOL anchor would have caused it to
not match and not be replaced with `%{pythonexe}`. OTOH, it looks like that
variable was used prior to the `hg-ssh` update in order to default to python3
(as opposed to using a specific /path/to/pythonX), and maybe the update to
`hg-ssh` simply broke python2 builds. I'm not going to worry about this for
now, since there are also direct calls to `setup.py`, which no longer work as of
this release cycle. Somebody interested in RPMs can figure out all of the
issues at once.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 30 Jan 2025 13:51:02 -0500 |
parents | cd125eef4388 |
children |
line wrap: on
line diff
--- a/tests/get-with-headers.py Tue Jan 07 14:05:51 2025 +0100 +++ b/tests/get-with-headers.py Thu Jan 30 13:51:02 2025 -0500 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """This does HTTP requests (GET by default) given a host:port and path and returns a subset of the headers plus the body of the result."""