Permalink
Browse files

Remove envfiles on '-' action.

  • Loading branch information...
1 parent 07cb063 commit 1dbae1a2a5b8ad57eb448d8b5da51e19e7dc4cda @mgorny committed Aug 30, 2011
Showing with 15 additions and 1 deletion.
  1. +15 −1 lib/flaggie/packagefile.py
@@ -363,6 +363,20 @@ def write(self, *args):
PackageFileSet.write(*((self,) + args))
+class PackageEnvFileSet(PackageFileSet):
+ def write(self, *args):
+ if not self._files:
+ return
+
+ for f in self.files:
+ for e in f:
+ if e.modified:
+ rlist = [fl for fl in e if fl.modifier == '-']
+ for fl in rlist:
+ e.remove(fl)
+
+ PackageFileSet.write(*((self,) + args))
+
class PackageFiles(object):
def __init__(self, basedir, dbapi, mkconf = None):
p = lambda x: os.path.join(basedir, x)
@@ -375,7 +389,7 @@ def __init__(self, basedir, dbapi, mkconf = None):
'use': PackageFileSet(p('package.use')),
'kw': PackageKeywordsFileSet(pkw, dbapi),
'lic': PackageFileSet(p('package.license')),
- 'env': PackageFileSet(p('package.env'))
+ 'env': PackageEnvFileSet(p('package.env'))
}
if mkconf:

0 comments on commit 1dbae1a

Please sign in to comment.