|
2 | 2 | # This hacks around pip's lack of support for supporting environment markers |
3 | 3 | # when specifying --platform/--abi/--implementation etc |
4 | 4 | # |
| 5 | +# In principle we could just directly patch pip on the robot but that |
| 6 | +# has its own share of downsides so we just do this instead |
| 7 | +# |
5 | 8 |
|
6 | 9 | import platform |
7 | 10 | import runpy |
8 | 11 | import sysconfig |
9 | 12 | import os |
10 | 13 | import sys |
11 | 14 |
|
| 15 | +# TODO: better detection needed to ensure we only run this on systemcore |
| 16 | +# but this is fine for now? |
| 17 | +if sysconfig.get_platform() == "linux-aarch64": |
| 18 | + try: |
| 19 | + import pip._vendor.packaging.tags as tags |
| 20 | + |
| 21 | + def platform_tags(): |
| 22 | + for i in reversed(range(17, 38)): |
| 23 | + yield f"manylinux_2_{i}_aarch64" |
| 24 | + |
| 25 | + yield "linux_systemcore" |
| 26 | + yield "linux_aarch64" |
| 27 | + |
| 28 | + tags.platform_tags = platform_tags |
| 29 | + |
| 30 | + except ImportError: |
| 31 | + pass |
| 32 | + |
12 | 33 |
|
13 | 34 | if __name__ == "__main__": |
14 | | - # Setup environment for what the RoboRIO python would have |
| 35 | + # Setup environment for what the SystemCore python would have |
15 | 36 | # -> strictly speaking we only care about platform.machine as that's what |
16 | 37 | # we're using in robotpy-meta, but the rest for completeness |
17 | | - sysconfig.get_platform = lambda: "linux_roborio" |
18 | | - platform.machine = lambda: "roborio" |
| 38 | + sysconfig.get_platform = lambda: "linux-systemcore" |
| 39 | + platform.machine = lambda: "systemcore" |
19 | 40 | platform.python_implementation = lambda: "CPython" |
20 | 41 | platform.system = lambda: "Linux" |
21 | 42 | platform.python_version = lambda: "3.13.0" |
|
0 commit comments