[Treepkg-commits] r64 - trunk/treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Jun 2 17:01:35 CEST 2008


Author: bh
Date: 2008-06-02 17:01:34 +0200 (Mon, 02 Jun 2008)
New Revision: 64

Modified:
   trunk/treepkg/packager.py
Log:
Extend _filenameproperty so that the filename can be interpreted
relative to an attriute other than base_dir'.


Modified: trunk/treepkg/packager.py
===================================================================
--- trunk/treepkg/packager.py	2008-06-02 14:55:34 UTC (rev 63)
+++ trunk/treepkg/packager.py	2008-06-02 15:01:34 UTC (rev 64)
@@ -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):



More information about the Treepkg-commits mailing list