Migrate to downloader.py for inline gzip extract

This commit is contained in:
CorpNewt 2020-10-04 18:19:48 -05:00 committed by GitHub
parent ca635e2149
commit 81385d5028
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@ else:
from pprint import pprint from pprint import pprint
from xml.dom import minidom from xml.dom import minidom
import downloader
# SUCATALOG_URL = 'http://swscan.apple.com/content/catalogs/others/index-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog' # SUCATALOG_URL = 'http://swscan.apple.com/content/catalogs/others/index-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog'
SUCATALOG_URL = 'https://swscan.apple.com/content/catalogs/others/index-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog' SUCATALOG_URL = 'https://swscan.apple.com/content/catalogs/others/index-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog'
@ -15,6 +16,8 @@ SUCATALOG_URL = 'https://swscan.apple.com/content/catalogs/others/index-10.14-10
# 7-Zip MSI (19.00) # 7-Zip MSI (19.00)
SEVENZIP_URL = 'https://www.7-zip.org/a/7z1900-x64.msi' SEVENZIP_URL = 'https://www.7-zip.org/a/7z1900-x64.msi'
d = downloader.Downloader()
def status(msg): def status(msg):
print("{}\n".format(msg)) print("{}\n".format(msg))
@ -239,7 +242,7 @@ according to the post date.")
sucatalog_url = config_plist['CatalogURL'] sucatalog_url = config_plist['CatalogURL']
data = urlopen(sucatalog_url).read() data = d.get_string(sucatalog_url)
p = loads_plist(data) p = loads_plist(data)
allprods = p['Products'] allprods = p['Products']
@ -256,7 +259,7 @@ according to the post date.")
for bc_prod in bc_prods: for bc_prod in bc_prods:
if 'English' in list(bc_prod[1]['Distributions']): if 'English' in list(bc_prod[1]['Distributions']):
disturl = bc_prod[1]['Distributions']['English'] disturl = bc_prod[1]['Distributions']['English']
dist_data = urlopen(disturl).read() dist_data = d.get_string(disturl)
dist_data = dist_data.decode("utf-8") if sys.version_info >= (3,0) else dist_data dist_data = dist_data.decode("utf-8") if sys.version_info >= (3,0) else dist_data
if opts.latest_version or re.search(model, dist_data): if opts.latest_version or re.search(model, dist_data):
supported_models = [] supported_models = []