* [Question] Moving from Python2 to Python3 @ 2025-03-25 15:23 rsbecker 2025-03-25 21:31 ` brian m. carlson 0 siblings, 1 reply; 7+ messages in thread From: rsbecker @ 2025-03-25 15:23 UTC (permalink / raw) To: git 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. Thanks, Randall -- Brief whoami: NonStop&UNIX developer since approximately UNIX(421664400) NonStop(211288444200000000) -- In real life, I talk too much. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Question] Moving from Python2 to Python3 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 0 siblings, 1 reply; 7+ messages in thread From: brian m. carlson @ 2025-03-25 21:31 UTC (permalink / raw) To: rsbecker; +Cc: git [-- Attachment #1: Type: text/plain, Size: 732 bytes --] 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. -- brian m. carlson (they/them) Toronto, Ontario, CA [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 263 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Question] Moving from Python2 to Python3 2025-03-25 21:31 ` brian m. carlson @ 2025-03-25 22:40 ` Nikolay Shustov 2025-03-25 23:19 ` Junio C Hamano 0 siblings, 1 reply; 7+ messages in thread From: Nikolay Shustov @ 2025-03-25 22:40 UTC (permalink / raw) To: rsbecker, git; +Cc: brian m. carlson 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. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Question] Moving from Python2 to Python3 2025-03-25 22:40 ` Nikolay Shustov @ 2025-03-25 23:19 ` Junio C Hamano 2025-03-25 23:54 ` Nikolay Shustov 0 siblings, 1 reply; 7+ messages in thread From: Junio C Hamano @ 2025-03-25 23:19 UTC (permalink / raw) To: Nikolay Shustov; +Cc: rsbecker, git, brian m. carlson Nikolay Shustov <nikolay.shustov@gmail•com> writes: > 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. Hmph, but isn't that the core competence of those who package Python to their target system? If we run something with /usr/bin/python3, without any strange customization, that binary ought to know where it should pull its associated standard library files from, and we as the language users do not have to worry about it, no? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Question] Moving from Python2 to Python3 2025-03-25 23:19 ` Junio C Hamano @ 2025-03-25 23:54 ` Nikolay Shustov 2025-03-26 1:02 ` Todd Zullinger 0 siblings, 1 reply; 7+ messages in thread From: Nikolay Shustov @ 2025-03-25 23:54 UTC (permalink / raw) To: Junio C Hamano; +Cc: rsbecker, git, brian m. carlson You are right, my answer was over-engineered. Instead of speculating about what else needs to be done if one decides to set PYTHONPATH, I should have just advised to use the OS specific method on setting up the "default" Python as Python3 and be with it. Well, unless the dual Python is needed (git-p4 running with the Python different from system "default"). On 3/25/25 19:19, Junio C Hamano wrote: > Nikolay Shustov <nikolay.shustov@gmail•com> writes: > >> 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. > Hmph, but isn't that the core competence of those who package Python > to their target system? If we run something with /usr/bin/python3, > without any strange customization, that binary ought to know where > it should pull its associated standard library files from, and we as > the language users do not have to worry about it, no? > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Question] Moving from Python2 to Python3 2025-03-25 23:54 ` Nikolay Shustov @ 2025-03-26 1:02 ` Todd Zullinger 2025-03-26 1:56 ` Nikolay Shustov 0 siblings, 1 reply; 7+ messages in thread From: Todd Zullinger @ 2025-03-26 1:02 UTC (permalink / raw) To: Nikolay Shustov; +Cc: Junio C Hamano, rsbecker, git, brian m. carlson Nikolay Shustov wrote: > You are right, my answer was over-engineered. > > Instead of speculating about what else needs to be done if > one decides to set PYTHONPATH, I should have just advised > to use the OS specific method on setting up the "default" > Python as Python3 and be with it. > > Well, unless the dual Python is needed (git-p4 running > with the Python different from system "default"). Perhaps you were conflating PYTHON_PATH, which brian suggested, with PYTHONPATH? PYTHON_PATH is used by the git build system to set the path to the python executable, e.g.: /usr/bin/python2, /usr/bin/python3, etc. PYTHONPATH is used by python itself to point to the location(s) of module files, similar to PATH, as you mentioned. The Fedora distribution packaging set PYTHON_PATH to python2 or python3 while both were available and things worked well. Only python3 is supported now, and PYTHON_PATH is set accordingly. That ought to work just as well for NonStop. If it doesn't, that would most likely be something to take up with the OS folks handling python3. :) -- Todd ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Question] Moving from Python2 to Python3 2025-03-26 1:02 ` Todd Zullinger @ 2025-03-26 1:56 ` Nikolay Shustov 0 siblings, 0 replies; 7+ messages in thread From: Nikolay Shustov @ 2025-03-26 1:56 UTC (permalink / raw) To: Todd Zullinger; +Cc: Junio C Hamano, rsbecker, git, brian m. carlson Doh! Of course I thought of PYTHONPATH not of PYTHON_PATH. My apologies for the noise. On 3/25/25 21:02, Todd Zullinger wrote: > Nikolay Shustov wrote: >> You are right, my answer was over-engineered. >> >> Instead of speculating about what else needs to be done if >> one decides to set PYTHONPATH, I should have just advised >> to use the OS specific method on setting up the "default" >> Python as Python3 and be with it. >> >> Well, unless the dual Python is needed (git-p4 running >> with the Python different from system "default"). > Perhaps you were conflating PYTHON_PATH, which brian > suggested, with PYTHONPATH? > > PYTHON_PATH is used by the git build system to set the path > to the python executable, e.g.: /usr/bin/python2, > /usr/bin/python3, etc. > > PYTHONPATH is used by python itself to point to the > location(s) of module files, similar to PATH, as you > mentioned. > > The Fedora distribution packaging set PYTHON_PATH to python2 > or python3 while both were available and things worked well. > Only python3 is supported now, and PYTHON_PATH is set > accordingly. > > That ought to work just as well for NonStop. If it doesn't, > that would most likely be something to take up with the OS > folks handling python3. :) > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-03-26 1:56 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox