testing/freeze/create_executable.py
raw| 1 | """Generate an executable with pytest runner embedded using PyInstaller.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | |
| 6 | if __name__ == "__main__": |
| 7 | import subprocess |
| 8 | |
| 9 | import pytest |
| 10 | |
| 11 | hidden = [] |
| 12 | for x in pytest.freeze_includes(): |
| 13 | hidden.extend(["--hidden-import", x]) |
| 14 | hidden.extend(["--hidden-import", "distutils"]) |
| 15 | args = ["pyinstaller", "--noconfirm", *hidden, "runtests_script.py"] |
| 16 | subprocess.check_call(" ".join(args), shell=True) |