From 7412efcfc24d0db07781a5bf9d69fe1a55c35396 Mon Sep 17 00:00:00 2001 From: Timothy Sutton Date: Fri, 17 Jan 2014 14:55:36 -0500 Subject: [PATCH] Fix ever-growing supported models list for multiple ESD matches - fixes #7 --- CHANGELIST | 2 ++ brigadier | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELIST b/CHANGELIST index 76a1583..2068ee1 100644 --- a/CHANGELIST +++ b/CHANGELIST @@ -4,6 +4,8 @@ - update dmg2iso to 1.6.5 - '-l/--leave-files' is now '-k/--keep-files', following the naming pattern most other utilities use when keeping files around. +- fix issue where the supported models list reported when multiple matching ESDs + were found was inaccurate 0.2.0 (August 4, 2013) - fix issues with Boot Camp installer not installing certain packages diff --git a/brigadier b/brigadier index f21128f..abf23b6 100755 --- a/brigadier +++ b/brigadier @@ -12,6 +12,7 @@ import optparse import datetime import platform +from pprint import pprint from urllib import urlretrieve from xml.dom import minidom @@ -188,8 +189,6 @@ when running the installer out of 'system32'." % output_dir) bc_prods.append((prod_id, prod_data)) # Find the ESD(s) that applies to our model pkg_data = [] - supported_models = [] - re_model = "([a-zA-Z]{4,12}[1-9]{1,2}\,[1-6])" for bc_prod in bc_prods: if 'English' in bc_prod[1]['Distributions'].keys(): @@ -197,12 +196,14 @@ when running the installer out of 'system32'." % output_dir) distfd = urllib2.urlopen(disturl) dist_data = distfd.read() if re.search(model, dist_data): + supported_models = [] pkg_data.append({bc_prod[0]: bc_prod[1]}) model_matches_in_dist = re.findall(re_model, dist_data) for supported_model in model_matches_in_dist: supported_models.append(supported_model) status("Model supported in package distribution file at %s." % disturl) - status("Distribution supports the following models: %s." % ", ".join(supported_models)) + status("Distribution %s supports the following models: %s." % + (bc_prod[0], ", ".join(supported_models))) # Ensure we have only one ESD if len(pkg_data) == 0: