diff options
author | Sebastian Pipping <sebastian@pipping.org> | 2010-01-28 00:49:55 +0100 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2010-01-28 00:49:55 +0100 |
commit | 7a4e280313f57f714c499aed2566c93744d60851 (patch) | |
tree | 851c5f33b4664d5708d6da3a6974e5a01eb493f3 /layman/db.py | |
parent | c654e79fd18adb0e9f1cae6b783f8c81b39dda61 (diff) | |
download | layman-7a4e280313f57f714c499aed2566c93744d60851.tar.gz layman-7a4e280313f57f714c499aed2566c93744d60851.tar.bz2 layman-7a4e280313f57f714c499aed2566c93744d60851.zip |
Delete empty overlay directories
Diffstat (limited to 'layman/db.py')
-rw-r--r-- | layman/db.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/layman/db.py b/layman/db.py index 252e81a..e0763b3 100644 --- a/layman/db.py +++ b/layman/db.py @@ -26,7 +26,7 @@ __version__ = "$Id: db.py 309 2007-04-09 16:23:38Z wrobel $" import os, codecs, os.path, urllib2, re, hashlib -from layman.utils import path +from layman.utils import path, delete_empty_directory from layman.overlay import Overlays, UnknownOverlayException from layman.debug import OUT @@ -116,11 +116,16 @@ class DB(Overlays): make_conf = MakeConf(self.config, self.overlays) make_conf.add(overlay) else: - raise Exception('Adding the overlay failed! Possible remains of' - ' the operation have NOT been removed and may b' - 'e left at ' + path([self.config['storage'], - overlay.name]) + '. Please re' - 'move them manually if required.') + mdir = path([self.config['storage'], overlay.name]) + delete_empty_directory(mdir) + if os.path.exists(mdir): + raise Exception('Adding overlay "%s" failed!' + ' Possible remains of the operation have NOT' + ' been removed and may be left at "%s".' + ' Please remove them manually if required.' \ + % (overlay.name, mdir)) + else: + raise Exception('Adding overlay "%s" failed!' % overlay.name) else: raise Exception('Overlay "' + overlay.name + '" already in the loca' 'l list!') |