git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Shustov <nikolay.shustov@gmail.com>
To: rsbecker@nexbridge.com, git@vger.kernel.org
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>
Subject: Re: [Question] Moving from Python2 to Python3
Date: Tue, 25 Mar 2025 18:40:56 -0400	[thread overview]
Message-ID: <66e39a95-09a3-44dc-ac71-a6c02b5949c9@gmail.com> (raw)
In-Reply-To: <Z-MgpuxFQ3xEgvsU@tapette.crustytoothpaste.net>

git-p4 is designed to work both with Python 2 and Python 3.

However, changing just PYTHONPATH may not to be good enough.

In general, it is necessary to make having PYTHONPATH value and the 
version of Python executable which application is run by, to be 
coherent: Python executable has to be able to work correctly with the 
libraries PYTHONPATH points to.

How to achieve it - depends on the OS where git-p4 is run.

If used from *nix like shells, git-p4 would be using Python executable 
from the shebang in the beginning of the file: #!/usr/bin/python .
On Windows, it is possible that the specific Python executable could be 
associated with .py files so that shebang maybe not in play at all.

Some OSes may require manual adjustments such as setting PYTHONPATH 
shell profile (environment variables, for Windows) and ensuring proper 
Python executable will be put in PATH. Some (Linux) may use 
update-alternatives commands to switch between Python (and other 
applications) versions easier. If it is desired to keep default Python 
of one version and run git-p4 with another, more tweaks/hackery may be 
needed.

I would recommend to refer to the documentation on the specific OS and 
also look for hints in Python related online documentation/forums.

On 3/25/25 17:31, brian m. carlson wrote:
> On 2025-03-25 at 15:23:40, rsbecker@nexbridge.com wrote:
>> Hi Git Team,
>>
>> I have Python2 and Python3 on my system. We are deprecating Python2 ASAP. Is
>> there an easy way to force git
>> to use Python3 only? Both are in /usr/bin. python has a symbolic link to
>> python2 right now, but we are probably
>> going to change that. I already have modified settings in config.mak.uname
>> PYTHON_PATH = /usr/bin/python3.
> I think only git-p4 uses Python in our codebase, so changing `PYTHON_PATH`
> should be sufficient to fix it.  As far as I know, git-p4 currently
> supports both, so things should just work.
>
> Of course, I might be mistaken, since I don't use git-p4.

  reply	other threads:[~2025-03-25 22:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 15:23 [Question] Moving from Python2 to Python3 rsbecker
2025-03-25 21:31 ` brian m. carlson
2025-03-25 22:40   ` Nikolay Shustov [this message]
2025-03-25 23:19     ` Junio C Hamano
2025-03-25 23:54       ` Nikolay Shustov
2025-03-26  1:02         ` Todd Zullinger
2025-03-26  1:56           ` Nikolay Shustov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=66e39a95-09a3-44dc-ac71-a6c02b5949c9@gmail.com \
    --to=nikolay.shustov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rsbecker@nexbridge.com \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).