js-format and clang-format attempt to call `hg.exe mach ...` on Windows
Categories
(Developer Infrastructure :: Lint and Formatting, defect, P5)
Tracking
(Not tracked)
People
(Reporter: barret, Assigned: sheehan)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
Apparently, when you run hg.exe
, sys.executable
is actually hg.exe
and not the relevant python.exe:
Barret@FOXYSHAZAM ~\W\s\h\mozilla-central $ hg amend
> c:\users\barret\.mozbuild\version-control-tools\hgext\js-format\__init__.py(38)find_python()
-> return pycompat.bytestr(sys.executable) if sys.version_info[0] >= 3 else b"python3"
(Pdb) sys.executable
'C:\\Users\\Barret\\AppData\\Roaming\\Python\\Python39\\Scripts\\hg.exe'
This makes both clang-format and js-format hooks not run
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
I didn't even know this was possible. :)
Chatted briefly with Mitch on Slack. I think instead of trying to find an appropriate Python in the hgext, we should instead look for an appropriate mach
entrypoint depending on the environment. If we're on Windows but not MozillaBuild, we call mach.ps1
. All other platforms (Windows with MozillaBuild, Linux, macOS) we can just call mach
. Then mach
and hg
can each deal with their own Python independently of each other.
Assignee | ||
Comment 2•2 years ago
|
||
Previously we added a find_python
function to locate an appropriate
Python install to use to run mach
, however due to the way hg.exe
is produced on Windows this proved unsuccessful.
The actual goal here is to be able to run mach <formatter>
on all platforms. We were attempting to locate a suitable
Python for mach
since standard, non-MozillaBuild Windows can't
directly execute the mach
script. Since standard Windows installs
can execute mach
as a standalone command via mach.ps1
, we
switch find_python
to a find_mach
command which returns the
appropriate entry script depending on an inspection of the
environment and operating system.
Updated•2 years ago
|
Comment 3•2 years ago
|
||
The severity field is not set for this bug.
:ahal, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee | ||
Comment 4•2 years ago
|
||
Low priority and severity, at least until MozillaBuild 4.0 lands.
Updated•2 years ago
|
Pushed by cosheehan@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/9aa7f89cdea2
hgext/*-format: run mach
through python
and add more Python variants r=mhentges
Updated•2 years ago
|
Description
•