Skip to content

Commit a609e24

Browse files
committed
[O] JDK Script: Use a map for normalizing cpu arch
1 parent cfc99cd commit a609e24

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tools/download_jdk.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ def download_oracle(java_ver: Literal['19', '17'], path: str | Path):
4848
assert s in ['linux', 'macos', 'windows'], f'Unsupported OS for Oracle JDK: {s}'
4949

5050
a = arch.lower()
51-
if a == 'x86_64' or a == 'x86_32':
52-
a = 'x64'
53-
if a == 'ARM_8' or a == 'ARM_7':
54-
a = 'aarch64'
55-
assert a in ['x64', 'aarch64'], f'Unsupported CPU architecture for Oracle JDK: {a}'
51+
arch_map = {'x86_64': 'x64', 'x86_32': 'x64', 'arm_8': 'aarch64', 'arm_7': 'aarch64'}
52+
assert a in arch_map, f'Unsupported CPU architecture for Oracle JDK: {a}'
53+
a = arch_map[a]
5654

5755
# Create URL
5856
ext = 'tar.gz' if s in ['linux', 'macos'] else 'zip'

0 commit comments

Comments
 (0)