Make the yaml loader optional, delaying the failure until the user
attempts to actually load a yaml file.  Given that pyyaml is an external
dependency, there is no real reason to fail as soon as repoman.config is
loaded if YAML may not be used at all.
 repoman/lib/repoman/ | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/repoman/lib/repoman/ b/repoman/lib/repoman/
index 578bbccde..decf9b90a 100644
--- a/repoman/lib/repoman/
+++ b/repoman/lib/repoman/
@@ -6,7 +6,10 @@ import json
 import os
 import stat
-import yaml
+       import yaml
+except ImportError:
+       yaml = None
@@ -73,6 +76,9 @@ def _yaml_load(filename):
        Load filename as YAML and return a dict. Raise ConfigError if
        it fails to load.
+       if yaml is None:
+               raise ImportError('Please install pyyaml in order to read yaml 
        with open(filename, 'rt') as f:
                        return yaml.safe_load(f)

Reply via email to