...
 
Commits (2)
......@@ -59,13 +59,23 @@ def outputs(type_str, board):
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-d", default=None)
parser.add_argument("-t", type=str, required=True)
parser.add_argument("-f", type=int, required=True)
parser.add_argument("--board", type=str, required=True)
parser.add_argument("filename", type=str)
parser.add_argument("-t", type=str, default=None)
parser.add_argument("-f", type=int, default=None)
parser.add_argument("--board", type=str, default=None)
parser.add_argument("--version", action="store_true", default=False)
parser.add_argument("filename", type=str, nargs="*")
options = parser.parse_args()
print(outputs(options.t, options.board))
if options.version:
print("0.13.1")
else:
# Check that the right arguments are present
if len(options.filename) != 1:
print("missing filename")
return 1
if options.t is None or options.f is None or options.board is None:
return 1
print(outputs(options.t, options.board))
if __name__ == "__main__":
......
......@@ -177,6 +177,10 @@ def cache_fetch(_, config):
LOG.debug("-> %s: %s", key, urls[key])
with (cache / key).open("wb") as f_out:
r = requests.get(urls[key], stream=True)
if r.status_code != 200:
raise Exception(
"Unable to fetch %s (%d) at %s" % (key, r.status_code, urls[key])
)
for chunk in r.iter_content(chunk_size=128):
f_out.write(chunk)
......