| 31 | |
| 32 | |
| 33 | def build_pex_pex( |
| 34 | output_file: PurePath, verbosity: int = 0, env: Optional[Dict[str, str]] = None |
| 35 | ) -> PurePath: |
| 36 | # NB: We do not include the subprocess extra (which would be spelled: `.[subprocess]`) since we |
| 37 | # would then produce a pex that would not be consumable by all python interpreters otherwise |
| 38 | # meeting `python_requires`; ie: we'd need to then come up with a deploy environment / deploy |
| 39 | # tooling, that built subprocess32 for linux cp27m, cp27mu, pypy, ... etc. Even with all the |
| 40 | # work expended to do this, we'd still miss some platform someone wanted to run the Pex PEX on. |
| 41 | # As such, we just ship unadorned Pex which is pure-python and universal. Any user wanting the |
| 42 | # extra is encouraged to build a Pex PEX for their particular platform themselves. |
| 43 | pex_requirement = "." |
| 44 | |
| 45 | args = [ |
| 46 | sys.executable, |
| 47 | "-m", |
| 48 | "pex", |
| 49 | *["-v" for _ in range(verbosity)], |
| 50 | "--disable-cache", |
| 51 | "--no-build", |
| 52 | "--no-compile", |
| 53 | "--no-use-system-time", |
| 54 | "--python-shebang", |
| 55 | "/usr/bin/env python", |
| 56 | "--no-strip-pex-env", |
| 57 | "--include-tools", |
| 58 | "--record-git-state", |
| 59 | "--pip-version", |
| 60 | "latest-compatible", |
| 61 | "-o", |
| 62 | str(output_file), |
| 63 | "-c", |
| 64 | "pex", |
| 65 | pex_requirement, |
| 66 | ] |
| 67 | subprocess.run(args=args, env=env, check=True) |
| 68 | return output_file |
| 69 | |
| 70 | |
| 71 | def build_pex_scie( |