diff options
author | bors-servo <infra@servo.org> | 2023-05-19 13:09:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-19 13:09:29 +0200 |
commit | 71c5bb02b41b8d98b1612563558c2c14b3e20b1a (patch) | |
tree | 3896fe2ce7741ae30e67dbe1f5c84acb0272c087 /python/servo/util.py | |
parent | 42332e588849aa5451f81e976dea0d1c19ea7a1b (diff) | |
parent | 5be14ecc3cc92309637604b48bdcf249b110ac16 (diff) | |
download | servo-71c5bb02b41b8d98b1612563558c2c14b3e20b1a.tar.gz servo-71c5bb02b41b8d98b1612563558c2c14b3e20b1a.zip |
Auto merge of #29754 - mrobinson:organize-python-by-platform, r=mukilan
Start organizing platform-specific Python code
This starts to split platform-specific Python code into its own module, which should help to tidy up our mach commands and make things more reusable. This is step one toward fixing #25335.
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because they just change mach scripts.
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'python/servo/util.py')
-rw-r--r-- | python/servo/util.py | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/python/servo/util.py b/python/servo/util.py index c41cb1e1640..4151bbd4929 100644 --- a/python/servo/util.py +++ b/python/servo/util.py @@ -12,7 +12,6 @@ from __future__ import absolute_import, print_function, unicode_literals import hashlib import os import os.path -import platform import shutil import stat import sys @@ -59,40 +58,6 @@ def delete(path): os.remove(path) -def host_platform(): - os_type = platform.system().lower() - if os_type == "linux": - os_type = "unknown-linux-gnu" - elif os_type == "darwin": - os_type = "apple-darwin" - elif os_type == "android": - os_type = "linux-androideabi" - elif os_type == "windows": - os_type = "pc-windows-msvc" - elif os_type == "freebsd": - os_type = "unknown-freebsd" - else: - os_type = "unknown" - return os_type - - -def host_triple(): - os_type = host_platform() - cpu_type = platform.machine().lower() - if cpu_type in ["i386", "i486", "i686", "i768", "x86"]: - cpu_type = "i686" - elif cpu_type in ["x86_64", "x86-64", "x64", "amd64"]: - cpu_type = "x86_64" - elif cpu_type == "arm": - cpu_type = "arm" - elif cpu_type == "aarch64": - cpu_type = "aarch64" - else: - cpu_type = "unknown" - - return "{}-{}".format(cpu_type, os_type) - - def download(desc, src, writer, start_byte=0): if start_byte: print("Resuming download of {} ...".format(src)) @@ -229,3 +194,7 @@ def check_hash(filename, expected, algorithm): if hasher.hexdigest() != expected: print("Incorrect {} hash for {}".format(algorithm, filename)) sys.exit(1) + + +def get_default_cache_dir(topdir): + return os.environ.get("SERVO_CACHE_DIR", os.path.join(topdir, ".servo")) |