Skip to content

Commit

Permalink
hooks/format: call mach with python3 directly instead of through …
Browse files Browse the repository at this point in the history
…`sh` (Bug 1749681) r=firefox-build-system-reviewers,glandium

Previously `mach` was both valid shell and valid Python. After all the recent
`mach` work, the need to have `mach` run as a shell script is gone and the
hack has been removed, leaving `mach` as a pure-Python script. Nice!

We took advantage of this hack when running the commit hook extensions
on Windows, though I can't remember exactly why. In any case we can move
to calling `mach` via `python3` directly instead of passing through `sh`.

Differential Revision: https://phabricator.services.mozilla.com/D135751

--HG--
extra : moz-landing-system : lando
  • Loading branch information
cgsheeh committed Jan 12, 2022
1 parent 56afe75 commit 36087ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hgext/clang-format/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def call_clang_format(repo, changed_files):
mach_path = os.path.join(repo.root, b'mach')
arguments = [b'clang-format', b'-p'] + path_list
if os.name == 'nt':
clang_format_cmd = [b'sh', b'mach'] + arguments
clang_format_cmd = [b'python3', b'mach'] + arguments
else:
clang_format_cmd = [mach_path] + arguments
subprocess.call(clang_format_cmd)
Expand Down
2 changes: 1 addition & 1 deletion hgext/js-format/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def call_js_format(repo, changed_files):
mach_path = os.path.join(repo.root, b'mach')
arguments = [b'eslint', b'--fix'] + path_list
if os.name == 'nt':
js_format_cmd = [b'sh', b'mach'] + arguments
js_format_cmd = [b'python3', b'mach'] + arguments
else:
js_format_cmd = [mach_path] + arguments
subprocess.call(js_format_cmd)
Expand Down

0 comments on commit 36087ff

Please sign in to comment.