commit:     1d9c2fe87449cfdd23b3bc45813a77a835513025
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  9 18:25:11 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Mon Feb  9 18:25:11 2015 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=1d9c2fe8

updater.py: Adds repos.conf dir creation if it doesn't exist

---
 layman/updater.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/layman/updater.py b/layman/updater.py
index 6fd1281..ccf6c8d 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -182,6 +182,16 @@ class Main(object):
 
     def create_repos_conf(self):
         self.output.info("  Creating layman's repos.conf file")
+        conf_dir = os.path.dirname(self.config['repos_conf'])
+
+        if not os.path.isdir(conf_dir):
+            try:
+                os.mkdir(conf_dir)
+            except OSError as e:
+                self.output.error('  create_repos_conf() error creating %s: ' 
% conf_dir)
+                self.output.error('  "%s"' % e)
+                return None
+
         layman_inst = LaymanAPI(config=self.config)
         overlays = {}
         for ovl in layman_inst.get_installed():

Reply via email to