diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-10-02 17:58:15 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-11-12 17:04:48 +0000 |
commit | 42afeb422ea0a5e226cef586353d194d0339bbd7 (patch) | |
tree | 86bc1c6716b6b60bb4f77ebd9fa9d044da0daf7a /bitbake/lib/toaster/bldcontrol/models.py | |
parent | 46f1fbe3abb3677861178b7008bf5edf73125197 (diff) | |
download | poky-42afeb422ea0a5e226cef586353d194d0339bbd7.tar.gz |
bitbake: toastergui: Various fixes for projects, layers and targets page
This is a combined set of fixes for the project, layers and targets
pages in the project section of toaster.
The fixes correct behaviour and look in various parts of the page,
including submitting XHR commands and updating the DOM with the correct
info.
(Bitbake rev: 96d7738f964784871c928c376cb9fbc9a275cf00)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/models.py')
-rw-r--r-- | bitbake/lib/toaster/bldcontrol/models.py | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/models.py b/bitbake/lib/toaster/bldcontrol/models.py index f72fb8fbc9..e643d08603 100644 --- a/bitbake/lib/toaster/bldcontrol/models.py +++ b/bitbake/lib/toaster/bldcontrol/models.py | |||
@@ -42,11 +42,34 @@ class BuildEnvironment(models.Model): | |||
42 | 42 | ||
43 | def get_artifact_type(self, path): | 43 | def get_artifact_type(self, path): |
44 | if self.betype == BuildEnvironment.TYPE_LOCAL: | 44 | if self.betype == BuildEnvironment.TYPE_LOCAL: |
45 | import magic | 45 | try: |
46 | m = magic.open(magic.MAGIC_MIME_TYPE) | 46 | import magic |
47 | m.load() | 47 | |
48 | return m.file(path) | 48 | # fair warning: this is a mess; there are multiple competeing and incompatible |
49 | raise Exception("FIXME: not implemented") | 49 | # magic modules floating around, so we try some of the most common combinations |
50 | |||
51 | try: # we try ubuntu's python-magic 5.4 | ||
52 | m = magic.open(magic.MAGIC_MIME_TYPE) | ||
53 | m.load() | ||
54 | return m.file(path) | ||
55 | except AttributeError: | ||
56 | pass | ||
57 | |||
58 | try: # we try python-magic 0.4.6 | ||
59 | m = magic.Magic(magic.MAGIC_MIME) | ||
60 | return m.from_file(path) | ||
61 | except AttributeError: | ||
62 | pass | ||
63 | |||
64 | try: # we try pip filemagic 1.6 | ||
65 | m = magic.Magic(flags=magic.MAGIC_MIME_TYPE) | ||
66 | return m.id_filename(path) | ||
67 | except AttributeError: | ||
68 | pass | ||
69 | |||
70 | return "binary/octet-stream" | ||
71 | except ImportError: | ||
72 | return "binary/octet-stream" | ||
50 | 73 | ||
51 | def get_artifact(self, path): | 74 | def get_artifact(self, path): |
52 | if self.betype == BuildEnvironment.TYPE_LOCAL: | 75 | if self.betype == BuildEnvironment.TYPE_LOCAL: |