Skip to content

Commit cd3c398

Browse files
committed
let's try this
1 parent cd9b83f commit cd3c398

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

.pre-commit-scripts/install_gettext.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,19 @@
77

88
def main():
99
if sys.platform == "win32":
10-
try:
11-
cmd = shlex.split(
12-
"Set-ExecutionPolicy RemoteSigned -Scope CurrentUser;irm get.scoop.sh | iex;scoop install gettext", posix=False
13-
)
14-
return subprocess.run(cmd, shell=True, check=True, executable=shutil.which("powershell"))
15-
except Exception:
16-
print(
17-
NotImplementedError(
18-
"WARNING: Use scoop to install gettext on Windows!!! Otherwise powrap will fail.\nRefer to \
19-
https://github.com/python/python-docs-tr/blob/HEAD/wiki/gettext.md for instructions."
20-
)
21-
)
22-
exit(0)
10+
executable = shutil.which("powershell.exe")
11+
cmd = shlex.split("Set-ExecutionPolicy RemoteSigned -Scope CurrentUser;irm get.scoop.sh | iex", posix=False)
12+
p_scoop = subprocess.run(cmd, shell=True, executable=executable)
13+
p_install = subprocess.run(shlex.split("scoop install gettext", posix=False), shell=True, executable=executable)
14+
15+
return p_scoop.returncode or p_install.returncode
16+
2317
elif sys.platform in ["linux", "linux2"]:
2418
cmd = "sudo apt update && sudo apt install -y gettext"
2519
else: # macOS
2620
cmd = "brew update && brew install gettext"
27-
return subprocess.run(cmd, shell=True, check=True)
21+
return subprocess.run(cmd, shell=True).returncode
2822

2923

3024
if __name__ == "__main__":
31-
exit(main().returncode)
25+
exit(main())

0 commit comments

Comments
 (0)