diff treepkg/packager.py @ 139:a7fa22320c3f

Extend _filenameproperty so that the filename can be interpreted relative to an attriute other than base_dir'.
author Bernhard Herzog <bh@intevation.de>
date Mon, 02 Jun 2008 15:01:34 +0000
parents 5598014b2a1d
children 0da76aee8035
line wrap: on
line diff
--- a/treepkg/packager.py	Mon Jun 02 14:55:34 2008 +0000
+++ b/treepkg/packager.py	Mon Jun 02 15:01:34 2008 +0000
@@ -23,9 +23,14 @@
 from cmdexpand import cmdexpand
 from builder import PBuilder
 
-def _filenameproperty(relative_dir):
+def _filenameproperty(filename, dir_attr="base_dir"):
+    """Create a property for a directory or filename.
+    If the filename is relative it is interpreted as relative to the
+    value of the attribute of self named by dir_attr which defaults to
+    'base_dir'.
+    """
     def get(self):
-        return os.path.join(self.base_dir, relative_dir)
+        return os.path.join(getattr(self, dir_attr), filename)
     return property(get)
 
 def _fromparent(attr):
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)