From 20dc452614c991d1a4f5b7dcc1307cd03cba0c55 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Fri, 18 Jun 2010 07:56:55 -0700 Subject: Drop a couple usages of readlines (Bitbake rev: 40925230781ddd550bf21d90714c5349f9240a51) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/crumbs/buildmanager.py | 43 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'bitbake/lib/bb/ui/crumbs/buildmanager.py') diff --git a/bitbake/lib/bb/ui/crumbs/buildmanager.py b/bitbake/lib/bb/ui/crumbs/buildmanager.py index b5a4dae0de..e858d75e4c 100644 --- a/bitbake/lib/bb/ui/crumbs/buildmanager.py +++ b/bitbake/lib/bb/ui/crumbs/buildmanager.py @@ -76,31 +76,30 @@ class BuildConfiguration: # file format. @staticmethod def load_from_file (filename): - f = open (filename, "r") conf = BuildConfiguration() - for line in f.readlines(): - data = line.split (";")[1] - if (line.startswith ("metadata-url;")): - conf.metadata_url = data.strip() - continue - if (line.startswith ("url;")): - conf.urls += [data.strip()] - continue - if (line.startswith ("extra-url;")): - conf.extra_urls += [data.strip()] - continue - if (line.startswith ("machine;")): - conf.machine = data.strip() - continue - if (line.startswith ("distribution;")): - conf.distro = data.strip() - continue - if (line.startswith ("image;")): - conf.image = data.strip() - continue + with open(filename, "r") as f: + for line in f: + data = line.split (";")[1] + if (line.startswith ("metadata-url;")): + conf.metadata_url = data.strip() + continue + if (line.startswith ("url;")): + conf.urls += [data.strip()] + continue + if (line.startswith ("extra-url;")): + conf.extra_urls += [data.strip()] + continue + if (line.startswith ("machine;")): + conf.machine = data.strip() + continue + if (line.startswith ("distribution;")): + conf.distro = data.strip() + continue + if (line.startswith ("image;")): + conf.image = data.strip() + continue - f.close () return conf # Serialise to a file. This is part of the build process and we use this -- cgit v1.2.3-54-g00ecf