public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Minor Smart improvement
@ 2013-02-08  9:16 Paul Eggleton
  2013-02-08  9:16 ` [PATCH 1/1] python-smartpm: show friendly error if YAML output requested without PyYAML Paul Eggleton
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggleton @ 2013-02-08  9:16 UTC (permalink / raw)
  To: openembedded-core

The following change since commit 688e9485980de0f29aa00e24ce53a3efd3a3a7cc:

  qemu.bbclass: fix segfaults when running through pseudo (2013-02-07 16:50:40 +0000)

is available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib paule/smart-yaml
  http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/smart-yaml

Paul Eggleton (1):
  python-smartpm: show friendly error if YAML output requested without
    PyYAML

 .../python/python-smartpm/smart-yaml-error.patch   |   86 ++++++++++++++++++++
 .../python/python-smartpm_1.4.1.bb                 |    1 +
 2 files changed, 87 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python-smartpm/smart-yaml-error.patch

-- 
1.7.10.4




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] python-smartpm: show friendly error if YAML output requested without PyYAML
  2013-02-08  9:16 [PATCH 0/1] Minor Smart improvement Paul Eggleton
@ 2013-02-08  9:16 ` Paul Eggleton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggleton @ 2013-02-08  9:16 UTC (permalink / raw)
  To: openembedded-core

Instead of a python backtrace, tell the user they need to install PyYAML
if they wish to use the --yaml output options.

Fixes [YOCTO #3768].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 .../python/python-smartpm/smart-yaml-error.patch   |   86 ++++++++++++++++++++
 .../python/python-smartpm_1.4.1.bb                 |    1 +
 2 files changed, 87 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python-smartpm/smart-yaml-error.patch

diff --git a/meta/recipes-devtools/python/python-smartpm/smart-yaml-error.patch b/meta/recipes-devtools/python/python-smartpm/smart-yaml-error.patch
new file mode 100644
index 0000000..e16c5c1
--- /dev/null
+++ b/meta/recipes-devtools/python/python-smartpm/smart-yaml-error.patch
@@ -0,0 +1,86 @@
+Print a more friendly error if YAML output is requested without PyYAML
+
+Upstream-Status: Pending
+
+Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
+
+diff --git a/smart/commands/channel.py b/smart/commands/channel.py
+index 63fbb35..108f3f1 100644
+--- a/smart/commands/channel.py
++++ b/smart/commands/channel.py
+@@ -339,7 +339,10 @@ def main(ctrl, opts):
+                     print
+ 
+     if opts.yaml is not None:
+-        import yaml
++        try:
++            import yaml
++        except ImportError:
++            raise Error, _("Please install PyYAML in order to use this function")
+         yamlchannels = {}
+         for alias in (opts.yaml or sysconf.get("channels", ())):
+             channel = sysconf.get(("channels", alias))
+diff --git a/smart/commands/config.py b/smart/commands/config.py
+index 4fe4366..aa1db78 100644
+--- a/smart/commands/config.py
++++ b/smart/commands/config.py
+@@ -137,7 +137,10 @@ def main(ctrl, opts):
+             pprint.pprint(sysconf.get((), hard=True))
+ 
+     if opts.yaml is not None:
+-        import yaml
++        try:
++            import yaml
++        except ImportError:
++            raise Error, _("Please install PyYAML in order to use this function")
+         if opts.yaml:
+             marker = object()
+             for opt in opts.yaml:
+diff --git a/smart/commands/flag.py b/smart/commands/flag.py
+index ed18999..8b90496 100644
+--- a/smart/commands/flag.py
++++ b/smart/commands/flag.py
+@@ -138,7 +138,10 @@ def main(ctrl, opts):
+             print
+ 
+     if opts.yaml is not None:
+-        import yaml
++        try:
++            import yaml
++        except ImportError:
++            raise Error, _("Please install PyYAML in order to use this function")
+         yamlflags = {}
+         for flag in opts.yaml or pkgconf.getFlagNames():
+             flag = flag.strip()
+diff --git a/smart/commands/mirror.py b/smart/commands/mirror.py
+index ca50a95..f7b019d 100644
+--- a/smart/commands/mirror.py
++++ b/smart/commands/mirror.py
+@@ -218,7 +218,10 @@ def main(ctrl, opts):
+             print
+ 
+     if opts.yaml:
+-        import yaml
++        try:
++            import yaml
++        except ImportError:
++            raise Error, _("Please install PyYAML in order to use this function")
+         yamlmirrors = {}
+         mirrors = sysconf.get("mirrors", ())
+         for origin in mirrors:
+diff --git a/smart/commands/priority.py b/smart/commands/priority.py
+index d850d29..441ea32 100644
+--- a/smart/commands/priority.py
++++ b/smart/commands/priority.py
+@@ -117,7 +117,10 @@ def main(ctrl, opts):
+         print
+ 
+     elif opts.yaml:
+-        import yaml
++        try:
++            import yaml
++        except ImportError:
++            raise Error, _("Please install PyYAML in order to use this function")
+         yamlpriorities = {}
+         priorities = sysconf.get("package-priorities", {})
+         for name in opts.args or priorities:
diff --git a/meta/recipes-devtools/python/python-smartpm_1.4.1.bb b/meta/recipes-devtools/python/python-smartpm_1.4.1.bb
index 06641ad..d92933f 100644
--- a/meta/recipes-devtools/python/python-smartpm_1.4.1.bb
+++ b/meta/recipes-devtools/python/python-smartpm_1.4.1.bb
@@ -26,6 +26,7 @@ SRC_URI = "\
           file://smart-metadata-match.patch \
           file://smart-improve-error-reporting.patch \
           file://smart-multilib-fixes.patch \
+          file://smart-yaml-error.patch \
           "
 
 SRC_URI[md5sum] = "573ef32ba177a6b3c4bf7ef04873fcb6"
-- 
1.7.10.4




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-08  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-08  9:16 [PATCH 0/1] Minor Smart improvement Paul Eggleton
2013-02-08  9:16 ` [PATCH 1/1] python-smartpm: show friendly error if YAML output requested without PyYAML Paul Eggleton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox