Debian Codegraph @

test-crates/pyo3-bin/check_installed/check_installed.py

raw
1 import os
2 import platform
3 import sys
4 from subprocess import check_output
5
6
7 def main():
8 if platform.system().lower() == "windows":
9 # Add sys.base_prefix which contains python3y.dll to PATH
10 # otherwise running `pyo3-bin` might return exit code 3221225781
11 path = os.environ["PATH"]
12 path = path + os.pathsep + sys.base_prefix
13 os.environ["PATH"] = path
14
15 output = check_output(["pyo3-bin"]).decode("utf-8").strip()
16 if not output == "Hello, world!":
17 raise Exception(output)
18 print("SUCCESS")
19
20
21 if __name__ == "__main__":
22 main()