git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: `git p4` broken on machines which do not have python on path

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 6, 2025, 23:17 UTC
Message-ID
<xmqqmseyhddy.fsf@gitster.g>
In-Reply-To
<Z6U1GoGVA7IiPg3A@tapette.crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 13 quoted lines
> On 2025-02-06 at 02:12:02, Kapil Somani wrote:
>> Thanks for quick response Brian
>> 
>> Yes, our team compiles git for use within our organization.
>> I'll reach out to them and see if they can provide path during build.
>> 
>> Meanwhile, I was able to update copy of the git (compiled by my team) to
>> use python3 on shebang line.
>> It appears that the git-p4 is compatible with Python3. Is git team planning
>> to update it near future?
>
> It's my understanding that it's designed to work with both Python 2 and
> 3.  It's unlikely that the shebang will be updated until it's no longer

Correct. The CI has jobs to try git-p4 with both python2 and python3 since Mar 2020.

> guaranteed to work with Python 2, since `python` is more generic than
> `python3`.  When that is, I don't know, since I don't use Perforce and
> don't maintain git-p4, which has a separate maintainer.
I am not sure what story about shebang is discussed here.

If the complaint is "your script says '/usr/bin/env python', but my users don't have 'python' on their $PATH", I think that is barking up a wrong tree. As a general principle, we try not to rely on "env".

Just like other scripts, we munge git-p4.py script to replace the shebang line to use the path to the python binary specified by the builder into resulting git-p4 "executable" file that is installed.

We do this (not specifically for git-p4 but as a general principle) because we do not want to get affected by random customized versions of stuff end-users install on their $PATH that overrides the ones from the system that builders determined to be used by Git.

Is the complaint that "on my system there are /usr/bin/python2 and /usr/bin/python3 but no vanilla /usr/bin/python installed"?

So it is your responsibility to tell the build procedure that you want to use "/usr/bin/python3", as the build procedure defaults to "/usr/bin/python" when you do not specify any.

Previous: brian m. carlson
Message 5 of 5 in “`git p4` broken on machines which do not have python on path”
  1. Kapil SomaniFeb 6, 2025
  2. brian m. carlsonFeb 6, 2025
  3. Illia BobyrFeb 6, 2025
  4. brian m. carlsonFeb 6, 2025
  5. Junio C HamanoFeb 6, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.