diff options
Diffstat (limited to 'bitbake/lib/bb/ui/puccho.py')
| -rw-r--r-- | bitbake/lib/bb/ui/puccho.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/bitbake/lib/bb/ui/puccho.py b/bitbake/lib/bb/ui/puccho.py index 2ac025303e..a627fc803f 100644 --- a/bitbake/lib/bb/ui/puccho.py +++ b/bitbake/lib/bb/ui/puccho.py | |||
| @@ -24,6 +24,7 @@ import gtk.glade | |||
| 24 | import threading | 24 | import threading |
| 25 | import urllib2 | 25 | import urllib2 |
| 26 | import os | 26 | import os |
| 27 | import contextlib | ||
| 27 | 28 | ||
| 28 | from bb.ui.crumbs.buildmanager import BuildManager, BuildConfiguration | 29 | from bb.ui.crumbs.buildmanager import BuildManager, BuildConfiguration |
| 29 | from bb.ui.crumbs.buildmanager import BuildManagerTreeView | 30 | from bb.ui.crumbs.buildmanager import BuildManagerTreeView |
| @@ -77,20 +78,19 @@ class MetaDataLoader(gobject.GObject): | |||
| 77 | def run (self): | 78 | def run (self): |
| 78 | result = {} | 79 | result = {} |
| 79 | try: | 80 | try: |
| 80 | f = urllib2.urlopen (self.url) | 81 | with contextlib.closing (urllib2.urlopen (self.url)) as f: |
| 81 | 82 | # Parse the metadata format. The format is.... | |
| 82 | # Parse the metadata format. The format is.... | 83 | # <machine>;<default distro>|<distro>...;<default image>|<image>...;<type##url>|... |
| 83 | # <machine>;<default distro>|<distro>...;<default image>|<image>...;<type##url>|... | 84 | for line in f: |
| 84 | for line in f.readlines(): | 85 | components = line.split(";") |
| 85 | components = line.split(";") | 86 | if (len (components) < 4): |
| 86 | if (len (components) < 4): | 87 | raise MetaDataLoader.LoaderThread.LoaderImportException |
| 87 | raise MetaDataLoader.LoaderThread.LoaderImportException | 88 | machine = components[0] |
| 88 | machine = components[0] | 89 | distros = components[1].split("|") |
| 89 | distros = components[1].split("|") | 90 | images = components[2].split("|") |
| 90 | images = components[2].split("|") | 91 | urls = components[3].split("|") |
| 91 | urls = components[3].split("|") | 92 | |
| 92 | 93 | result[machine] = (distros, images, urls) | |
| 93 | result[machine] = (distros, images, urls) | ||
| 94 | 94 | ||
| 95 | # Create an object representing this *potential* | 95 | # Create an object representing this *potential* |
| 96 | # configuration. It can become concrete if the machine, distro | 96 | # configuration. It can become concrete if the machine, distro |
