| 92 | |
| 93 | |
| 94 | def write_mock_wrapper(root, script): |
| 95 | if os.name == "nt": |
| 96 | wrapper = root / "mock-ocr.cmd" |
| 97 | wrapper.write_text( |
| 98 | f'@echo off\r\n"{sys.executable}" -u "{script}" --mock-ocr %*\r\n', |
| 99 | encoding="utf-8", |
| 100 | ) |
| 101 | return wrapper |
| 102 | import shlex |
| 103 | wrapper = root / "mock-ocr" |
| 104 | wrapper.write_text("#!/bin/sh\nexec " + shlex.quote(sys.executable) + " " + |
| 105 | shlex.quote(str(script)) + |
| 106 | ' --mock-ocr "$@"\n', encoding="utf-8") |
| 107 | wrapper.chmod(0o700) |
| 108 | return wrapper |
| 109 | |
| 110 | |
| 111 | class SmokeClient: |