Skip to content

Commit a851e57

Browse files
committed
python3-harvester.py: Fix some debug messages.
The 'file' keyword is not valid for the debug() function, this was introduced in 93b99a8 and could cause issues in mintupdate when checking for Cinnamon updates.
1 parent c1343c6 commit a851e57

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

python3/cinnamon/harvester.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@
2727

2828
DEBUG = os.getenv("DEBUG") is not None
2929

30-
3130
def debug(msg):
3231
if DEBUG:
33-
print(msg)
34-
32+
print(msg, file=sys.stderr)
3533

3634
LANGUAGE_CODE = "C"
3735
try:
@@ -257,7 +255,7 @@ def _update_local_json(self):
257255
debug(f"Downloading from {r.request.url}")
258256
r.raise_for_status()
259257
except Exception as e:
260-
print(f"Could not refresh json data for {self.spice_type}: {e}")
258+
debug(f"Could not refresh json data for {self.spice_type}: {e}")
261259
return
262260

263261
with open(self.index_file, "w", encoding="utf-8") as f:
@@ -289,7 +287,7 @@ def _download_thumb(self, uuid, item):
289287
params={"time": get_current_timestamp()})
290288
r.raise_for_status()
291289
except Exception as e:
292-
print(f"Could not get thumbnail for {uuid}: {e}")
290+
debug(f"Could not get thumbnail for {uuid}: {e}")
293291
return
294292

295293
with open(paths.thumb_local_path, "wb", encoding="utf-8") as f:
@@ -322,7 +320,7 @@ def _load_metadata(self):
322320
self.meta_map[uuid] = metadata
323321
except Exception as detail:
324322
debug(detail)
325-
print(f"Skipping {uuid}: there was a problem trying to read metadata.json", file=sys.stderr)
323+
debug(f"Skipping {uuid}: there was a problem trying to read metadata.json")
326324
except FileNotFoundError:
327325
# debug("%s does not exist! Creating it now." % directory)
328326
try:
@@ -365,7 +363,7 @@ def _generate_update_list(self):
365363
update = SpiceUpdate(self.spice_type, uuid, self.index_cache[uuid], self.meta_map[uuid])
366364
self.updates.append(update)
367365
except Exception as e:
368-
debug(f"Error checking updates for {uuid}: {e}", file=sys.stderr)
366+
debug(f"Error checking updates for {uuid}: {e}")
369367
raise
370368

371369
return self.updates
@@ -384,7 +382,7 @@ def _install_by_uuid(self, uuid):
384382
try:
385383
item = self.index_cache[uuid]
386384
except KeyError:
387-
print(f"Can't install {uuid} - it doesn't seem to exist on the server", file=sys.stderr)
385+
debug(f"Can't install {uuid} - it doesn't seem to exist on the server")
388386
raise
389387

390388
paths = SpicePathSet(item, spice_type=self.spice_type)
@@ -396,7 +394,7 @@ def _install_by_uuid(self, uuid):
396394
params={"time": get_current_timestamp()})
397395
r.raise_for_status()
398396
except Exception as e:
399-
debug(f"Could not download zip for {uuid}: {e}", file=sys.stderr)
397+
debug(f"Could not download zip for {uuid}: {e}")
400398
raise
401399

402400
try:
@@ -415,7 +413,7 @@ def _install_by_uuid(self, uuid):
415413

416414
self._load_metadata()
417415
except Exception as e:
418-
debug(f"couldn't install: {e}", file=sys.stderr)
416+
debug(f"couldn't install: {e}")
419417
raise
420418

421419
def _install_from_folder(self, folder, base_folder, uuid, from_spices=False):

0 commit comments

Comments
 (0)