mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 21:55:57 +00:00
Merge pull request #262: Linux fixes (wdiasjunior)
Shader preparation reads MacNativeGames' whole shader list history,
release downloads resume from a .part file, appimagetool and the type-2
runtime come from release tags, and the preparation summary counts the
vertex and fragment variants it skips with the graphics pipeline library
off.
The gettid cache in runtime/platform/linux.c conflicted with the same fix
already on dev (8dd7e20, #236); dev's version is kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
47485da7d9
6 files changed
+73
-25
No files matched your search
+24
-5
@@ -38,6 +38,7 @@ import subprocess
|
||||
import sys
|
||||
import tarfile
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
@@ -126,13 +127,31 @@ def fetch(name):
|
||||
path = DL / f'{name}-9.0.4.tar.gz' # upstream archives have identical basenames
|
||||
if name == 'libvpx-src':
|
||||
path = DL / 'libvpx-1.17.0.tar.gz'
|
||||
if not path.is_file():
|
||||
print(f'download {url}')
|
||||
with urllib.request.urlopen(url) as r, open(path, 'wb') as f:
|
||||
shutil.copyfileobj(r, f)
|
||||
if path.is_file():
|
||||
if sha256_file(path) == want:
|
||||
return path
|
||||
print(f'{path}: not the pinned file (a cut download or an older pin); downloading it again')
|
||||
path.unlink()
|
||||
# into <name>.part, renamed once complete: a cut connection leaves a .part that the next run resumes, never a
|
||||
# short file under the final name
|
||||
part = path.with_name(path.name + '.part')
|
||||
have = part.stat().st_size if part.is_file() else 0
|
||||
print(f'download {url}' + (f' (resuming at {have} bytes)' if have else ''))
|
||||
req = urllib.request.Request(url, headers={'Range': f'bytes={have}-'} if have else {})
|
||||
try:
|
||||
with urllib.request.urlopen(req) as r:
|
||||
if have and r.status != 206: # the server ignored the range: start over
|
||||
have = 0
|
||||
with open(part, 'ab' if have else 'wb') as f:
|
||||
shutil.copyfileobj(r, f)
|
||||
except urllib.error.HTTPError as e:
|
||||
if e.code != 416: # 416: the .part already holds the whole file
|
||||
raise
|
||||
part.replace(path)
|
||||
got = sha256_file(path)
|
||||
if got != want:
|
||||
sys.exit(f'{path}: sha256 {got}, pinned {want}')
|
||||
path.unlink() # a .part resumed from another upload, or the URL now serves another file: start clean next run
|
||||
sys.exit(f'{path}: sha256 {got}, pinned {want}; deleted, run again to download it anew')
|
||||
return path
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user