Skip to content
Snippets Groups Projects
  • Matt Harbison's avatar
    f8f14e6d032b
    py3: update the remaining shebang lines (mostly tests) to `python3` · f8f14e6d032b
    Matt Harbison authored
    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.
    f8f14e6d032b
    History
    py3: update the remaining shebang lines (mostly tests) to `python3`
    Matt Harbison authored
    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.
test-highlight.t 37.77 KiB