(cls, platform, cause=None)
| 33 | |
| 34 | @classmethod |
| 35 | def create(cls, platform, cause=None): |
| 36 | message_parts = ["Not a valid platform specifier: {platform}".format(platform=platform)] |
| 37 | if cause: |
| 38 | message_parts.append(cause) |
| 39 | message_parts.append( |
| 40 | dedent( |
| 41 | """\ |
| 42 | Platform strings must be in one of two forms: |
| 43 | 1. Canonical: <platform>-<python impl abbr>-<python version>-<abi> |
| 44 | 2. Abbreviated: <platform>-<python impl abbr>-<python version>-<abbr abi> |
| 45 | |
| 46 | These fields stem from wheel name conventions as outlined in |
| 47 | https://peps.python.org/pep-0427#file-name-convention and influenced by |
| 48 | https://peps.python.org/pep-0425 except as otherwise noted below. |
| 49 | |
| 50 | Given a canonical platform string for CPython 3.7.5 running on 64 bit Linux of: |
| 51 | linux-x86_64-cp-37-cp37m |
| 52 | |
| 53 | Where the fields above are: |
| 54 | + <platform>: linux-x86_64 |
| 55 | + <python impl abbr>: cp (e.g.: cp for CPython or pp for PyPY) |
| 56 | + <python version>: 37 (a 2 or more digit major/minor version or a component |
| 57 | dotted version) |
| 58 | + <abi>: cp37m |
| 59 | |
| 60 | The abbreviated platform string is: |
| 61 | linux-x86_64-cp-37-m |
| 62 | |
| 63 | Some other canonical platform string examples: |
| 64 | + OSX CPython: macosx-10.13-x86_64-cp-36-cp36m |
| 65 | + Linux PyPy: linux-x86_64-pp-273-pypy_73. |
| 66 | |
| 67 | Unlike in the conventions set forth in PEP-425 and PEP-427, the python version |
| 68 | field can take on a component dotted value. So, for the example of CPython 3.7.5 |
| 69 | running on 64 bit Linux, you could also specify: |
| 70 | + canonical: linux-x86_64-cp-3.7.5-cp37m |
| 71 | + abbreviated: linux-x86_64-cp-3.7.5-m |
| 72 | |
| 73 | You may be forced to specify this form when resolves encounter environment |
| 74 | markers that use `python_full_version`. See the `--complete-platform` help as |
| 75 | well as: |
| 76 | + https://docs.pex-tool.org/buildingpex.html#complete-platform |
| 77 | + https://peps.python.org/pep-0508/#environment-markers |
| 78 | """ |
| 79 | ) |
| 80 | ) |
| 81 | return cls("\n\n".join(message_parts)) |
| 82 | |
| 83 | SEP = "-" |
| 84 |
no test coverage detected