| 182 | |
| 183 | |
| 184 | def compile_file(source_path: str) -> str: |
| 185 | if source_path.endswith(".py"): |
| 186 | basename = source_path[:-3] |
| 187 | else: |
| 188 | basename = source_path |
| 189 | |
| 190 | if hasattr(sys, "pypy_version_info"): |
| 191 | bytecode_path = f"{basename}-pypy{version_tuple_to_str()}.pyc" |
| 192 | else: |
| 193 | bytecode_path = f"{basename}-{version_tuple_to_str()}.pyc" |
| 194 | |
| 195 | print(f"compiling {source_path} to {bytecode_path}") |
| 196 | py_compile.compile(source_path, bytecode_path, "exec") |
| 197 | return bytecode_path |
| 198 | |
| 199 | |
| 200 | def decompile_file( |