Fix ever-growing supported models list for multiple ESD matches

- fixes #7
This commit is contained in:
Timothy Sutton 2014-01-17 14:55:36 -05:00
parent 343d95b6ee
commit 7412efcfc2
2 changed files with 6 additions and 3 deletions

View file

@ -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

View file

@ -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: