Skip to content

Commit

Permalink
Slightly tweak the manifest code. Export Manifest class.
Browse files Browse the repository at this point in the history
  • Loading branch information
tabatkins committed Nov 4, 2024
1 parent 58d37bf commit 6d748d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bikeshed/update/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .main import fixupDataFiles, update, updateReadonlyDataFiles
from .manifest import createManifest
from .manifest import Manifest, createManifest
from .mode import UpdateMode

__all__ = [
Expand Down
11 changes: 7 additions & 4 deletions bikeshed/update/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ def updateByManifest(path: str, dryRun: bool = False, updateMode: UpdateMode = U

m.say("Fetching remote manifest data...")
try:
remoteManifest = Manifest.fromString(requests.get(ghPrefix + "manifest.txt", timeout=5).text)
remoteManifestText = requests.get(ghPrefix + "manifest.txt", timeout=5).text
except Exception as e:
m.warn(
f"Couldn't download remote manifest file, so can't update. Please report this!\n{e}",
)
m.warn("Update manually with `bikeshed update --skip-manifest`.")
m.warn("If absolutely necessary, you can update manually with `bikeshed update --skip-manifest`.")
return None
remoteManifest = Manifest.fromString(remoteManifestText)

if remoteManifest is None:
m.die("Something's gone wrong with the remote data; I can't read its timestamp. Please report this!")
Expand Down Expand Up @@ -297,8 +298,10 @@ def legacyFromString(text: str) -> Manifest | None:
lines = text.split("\n")
if len(lines) < 10:
# Something's definitely borked
msg = "Manifest is too short to possibly be valid."
raise ValueError(msg)
m.warn(
f"Error when parsing manifest: manifest is {len(lines)} long, which is too short to possibly be valid. Please report this!\nEntire manifest:\n{text}",
)
return None
dt = parseDt(lines[0].strip())
if dt is None:
return None
Expand Down

0 comments on commit 6d748d4

Please sign in to comment.