amprolla is an apt repository merger originally intended for use with the Devuan infrastructure. This version is the third iteration of the software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
812 B

#!/usr/bin/env python3
6 years ago
# copyright (c) 2017 - Ivan J. <parazyd@dyne.org>
# see LICENSE file for copyright and license details
import requests
import os
6 years ago
from .log import die, notice, warn, cleanexit
6 years ago
def download(url, path):
print("\tdownloading: %s\n\tto: %s" % (url, path))
r = requests.get(url, stream=True)
if r.status_code == 404:
warn("download of %s failed: not found!" % url)
6 years ago
return
elif r.status_code != 200:
die("download of %s failed", url)
6 years ago
os.makedirs(os.path.dirname(path), exist_ok=True)
6 years ago
with open(path, "wb") as f:
6 years ago
# XXX: should be more on gbit servers
for chunk in r.iter_content(chunk_size=1024):
6 years ago
if chunk:
f.write(chunk)
6 years ago
# f.flush()
6 years ago
print("\033[1;32m . done\033[0m")
return