clang-tool-chain 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of clang-tool-chain might be problematic. Click here for more details.
- clang_tool_chain/__init__.py +0 -0
- clang_tool_chain/__version__.py +4 -0
- clang_tool_chain/checksums.py +270 -0
- clang_tool_chain/cli.py +575 -0
- clang_tool_chain/downloader.py +1325 -0
- clang_tool_chain/downloads/README.md +144 -0
- clang_tool_chain/downloads/__init__.py +22 -0
- clang_tool_chain/downloads/__main__.py +11 -0
- clang_tool_chain/downloads/create_hardlink_archive.py +390 -0
- clang_tool_chain/downloads/create_iwyu_archives.py +330 -0
- clang_tool_chain/downloads/deduplicate_binaries.py +217 -0
- clang_tool_chain/downloads/download_binaries.py +463 -0
- clang_tool_chain/downloads/expand_archive.py +260 -0
- clang_tool_chain/downloads/extract_mingw_sysroot.py +349 -0
- clang_tool_chain/downloads/fetch_and_archive.py +1376 -0
- clang_tool_chain/downloads/strip_binaries.py +436 -0
- clang_tool_chain/downloads/test_compression.py +259 -0
- clang_tool_chain/fetch.py +158 -0
- clang_tool_chain/paths.py +93 -0
- clang_tool_chain/sccache_runner.py +160 -0
- clang_tool_chain/wrapper.py +1383 -0
- clang_tool_chain-1.0.2.dist-info/METADATA +1766 -0
- clang_tool_chain-1.0.2.dist-info/RECORD +26 -0
- clang_tool_chain-1.0.2.dist-info/WHEEL +4 -0
- clang_tool_chain-1.0.2.dist-info/entry_points.txt +31 -0
- clang_tool_chain-1.0.2.dist-info/licenses/LICENSE +204 -0
|
File without changes
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SHA256 checksums for known LLVM releases.
|
|
3
|
+
|
|
4
|
+
This module provides a database of known SHA256 checksums for LLVM binary releases.
|
|
5
|
+
Checksums are used to verify the integrity and authenticity of downloaded binaries.
|
|
6
|
+
|
|
7
|
+
Note: LLVM releases typically use GPG signatures (.sig files) and GitHub attestations
|
|
8
|
+
(.jsonl files) rather than publishing standalone checksum files. The checksums in this
|
|
9
|
+
database are computed from verified LLVM releases and can be used for automated
|
|
10
|
+
verification during download.
|
|
11
|
+
|
|
12
|
+
To add checksums for a new release:
|
|
13
|
+
1. Download the official binary from https://github.com/llvm/llvm-project/releases
|
|
14
|
+
2. Verify the GPG signature or GitHub attestation
|
|
15
|
+
3. Compute the SHA256 checksum: `sha256sum <file>` (Linux/macOS) or `certutil -hashfile <file> SHA256` (Windows)
|
|
16
|
+
4. Add the checksum to the KNOWN_CHECKSUMS dictionary below
|
|
17
|
+
|
|
18
|
+
Platform keys follow the format: "{os}-{arch}"
|
|
19
|
+
- Windows x64: "win-x86_64"
|
|
20
|
+
- macOS x64: "mac-x86_64"
|
|
21
|
+
- macOS ARM: "mac-arm64"
|
|
22
|
+
- Linux x64: "linux-x86_64"
|
|
23
|
+
- Linux ARM: "linux-arm64"
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
# Database of known SHA256 checksums for LLVM releases
|
|
27
|
+
# Format: {version: {platform: checksum}}
|
|
28
|
+
KNOWN_CHECKSUMS: dict[str, dict[str, str]] = {
|
|
29
|
+
"21.1.5": {
|
|
30
|
+
# Windows x64 - Full archive (not installer)
|
|
31
|
+
# File: clang+llvm-21.1.5-x86_64-pc-windows-msvc.tar.xz
|
|
32
|
+
# Note: Add checksum after verifying the GPG signature
|
|
33
|
+
# "win-x86_64": "",
|
|
34
|
+
# macOS x64
|
|
35
|
+
# File: clang+llvm-21.1.5-x86_64-apple-darwin.tar.xz
|
|
36
|
+
# Note: May not be available in all releases
|
|
37
|
+
# "mac-x86_64": "",
|
|
38
|
+
# macOS ARM64
|
|
39
|
+
# File: clang+llvm-21.1.5-arm64-apple-darwin.tar.xz
|
|
40
|
+
# Note: May not be available in all releases
|
|
41
|
+
# "mac-arm64": "",
|
|
42
|
+
# Linux x64
|
|
43
|
+
# File: LLVM-21.1.5-Linux-X64.tar.xz
|
|
44
|
+
# Note: Add checksum after verifying the GitHub attestation
|
|
45
|
+
# "linux-x86_64": "",
|
|
46
|
+
# Linux ARM64
|
|
47
|
+
# File: LLVM-21.1.5-Linux-ARM64.tar.xz
|
|
48
|
+
# Note: Add checksum after verifying the GitHub attestation
|
|
49
|
+
# "linux-arm64": "",
|
|
50
|
+
},
|
|
51
|
+
# Additional versions can be added here
|
|
52
|
+
# "21.1.4": {...},
|
|
53
|
+
# "21.1.3": {...},
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_checksum(version: str, platform: str) -> str | None:
|
|
58
|
+
"""
|
|
59
|
+
Get the known SHA256 checksum for a specific LLVM version and platform.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
version: LLVM version string (e.g., "21.1.5")
|
|
63
|
+
platform: Platform key in format "{os}-{arch}" (e.g., "linux-x86_64")
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
SHA256 checksum as hex string, or None if not found
|
|
67
|
+
|
|
68
|
+
Example:
|
|
69
|
+
>>> get_checksum("21.1.5", "linux-x86_64")
|
|
70
|
+
'abc123...' # Returns checksum if available, None otherwise
|
|
71
|
+
"""
|
|
72
|
+
version_checksums = KNOWN_CHECKSUMS.get(version)
|
|
73
|
+
if version_checksums is None:
|
|
74
|
+
return None
|
|
75
|
+
|
|
76
|
+
return version_checksums.get(platform)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def has_checksum(version: str, platform: str) -> bool:
|
|
80
|
+
"""
|
|
81
|
+
Check if a checksum is available for a specific version and platform.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
version: LLVM version string (e.g., "21.1.5")
|
|
85
|
+
platform: Platform key in format "{os}-{arch}" (e.g., "linux-x86_64")
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
True if checksum is available, False otherwise
|
|
89
|
+
|
|
90
|
+
Example:
|
|
91
|
+
>>> has_checksum("21.1.5", "linux-x86_64")
|
|
92
|
+
False # No checksum available yet
|
|
93
|
+
"""
|
|
94
|
+
checksum = get_checksum(version, platform)
|
|
95
|
+
return checksum is not None and len(checksum) > 0
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def get_supported_versions() -> list[str]:
|
|
99
|
+
"""
|
|
100
|
+
Get a list of LLVM versions that have checksum information.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
List of version strings
|
|
104
|
+
|
|
105
|
+
Example:
|
|
106
|
+
>>> get_supported_versions()
|
|
107
|
+
['21.1.5']
|
|
108
|
+
"""
|
|
109
|
+
return list(KNOWN_CHECKSUMS.keys())
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def get_supported_platforms(version: str) -> list[str]:
|
|
113
|
+
"""
|
|
114
|
+
Get a list of platforms that have checksums for a specific version.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
version: LLVM version string (e.g., "21.1.5")
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
List of platform keys, or empty list if version not found
|
|
121
|
+
|
|
122
|
+
Example:
|
|
123
|
+
>>> get_supported_platforms("21.1.5")
|
|
124
|
+
[] # No checksums added yet
|
|
125
|
+
"""
|
|
126
|
+
version_checksums = KNOWN_CHECKSUMS.get(version)
|
|
127
|
+
if version_checksums is None:
|
|
128
|
+
return []
|
|
129
|
+
|
|
130
|
+
return [platform for platform, checksum in version_checksums.items() if checksum]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def add_checksum(version: str, platform: str, checksum: str) -> None:
|
|
134
|
+
"""
|
|
135
|
+
Add or update a checksum for a specific version and platform.
|
|
136
|
+
|
|
137
|
+
This function is primarily for programmatic updates to the checksum database.
|
|
138
|
+
For permanent additions, edit the KNOWN_CHECKSUMS dictionary directly.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
version: LLVM version string (e.g., "21.1.5")
|
|
142
|
+
platform: Platform key in format "{os}-{arch}" (e.g., "linux-x86_64")
|
|
143
|
+
checksum: SHA256 checksum as hex string
|
|
144
|
+
|
|
145
|
+
Example:
|
|
146
|
+
>>> add_checksum("21.1.5", "linux-x86_64", "abc123...")
|
|
147
|
+
"""
|
|
148
|
+
if version not in KNOWN_CHECKSUMS:
|
|
149
|
+
KNOWN_CHECKSUMS[version] = {}
|
|
150
|
+
|
|
151
|
+
KNOWN_CHECKSUMS[version][platform] = checksum.lower()
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def format_platform_key(os_name: str, arch: str) -> str:
|
|
155
|
+
"""
|
|
156
|
+
Format an OS name and architecture into a platform key.
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
os_name: Operating system name ("win", "mac", "linux")
|
|
160
|
+
arch: Architecture name ("x86_64", "arm64", "x86")
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
Platform key string
|
|
164
|
+
|
|
165
|
+
Example:
|
|
166
|
+
>>> format_platform_key("linux", "x86_64")
|
|
167
|
+
'linux-x86_64'
|
|
168
|
+
"""
|
|
169
|
+
# Normalize architecture names
|
|
170
|
+
arch_map = {
|
|
171
|
+
"x86": "x86_64", # Treat x86 as x86_64 for modern systems
|
|
172
|
+
"x64": "x86_64",
|
|
173
|
+
"amd64": "x86_64",
|
|
174
|
+
"arm": "arm64", # Treat arm as arm64 for modern systems
|
|
175
|
+
"aarch64": "arm64",
|
|
176
|
+
}
|
|
177
|
+
normalized_arch = arch_map.get(arch.lower(), arch.lower())
|
|
178
|
+
|
|
179
|
+
return f"{os_name.lower()}-{normalized_arch}"
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
# Documentation for adding checksums
|
|
183
|
+
CHECKSUM_INSTRUCTIONS = """
|
|
184
|
+
How to Add Checksums to the Database
|
|
185
|
+
=====================================
|
|
186
|
+
|
|
187
|
+
1. Download the Official Binary
|
|
188
|
+
- Go to https://github.com/llvm/llvm-project/releases
|
|
189
|
+
- Download the binary for your target platform
|
|
190
|
+
- Example: LLVM-21.1.5-Linux-X64.tar.xz
|
|
191
|
+
|
|
192
|
+
2. Verify the Official Signature
|
|
193
|
+
For Linux (GitHub attestation):
|
|
194
|
+
```bash
|
|
195
|
+
gh attestation verify LLVM-21.1.5-Linux-X64.tar.xz --owner llvm
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
For Windows (GPG signature):
|
|
199
|
+
```bash
|
|
200
|
+
gpg --verify LLVM-21.1.5-win64.exe.sig LLVM-21.1.5-win64.exe
|
|
201
|
+
```
|
|
202
|
+
(First import LLVM release keys from https://releases.llvm.org/)
|
|
203
|
+
|
|
204
|
+
3. Compute the SHA256 Checksum
|
|
205
|
+
Linux/macOS:
|
|
206
|
+
```bash
|
|
207
|
+
sha256sum LLVM-21.1.5-Linux-X64.tar.xz
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Windows PowerShell:
|
|
211
|
+
```powershell
|
|
212
|
+
Get-FileHash LLVM-21.1.5-win64.exe -Algorithm SHA256
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Windows CMD:
|
|
216
|
+
```cmd
|
|
217
|
+
certutil -hashfile LLVM-21.1.5-win64.exe SHA256
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
4. Add to KNOWN_CHECKSUMS Dictionary
|
|
221
|
+
Edit this file and add the checksum:
|
|
222
|
+
```python
|
|
223
|
+
"21.1.5": {
|
|
224
|
+
"linux-x86_64": "abc123...", # Your computed checksum
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
5. Test the Checksum
|
|
229
|
+
```bash
|
|
230
|
+
uv run python -c "from clang_tool_chain.checksums import get_checksum; print(get_checksum('21.1.5', 'linux-x86_64'))"
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Platform Keys Reference
|
|
234
|
+
=======================
|
|
235
|
+
- Windows 64-bit: "win-x86_64"
|
|
236
|
+
- macOS Intel: "mac-x86_64"
|
|
237
|
+
- macOS Apple Silicon: "mac-arm64"
|
|
238
|
+
- Linux 64-bit: "linux-x86_64"
|
|
239
|
+
- Linux ARM64: "linux-arm64"
|
|
240
|
+
|
|
241
|
+
File Naming Conventions
|
|
242
|
+
=======================
|
|
243
|
+
LLVM uses different naming patterns for releases:
|
|
244
|
+
|
|
245
|
+
Windows:
|
|
246
|
+
- Installer: LLVM-{version}-win64.exe (or win32.exe)
|
|
247
|
+
- Archive: clang+llvm-{version}-x86_64-pc-windows-msvc.tar.xz
|
|
248
|
+
|
|
249
|
+
Linux:
|
|
250
|
+
- Archive: LLVM-{version}-Linux-X64.tar.xz (or Linux-ARM64.tar.xz)
|
|
251
|
+
|
|
252
|
+
macOS (when available):
|
|
253
|
+
- Archive: clang+llvm-{version}-x86_64-apple-darwin.tar.xz
|
|
254
|
+
- Archive: clang+llvm-{version}-arm64-apple-darwin.tar.xz
|
|
255
|
+
|
|
256
|
+
Note: macOS binaries are not always available in official releases.
|
|
257
|
+
Consider using Homebrew builds or terralang/llvm-build for macOS.
|
|
258
|
+
"""
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
if __name__ == "__main__":
|
|
262
|
+
# Print instructions when run directly
|
|
263
|
+
print(CHECKSUM_INSTRUCTIONS)
|
|
264
|
+
print("\nCurrently Supported Versions:")
|
|
265
|
+
for version in get_supported_versions():
|
|
266
|
+
platforms = get_supported_platforms(version)
|
|
267
|
+
if platforms:
|
|
268
|
+
print(f" {version}: {', '.join(platforms)}")
|
|
269
|
+
else:
|
|
270
|
+
print(f" {version}: (no checksums added yet)")
|