# HG changeset patch # User Bernhard Herzog # Date 1176805764 -7200 # Node ID 7c55fb368d0bf3367839ce1494df268c746b7252 # Parent 6c4a4b8d672983ff89bde5d5e0dca3f32cd5ce8e web: expand the cachedir value of of staticweb.cfg diff -r 6c4a4b8d6729 -r 7c55fb368d0b demostaticweb.cfg --- a/demostaticweb.cfg Tue Apr 17 11:52:28 2007 +0200 +++ b/demostaticweb.cfg Tue Apr 17 12:29:24 2007 +0200 @@ -34,5 +34,9 @@ publish_dir: /tmp/treepkg-status # local cache directory. publishstaticweb.py may delete it and its -# contents. -cachedir: /tmp/treepkg-status +# contents. The value is passed through the python functions +# os.path.expanduser and os.path.expandvars, so references to home +# directories of the form ~ or ~user at the beginning of the value and +# environment variable references of the form $VAR or ${VAR} are +# expanded. +cachedir: /tmp/${USER}/treepkg-status-cache diff -r 6c4a4b8d6729 -r 7c55fb368d0b publishstaticweb.py --- a/publishstaticweb.py Tue Apr 17 11:52:28 2007 +0200 +++ b/publishstaticweb.py Tue Apr 17 12:29:24 2007 +0200 @@ -19,11 +19,18 @@ def remove_trailing_slashes(s): return s.rstrip("/") +def expand_filename(filename): + """ + Applies os.path.expanduser and os.path.expandvars to filename + """ + return os.path.expandvars(os.path.expanduser(filename)) + staticweb_desc = ["build_user", "build_host", "build_create", ("build_dir", remove_trailing_slashes), "publish_user", "publish_host", ("publish_dir", remove_trailing_slashes), - ("cachedir", remove_trailing_slashes)] + ("cachedir", + lambda s: expand_filename(remove_trailing_slashes(s)))] def read_config(filename): parser = SafeConfigParser()