From e6857efe04644d6fc68eebc03153d99272209aaa Mon Sep 17 00:00:00 2001 From: willip Date: Fri, 8 Mar 2019 11:53:21 +0000 Subject: [PATCH] - update .gitignore to ignore python bytecode - move log-routine to pyf - add feature to check_update to properly check if the file exists --- .gitignore | 3 ++- __pycache__/pyf.cpython-35.pyc | Bin 1389 -> 1668 bytes pyf.py | 11 ++++++++++- quickos.py | 33 +++++++++++---------------------- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 223f15a..6fc6cad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.swp Session.vim -__pycache__ +__pycache__/ +*.py[cod] diff --git a/__pycache__/pyf.cpython-35.pyc b/__pycache__/pyf.cpython-35.pyc index e8039a82b4e91a7071985b693472554340dc73d9..3e79dd98533ff534356bf26e588364915c99d5bc 100644 GIT binary patch delta 942 zcmZ8g&2G~`5T3CeC(TcrmY<6DfTdJLKJ*8UsH!S~gaDP6Hc*s;BGGD{LvIf$Gi3x2qvtl~Au$H?tH} zD6jQ1YK29;RuFkiHyi78u*zs-8E@cidk!mxa46>HRJLAckzcPXBZ`%Mz@^_~D!a3> t_5AVEEur;IwH>vfzagmQ)Lxkp;7S;=ZopUdUlQw(Z4|L+*;vdK?Z3sV%isV2 delta 639 zcmZ8dO=}ZT6g_u7UMA_JjZJJ+tSux6gJAxEErNoIikL0k`B9Y_~aK;|$ew7Ivi7I^!+f&NXK)roi!t6nDyXp-xNY1(-ieui@O zSGs&9QCZH=SzKT#)3-Lw6BA}Ca^B!ff9OwEl@9b5tNw=Hbsc0b20)kp3XBM{jPoN4 zL&7cTLFSD#t^)@n8$-sjt^(u?qz_qyoHcso90r6DocGHZ3Jh#RDNAN4&tM?X%`vw{ z>vA3sn~%5oVxxS584(d*)`E(@Z@-#*?d}a5d&57}I3(7rzuV6&HKXg!+Y2tw>Zl0r zCi#9MJ6X7q#Z~>ydD1AIoc{xQtsU8Wl(ganMjYAXld9<3ZcQid;>zJ)j=*cr_Ei*Z zJ-@2Loqm{R$}@a no: download image file @@ -64,15 +49,19 @@ def check_update(database): ''' check if update is necessary ''' from urllib.parse import urlparse from os import path - for name, ops in database.items(): + for name, dist in database.items(): prt('checking operating system {} ...'.format(name)) - if ops['file_name'] == '': - file_name = urlparse(ops['file_url']) + if dist['file_name'] == '': + file_name = urlparse(dist['file_url']) file_name = file_name.path - file_name = path.basename(file_name) - print(file_name) - download(ops['file_url'], file_name) + file_name = '{}/dist/{}'.format(WORKDIR, path.basename(file_name)) + download(dist['file_url'], file_name) + continue + + file_name = '{}/dist/{}'.format(WORKDIR, dist['file_name']) + if not path.isfile(file_name): + download(dist['file_url'], file_name) continue