summaryrefslogtreecommitdiff
path: root/src/verbs/sync.py
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-01-13 20:03:32 +0000
committerdavidovski <david@davidovski.xyz>2022-01-13 20:03:32 +0000
commit169c42b7c4d9311030f027528e4b13307e1c4688 (patch)
treecccc51dc2a7a8f709f7a5c604065c3d813c06612 /src/verbs/sync.py
parent64ce365acfbe4f617f18e2b1de26930fe3010bcd (diff)
fixed issue with divide by 0
Diffstat (limited to 'src/verbs/sync.py')
-rw-r--r--src/verbs/sync.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/verbs/sync.py b/src/verbs/sync.py
index 70adcd1..5559fcb 100644
--- a/src/verbs/sync.py
+++ b/src/verbs/sync.py
@@ -3,6 +3,7 @@ import util
import colors
import shutil
import time
+import sys
CACHE_DIR = "/var/cache/xipkg"
@@ -16,7 +17,10 @@ def list_packages(url):
if status != 200:
return {}, -1
else:
- duration /= len(response)
+ if len(response) > 0:
+ duration /= len(response)
+ else:
+ duration = float('inf')
return {
line.split()[0].split(".")[0]: " ".join(line.split()[1:])
for line in response.split("\n") if len(line.split()) > 0